Merge branch '3.4' into 4.1

* 3.4:
  [DI] fix dumping lazy services
This commit is contained in:
Nicolas Grekas 2018-09-19 10:47:33 +02:00
commit da1175ca44
2 changed files with 10 additions and 28 deletions

View File

@ -155,7 +155,7 @@ class PhpDumper extends Dumper
} }
} }
(new AnalyzeServiceReferencesPass(false, !$this->getProxyDumper() instanceof NullDumper))->process($this->container); (new AnalyzeServiceReferencesPass(false))->process($this->container);
$this->circularReferences = array(); $this->circularReferences = array();
$checkedNodes = array(); $checkedNodes = array();
foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) { foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) {

View File

@ -138,17 +138,11 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container
*/ */
protected function getConnectionService() protected function getConnectionService()
{ {
$a = ($this->services['dispatcher'] ?? $this->getDispatcherService()); $a = new \stdClass();
if (isset($this->services['connection'])) { $this->services['connection'] = $instance = new \stdClass(($this->services['dispatcher'] ?? $this->getDispatcherService()), $a);
return $this->services['connection'];
}
$b = new \stdClass(); $a->logger = ($this->services['logger'] ?? $this->getLoggerService());
$this->services['connection'] = $instance = new \stdClass($a, $b);
$b->logger = ($this->services['logger'] ?? $this->getLoggerService());
return $instance; return $instance;
} }
@ -160,21 +154,15 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container
*/ */
protected function getConnection2Service() protected function getConnection2Service()
{ {
$a = ($this->services['dispatcher2'] ?? $this->getDispatcher2Service()); $a = new \stdClass();
if (isset($this->services['connection2'])) { $this->services['connection2'] = $instance = new \stdClass(($this->services['dispatcher2'] ?? $this->getDispatcher2Service()), $a);
return $this->services['connection2'];
}
$b = new \stdClass(); $b = new \stdClass($instance);
$this->services['connection2'] = $instance = new \stdClass($a, $b); $b->handler2 = new \stdClass(($this->services['manager2'] ?? $this->getManager2Service()));
$c = new \stdClass($instance); $a->logger2 = $b;
$c->handler2 = new \stdClass(($this->services['manager2'] ?? $this->getManager2Service()));
$b->logger2 = $c;
return $instance; return $instance;
} }
@ -384,12 +372,6 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container
*/ */
protected function getSubscriberService() protected function getSubscriberService()
{ {
$a = ($this->services['manager'] ?? $this->getManagerService()); return $this->services['subscriber'] = new \stdClass(($this->services['manager'] ?? $this->getManagerService()));
if (isset($this->services['subscriber'])) {
return $this->services['subscriber'];
}
return $this->services['subscriber'] = new \stdClass($a);
} }
} }