Parcourir la source

Fixed PhpDumper isSimpleService and changed test fixtures

Jan Prieser il y a 14 ans
Parent
commit
67aaf5ce91

+ 5 - 0
src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

@@ -375,6 +375,11 @@ EOF;
      */
     private function isSimpleInstance($id, $definition)
     {
+
+        if (!$this->container->isFrozen() && count($this->container->getInterfaceInjectors()) > 0) {
+         	return false;
+        }
+
         foreach (array_merge(array($definition), $this->getInlinedDefinitions($definition)) as $sDefinition) {
             if ($definition !== $sDefinition && !$this->hasReference($id, $sDefinition->getMethodCalls())) {
                 continue;

+ 4 - 1
tests/Symfony/Tests/Component/DependencyInjection/Fixtures/php/services_interfaces-1.php

@@ -34,9 +34,12 @@ class ProjectServiceContainer extends Container
     protected function getFooService()
     {
         $class = $this->getParameter('cla').'o'.$this->getParameter('ss');
-        return $this->services['foo'] = new $class();
+        $this->services['foo'] = $instance = new $class();
+
 
         $this->applyInterfaceInjectors($instance);
+
+        return $instance;
     }
 
     /**

+ 8 - 2
tests/Symfony/Tests/Component/DependencyInjection/Fixtures/php/services_interfaces-2.php

@@ -33,9 +33,12 @@ class ProjectServiceContainer extends Container
      */
     protected function getBarService()
     {
-        return $this->services['bar'] = $this->get('barFactory')->createBarClass();
+        $this->services['bar'] = $instance = $this->get('barFactory')->createBarClass();
+
 
         $this->applyInterfaceInjectors($instance);
+
+        return $instance;
     }
 
     /**
@@ -48,9 +51,12 @@ class ProjectServiceContainer extends Container
      */
     protected function getBarfactoryService()
     {
-        return $this->services['barfactory'] = new \BarClassFactory();
+        $this->services['barfactory'] = $instance = new \BarClassFactory();
+
 
         $this->applyInterfaceInjectors($instance);
+
+        return $instance;
     }
 
     /**