8000 [DependencyInjection] fix a regression introduced in #9807 · symfony/symfony@0d78776 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d78776

Browse files
committed
[DependencyInjection] fix a regression introduced in #9807
Always dump the fully qualified class name, to support dumping containers in a namespace.
1 parent 11434de commit 0d78776

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ private function addServiceConfigurator($id, $definition, $variableName = 'insta
490490
$class = $this->dumpValue($callable[0]);
491491
// If the class is a string we can optimize call_user_func away
492492
if (strpos($class, "'") === 0) {
493-
return sprintf(" %s::%s(\$%s);\n", substr($class, 1, -1), $callable[1], $variableName);
493+
return sprintf(" \%s::%s(\$%s);\n", substr($class, 1, -1), $callable[1], $variableName);
494494
}
495495

496496
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
701701

702702
// If the class is a string we can optimize call_user_func away
703703
if (strpos($class, "'") === 0) {
704-
return sprintf(" $return{$instantiation}%s::%s(%s);\n", substr($class, 1, -1), $definition->getFactoryMethod(), $arguments ? implode(', ', $arguments) : '');
704+
return sprintf(" $return{$instantiation}\%s::%s(%s);\n", substr($class, 1, -1), $definition->getFactoryMethod(), $argume 8000 nts ? implode(', ', $arguments) : '');
705705
}
706706

707707
return sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($definition->getFactoryClass()), $definition->getFactoryMethod(), $arguments ? ', '.implode(', ', $arguments) : '');

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected function getFooService()
138138
{
139139
$a = $this->get('foo.baz');
140140

141-
$this->services['foo'] = $instance = FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this);
141+
$this->services['foo'] = $instance = \FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this);
142142

143143
$instance->setBar($this->get('bar'));
144144
$instance->initialize();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected function getFooService()
148148
{
149149
$a = $this->get('foo.baz');
150150

151-
$this->services['foo'] = $instance = FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
151+
$this->services['foo'] = $instance = \FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
152152

153153
$instance->setBar($this->get('bar'));
154154
$instance->initialize();
@@ -169,9 +169,9 @@ protected function getFooService()
169169
*/
170170
protected function getFoo_BazService()
171171
{
172-
$this->services['foo.baz'] = $instance = BazClass::getInstance();
172+
$this->services['foo.baz'] = $instance = \BazClass::getInstance();
173173

174-
BazClass::configureStatic1($instance);
174+
\BazClass::configureStatic1($instance);
175175

176176
return $instance;
177177
}

0 commit comments

Comments
 (0)
0