8000 bug #28507 [DI] fix dumping lazy services (nicolas-grekas) · symfony/symfony@8877a33 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8877a33

Browse files
bug #28507 [DI] fix dumping lazy services (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [DI] fix dumping lazy services | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #28304 | License | MIT | Doc PR | - Commits ------- 7cf1505 [DI] fix dumping lazy services
2 parents 4eb4089 + 7cf1505 commit 8877a33

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function dump(array $options = array())
154154
}
155155
}
156156

157-
(new AnalyzeServiceReferencesPass(false, !$this->getProxyDumper() instanceof NullDumper))->process($this->container);
157+
(new AnalyzeServiceReferencesPass(false))->process($this->container);
158158
$this->circularReferences = array();
159159
$checkedNodes = array();
160160
foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) {

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

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,11 @@ protected function getBar5Service()
134134
*/
135135
protected function getConnectionService()
136136
{
137-
$a = ${($_ = isset($this->services['dispatcher']) ? $this->services['dispatcher'] : $this->getDispatcherService()) && false ?: '_'};
138-
139-
if (isset($this->services['connection'])) {
140-
return $this->services['connection'];
141-
}
142-
143-
$b = new \stdClass();
137+
$a = new \stdClass();
144138

145-
$this->services['connection'] = $instance = new \stdClass($a, $b);
139+
$this->services['connection'] = $instance = new \stdClass(${($_ = isset($this->services['dispatcher']) ? $this->services['dispatcher'] : $this->getDispatcherService()) && false ?: '_'}, $a);
146140

147-
$b->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && false ?: '_'};
141+
$a->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && false ?: '_'};
148142

149143
return $instance;
150144
}
@@ -156,21 +150,15 @@ protected function getConnectionService()
156150
*/
157151
protected function getConnection2Service()
158152
{
159-
$a = ${($_ = isset($this->services['dispatcher2']) ? $this->services['dispatcher2'] : $this->getDispatcher2Service()) && false ?: '_'};
160-
161-
if (isset($this->services['connection2'])) {
162-
return $this->services['connection2'];
163-
}
164-
165-
$b = new \stdClass();
153+
$a = new \stdClass();
166154

167-
$this->services['connection2'] = $instance = new \stdClass($a, $b);
155+
$this->services['connection2'] = $instance = new \stdClass(${($_ = isset($this->services['dispatcher2']) ? $this->services['dispatcher2'] : $this->getDispatcher2Service()) && false ?: '_'}, $a);
168156

169-
$c = new \stdClass($instance);
157+
$b = new \stdClass($instance);
170158

171-
$c->handler2 = new \stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'});
159+
$b->handler2 = new \stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'});
172160

173-
$b->logger2 = $c;
161+
$a->logger2 = $b;
174162

175163
return $instance;
176164
}
@@ -380,12 +368,6 @@ protected function getManager2Service()
380368
*/
381369
protected function getSubscriberService()
382370
{
383-
$a = ${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'};
384-
385-
if (isset($this->services['subscriber'])) {
386-
return $this->services['subscriber'];
387-
}
388-
389-
return $this->services['subscriber'] = new \stdClass($a);
371+
return $this->services['subscriber'] = new \stdClass(${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'});
390372
}
391373
}

0 commit comments

Comments
 (0)
0