[DI] Force root-namespace for function calls in the dumper container
This commit is contained in:
parent
d57303faa6
commit
f87380c22a
@ -695,7 +695,7 @@ EOTXT;
|
|||||||
return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName);
|
return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf(" call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName);
|
return sprintf(" \\call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf(" %s(\$%s);\n", $callable, $variableName);
|
return sprintf(" %s(\$%s);\n", $callable, $variableName);
|
||||||
@ -895,7 +895,7 @@ EOF;
|
|||||||
return $return.sprintf("(%s)->%s(%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? implode(', ', $arguments) : '');
|
return $return.sprintf("(%s)->%s(%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? implode(', ', $arguments) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return.sprintf("call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? ', '.implode(', ', $arguments) : '');
|
return $return.sprintf("\\call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? ', '.implode(', ', $arguments) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return.sprintf("%s(%s);\n", $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? implode(', ', $arguments) : '');
|
return $return.sprintf("%s(%s);\n", $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? implode(', ', $arguments) : '');
|
||||||
@ -948,11 +948,11 @@ class $class extends $baseClass
|
|||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
if (null !== $this->targetDirRegex) {
|
if (null !== $this->targetDirRegex) {
|
||||||
$dir = $this->asFiles ? '$this->targetDirs[0] = dirname(__DIR__)' : '__DIR__';
|
$dir = $this->asFiles ? '$this->targetDirs[0] = \\dirname(__DIR__)' : '__DIR__';
|
||||||
$code .= <<<EOF
|
$code .= <<<EOF
|
||||||
\$dir = {$dir};
|
\$dir = {$dir};
|
||||||
for (\$i = 1; \$i <= {$this->targetDirMaxMatches}; ++\$i) {
|
for (\$i = 1; \$i <= {$this->targetDirMaxMatches}; ++\$i) {
|
||||||
\$this->targetDirs[\$i] = \$dir = dirname(\$dir);
|
\$this->targetDirs[\$i] = \$dir = \\dirname(\$dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
@ -1722,7 +1722,7 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($factory[0] instanceof Definition) {
|
if ($factory[0] instanceof Definition) {
|
||||||
return sprintf("call_user_func(array(%s, '%s')%s)", $this->dumpValue($factory[0]), $factory[1], count($arguments) > 0 ? ', '.implode(', ', $arguments) : '');
|
return sprintf("\\call_user_func(array(%s, '%s')%s)", $this->dumpValue($factory[0]), $factory[1], count($arguments) > 0 ? ', '.implode(', ', $arguments) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($factory[0] instanceof Reference) {
|
if ($factory[0] instanceof Reference) {
|
||||||
|
@ -23,7 +23,7 @@ class ProjectServiceContainer extends Container
|
|||||||
{
|
{
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
for ($i = 1; $i <= 5; ++$i) {
|
for ($i = 1; $i <= 5; ++$i) {
|
||||||
$this->targetDirs[$i] = $dir = dirname($dir);
|
$this->targetDirs[$i] = $dir = \dirname($dir);
|
||||||
}
|
}
|
||||||
$this->parameters = $this->getDefaultParameters();
|
$this->parameters = $this->getDefaultParameters();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class Symfony_DI_PhpDumper_Test_EnvParameters extends Container
|
|||||||
{
|
{
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
for ($i = 1; $i <= 5; ++$i) {
|
for ($i = 1; $i <= 5; ++$i) {
|
||||||
$this->targetDirs[$i] = $dir = dirname($dir);
|
$this->targetDirs[$i] = $dir = \dirname($dir);
|
||||||
}
|
}
|
||||||
$this->parameters = $this->getDefaultParameters();
|
$this->parameters = $this->getDefaultParameters();
|
||||||
|
|
||||||
|
@ -223,9 +223,9 @@ class ProjectServiceContainer extends Container
|
|||||||
*/
|
*/
|
||||||
protected function getFoo_BazService()
|
protected function getFoo_BazService()
|
||||||
{
|
{
|
||||||
$this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance'));
|
$this->services['foo.baz'] = $instance = \call_user_func(array($this->getParameter('baz_class'), 'getInstance'));
|
||||||
|
|
||||||
call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance);
|
\call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance);
|
||||||
|
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
@ -281,9 +281,9 @@ class ProjectServiceContainer extends Container
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$dir = $this->targetDirs[0] = dirname(__DIR__);
|
$dir = $this->targetDirs[0] = \dirname(__DIR__);
|
||||||
for ($i = 1; $i <= 5; ++$i) {
|
for ($i = 1; $i <= 5; ++$i) {
|
||||||
$this->targetDirs[$i] = $dir = dirname($dir);
|
$this->targetDirs[$i] = $dir = \dirname($dir);
|
||||||
}
|
}
|
||||||
$this->parameters = $this->getDefaultParameters();
|
$this->parameters = $this->getDefaultParameters();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class ProjectServiceContainer extends Container
|
|||||||
{
|
{
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
for ($i = 1; $i <= 5; ++$i) {
|
for ($i = 1; $i <= 5; ++$i) {
|
||||||
$this->targetDirs[$i] = $dir = dirname($dir);
|
$this->targetDirs[$i] = $dir = \dirname($dir);
|
||||||
}
|
}
|
||||||
$this->parameters = $this->getDefaultParameters();
|
$this->parameters = $this->getDefaultParameters();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class ProjectServiceContainer extends Container
|
|||||||
{
|
{
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
for ($i = 1; $i <= 5; ++$i) {
|
for ($i = 1; $i <= 5; ++$i) {
|
||||||
$this->targetDirs[$i] = $dir = dirname($dir);
|
$this->targetDirs[$i] = $dir = \dirname($dir);
|
||||||
}
|
}
|
||||||
$this->parameters = $this->getDefaultParameters();
|
$this->parameters = $this->getDefaultParameters();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class Symfony_DI_PhpDumper_Test_Legacy_Privates extends Container
|
|||||||
{
|
{
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
for ($i = 1; $i <= 5; ++$i) {
|
for ($i = 1; $i <= 5; ++$i) {
|
||||||
$this->targetDirs[$i] = $dir = dirname($dir);
|
$this->targetDirs[$i] = $dir = \dirname($dir);
|
||||||
}
|
}
|
||||||
$this->services = array();
|
$this->services = array();
|
||||||
$this->methodMap = array(
|
$this->methodMap = array(
|
||||||
|
Reference in New Issue
Block a user