Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ccb6e1b

Browse filesBrowse files
[DI] configure inlined services before injecting when dumping the container
1 parent 432487f commit ccb6e1b
Copy full SHA for ccb6e1b

File tree

Expand file treeCollapse file tree

8 files changed

+186
-305
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+186
-305
lines changed

‎src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+167-256Lines changed: 167 additions & 256 deletions
Large diffs are not rendered by default.

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ protected function getBAR2Service()
129129
protected function getBar3Service()
130130
{
131131
$a = ($this->services['foo.baz'] ?? $this->getFoo_BazService());
132-
133132
$this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar'));
134133

135134
$a->configure($instance);
@@ -254,7 +253,6 @@ protected function getFactoryServiceSimpleService()
254253
protected function getFooService()
255254
{
256255
$a = ($this->services['foo.baz'] ?? $this->getFoo_BazService());
257-
258256
$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
259257

260258
$instance->foo = 'bar';
@@ -301,7 +299,6 @@ protected function getFooWithInlineService()
301299
$this->services['foo_with_inline'] = $instance = new \Foo();
302300

303301
$a = new \Bar();
304-
305302
$a->pub = 'pub';
306303
$a->setBaz(($this->services['baz'] ?? $this->getBazService()));
307304

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php
+11-19Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ protected function getBar3Service()
105105
$this->services['bar3'] = $instance = new \BarCircular();
106106

107107
$a = new \FoobarCircular();
108-
109108
$instance->addFoobar($a, $a);
110109

111110
return $instance;
@@ -119,14 +118,14 @@ protected function getBar3Service()
119118
protected function getConnectionService()
120119
{
121120
$a = new \stdClass();
122-
123121
$b = new \stdClass();
124-
125122
$this->services['connection'] = $instance = new \stdClass($a, $b);
126123

127124
$a->subscriber = ($this->services['subscriber'] ?? $this->getSubscriberService());
125+
128126
$b->logger = ($this->services['logger'] ?? $this->getLoggerService());
129127

128+
130129
return $instance;
131130
}
132131

@@ -138,18 +137,17 @@ protected function getConnectionService()
138137
protected function getConnection2Service()
139138
{
140139
$a = new \stdClass();
140+
$c = new \stdClass();
141+
$this->services['connection2'] = $instance = new \stdClass($a, $c);
141142

142-
$b = new \stdClass();
143-
144-
$this->services['connection2'] = $instance = new \stdClass($a, $b);
145-
146-
$c = ($this->services['manager2'] ?? $this->getManager2Service());
143+
$b = ($this->services['manager2'] ?? $this->getManager2Service());
144+
$a->subscriber2 = new \stdClass($b);
147145

148146
$d = new \stdClass($instance);
149147

150-
$a->subscriber2 = new \stdClass($c);
151-
$d->handler2 = new \stdClass($c);
152-
$b->logger2 = $d;
148+
$d->handler2 = new \stdClass($b);
149+
$c->logger2 = $d;
150+
153151

154152
return $instance;
155153
}
@@ -162,11 +160,11 @@ protected function getConnection2Service()
162160
protected function getFooService()
163161
{
164162
$a = new \BarCircular();
165-
166163
$this->services['foo'] = $instance = new \FooCircular($a);
167164

168165
$a->addFoobar(new \FoobarCircular($instance));
169166

167+
170168
return $instance;
171169
}
172170

@@ -182,7 +180,6 @@ protected function getFoo2Service()
182180
if (isset($this->services['foo2'])) {
183181
return $this->services['foo2'];
184182
}
185-
186183
return $this->services['foo2'] = new \FooCircular($a);
187184
}
188185

@@ -196,7 +193,6 @@ protected function getFoo5Service()
196193
$this->services['foo5'] = $instance = new \stdClass();
197194

198195
$a = new \stdClass($instance);
199-
200196
$a->foo = $instance;
201197

202198
$instance->bar = $a;
@@ -212,11 +208,11 @@ protected function getFoo5Service()
212208
protected function getFoobar4Service()
213209
{
214210
$a = new \stdClass();
215-
216211
$this->services['foobar4'] = $instance = new \stdClass($a);
217212

218213
$a->foobar = $instance;
219214

215+
220216
return $instance;
221217
}
222218

@@ -232,7 +228,6 @@ protected function getLoggerService()
232228
if (isset($this->services['logger'])) {
233229
return $this->services['logger'];
234230
}
235-
236231
$this->services['logger'] = $instance = new \stdClass($a);
237232

238233
$instance->handler = new \stdClass(($this->services['manager'] ?? $this->getManagerService()));
@@ -252,7 +247,6 @@ protected function getManagerService()
252247
if (isset($this->services['manager'])) {
253248
return $this->services['manager'];
254249
}
255-
256250
return $this->services['manager'] = new \stdClass($a);
257251
}
258252

@@ -268,7 +262,6 @@ protected function getManager2Service()
268262
if (isset($this->services['manager2'])) {
269263
return $this->services['manager2'];
270264
}
271-
272265
return $this->services['manager2'] = new \stdClass($a);
273266
}
274267

@@ -284,7 +277,6 @@ protected function getSubscriberService()
284277
if (isset($this->services['subscriber'])) {
285278
return $this->services['subscriber'];
286279
}
287-
288280
return $this->services['subscriber'] = new \stdClass($a);
289281
}
290282
}

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php
+5-16Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ protected function getBar3Service()
105105
$this->services['bar3'] = $instance = new \BarCircular();
106106

107107
$a = ($this->services['foobar3'] ?? $this->services['foobar3'] = new \FoobarCircular());
108-
109108
$instance->addFoobar($a, $a);
110109

111110
return $instance;
@@ -123,7 +122,6 @@ protected function getBar5Service()
123122
if (isset($this->services['bar5'])) {
124123
return $this->services['bar5'];
125124
}
126-
127125
$this->services['bar5'] = $instance = new \stdClass($a);
128126

129127
$instance->foo = $a;
@@ -143,13 +141,12 @@ protected function getConnectionService()
143141
if (isset($this->services['connection'])) {
144142
return $this->services['connection'];
145143
}
146-
147144
$b = new \stdClass();
148-
149145
$this->services['connection'] = $instance = new \stdClass($a, $b);
150146

151147
$b->logger = ($this->services['logger'] ?? $this->getLoggerService());
152148

149+
153150
return $instance;
154151
}
155152

@@ -165,16 +162,15 @@ protected function getConnection2Service()
165162
if (isset($this->services['connection2'])) {
166163
return $this->services['connection2'];
167164
}
168-
169165
$b = new \stdClass();
170-
171166
$this->services['connection2'] = $instance = new \stdClass($a, $b);
172167

173168
$c = new \stdClass($instance);
174-
175169
$c->handler2 = new \stdClass(($this->services['manager2'] ?? $this->getManager2Service()));
170+
176171
$b->logger2 = $c;
177172

173+
178174
return $instance;
179175
}
180176

@@ -218,7 +214,6 @@ protected function getFooService()
218214
if (isset($this->services['foo'])) {
219215
return $this->services['foo'];
220216
}
221-
222217
return $this->services['foo'] = new \FooCircular($a);
223218
}
224219

@@ -230,11 +225,11 @@ protected function getFooService()
230225
protected function getFoo2Service()
231226
{
232227
$a = new \BarCircular();
233-
234228
$this->services['foo2'] = $instance = new \FooCircular($a);
235229

236230
$a->addFoobar(($this->services['foobar2'] ?? $this->getFoobar2Service()));
237231

232+
238233
return $instance;
239234
}
240235

@@ -278,7 +273,6 @@ protected function getFoobarService()
278273
if (isset($this->services['foobar'])) {
279274
return $this->services['foobar'];
280275
}
281-
282276
return $this->services['foobar'] = new \FoobarCircular($a);
283277
}
284278

@@ -294,7 +288,6 @@ protected function getFoobar2Service()
294288
if (isset($this->services['foobar2'])) {
295289
return $this->services['foobar2'];
296290
}
297-
298291
return $this->services['foobar2'] = new \FoobarCircular($a);
299292
}
300293

@@ -316,11 +309,11 @@ protected function getFoobar3Service()
316309
protected function getFoobar4Service()
317310
{
318311
$a = new \stdClass();
319-
320312
$this->services['foobar4'] = $instance = new \stdClass($a);
321313

322314
$a->foobar = $instance;
323315

316+
324317
return $instance;
325318
}
326319

@@ -336,7 +329,6 @@ protected function getLoggerService()
336329
if (isset($this->services['logger'])) {
337330
return $this->services['logger'];
338331
}
339-
340332
$this->services['logger'] = $instance = new \stdClass($a);
341333

342334
$instance->handler = new \stdClass(($this->services['manager'] ?? $this->getManagerService()));
@@ -356,7 +348,6 @@ protected function getManagerService()
356348
if (isset($this->services['manager'])) {
357349
return $this->services['manager'];
358350
}
359-
360351
return $this->services['manager'] = new \stdClass($a);
361352
}
362353

@@ -372,7 +363,6 @@ protected function getManager2Service()
372363
if (isset($this->services['manager2'])) {
373364
return $this->services['manager2'];
374365
}
375-
376366
return $this->services['manager2'] = new \stdClass($a);
377367
}
378368

@@ -388,7 +378,6 @@ protected function getSubscriberService()
388378
if (isset($this->services['subscriber'])) {
389379
return $this->services['subscriber'];
390380
}
391-
392381
return $this->services['subscriber'] = new \stdClass($a);
393382
}
394383
}

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_deep_graph.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_deep_graph.php
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,12 @@ protected function getFooService()
8585
if (isset($this->services['foo'])) {
8686
return $this->services['foo'];
8787
}
88-
8988
$b = new \c2();
90-
91-
$this->services['foo'] = $instance = new \c1($a, $b);
92-
9389
$c = new \c3();
94-
9590
$c->p3 = new \c4();
91+
9692
$b->p2 = $c;
9793

98-
return $instance;
94+
return $this->services['foo'] = new \c1($a, $b);
9995
}
10096
}

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ protected function getBAR2Service()
129129
protected function getBar3Service()
130130
{
131131
$a = ($this->services['foo.baz'] ?? $this->getFoo_BazService());
132-
133132
$this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, 'foo_bar');
134133

135134
$a->configure($instance);
@@ -254,7 +253,6 @@ protected function getFactoryServiceSimpleService()
254253
protected function getFooService()
255254
{
256255
$a = ($this->services['foo.baz'] ?? $this->getFoo_BazService());
257-
258256
$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
259257

260258
$instance->foo = 'bar';
@@ -301,7 +299,6 @@ protected function getFooWithInlineService()
301299
$this->services['foo_with_inline'] = $instance = new \Foo();
302300

303301
$a = new \Bar();
304-
305302
$a->pub = 'pub';
306303
$a->setBaz(($this->services['baz'] ?? $this->getBazService()));
307304

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ protected function getC1Service()
101101
*/
102102
protected function getC2Service()
103103
{
104-
include_once $this->targetDirs[1].'/includes/HotPath/C3.php';
105104
include_once $this->targetDirs[1].'/includes/HotPath/C2.php';
105+
include_once $this->targetDirs[1].'/includes/HotPath/C3.php';
106106

107107
return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3());
108108
}

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ protected function getTranslator3Service()
165165
})));
166166

167167
$a = ($this->services['translator.loader_3'] ?? $this->services['translator.loader_3'] = new \stdClass());
168-
169168
$instance->addResource('db', $a, 'nl');
170169
$instance->addResource('db', $a, 'en');
171170

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.