diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index ac66be896a0c7..558fbd942f092 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -490,7 +490,7 @@ private function addServiceConfigurator($id, $definition, $variableName = 'insta $class = $this->dumpValue($callable[0]); // If the class is a string we can optimize call_user_func away if (strpos($class, "'") === 0) { - return sprintf(" %s::%s(\$%s);\n", substr($class, 1, -1), $callable[1], $variableName); + return sprintf(" \%s::%s(\$%s);\n", substr($class, 1, -1), $callable[1], $variableName); } return sprintf(" call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); @@ -701,7 +701,7 @@ private function addNewInstance($id, Definition $definition, $return, $instantia // If the class is a string we can optimize call_user_func away if (strpos($class, "'") === 0) { - return sprintf(" $return{$instantiation}%s::%s(%s);\n", substr($class, 1, -1), $definition->getFactoryMethod(), $arguments ? implode(', ', $arguments) : ''); + return sprintf(" $return{$instantiation}\%s::%s(%s);\n", substr($class, 1, -1), $definition->getFactoryMethod(), $arguments ? implode(', ', $arguments) : ''); } return sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($definition->getFactoryClass()), $definition->getFactoryMethod(), $arguments ? ', '.implode(', ', $arguments) : ''); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index 4be046ad7ea46..c6b8db298a61e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -138,7 +138,7 @@ protected function getFooService() { $a = $this->get('foo.baz'); - $this->services['foo'] = $instance = FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this); + $this->services['foo'] = $instance = \FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this); $instance->setBar($this->get('bar')); $instance->initialize(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 1d8a5569d8138..24b11f0bc6e11 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -148,7 +148,7 @@ protected function getFooService() { $a = $this->get('foo.baz'); - $this->services['foo'] = $instance = FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this); + $this->services['foo'] = $instance = \FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this); $instance->setBar($this->get('bar')); $instance->initialize(); @@ -169,9 +169,9 @@ protected function getFooService() */ protected function getFoo_BazService() { - $this->services['foo.baz'] = $instance = BazClass::getInstance(); + $this->services['foo.baz'] = $instance = \BazClass::getInstance(); - BazClass::configureStatic1($instance); + \BazClass::configureStatic1($instance); return $instance; }