Skip to content

Commit 8b08888

Browse files
committed
bug #9812 [DependencyInjection] fix a regression introduced in #9807 (realityking)
This PR was merged into the 2.5-dev branch. Discussion ---------- [DependencyInjection] fix a regression introduced in #9807 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - As @stof pointed out in #9807 we always need to dump the fully qualified class name, to support dumping containers in a namespace. Commits ------- 0d78776 [DependencyInjection] fix a regression introduced in #9807
2 parents 11434de + 0d78776 commit 8b08888

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(), $arguments ? 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy