[DI] dump factory files as classes

This commit is contained in:
Nicolas Grekas 2020-03-24 12:59:01 +01:00
parent 4dabd00ecd
commit cedb5cd429
49 changed files with 806 additions and 516 deletions

View File

@ -142,6 +142,10 @@ trait MicroKernelTrait
} }
$container->setAlias(static::class, 'kernel')->setPublic(true); $container->setAlias(static::class, 'kernel')->setPublic(true);
if (!$container->hasParameter('container.dumper.inline_factories')) {
$container->setParameter('container.dumper.inline_factories', false);
}
}); });
} }

View File

@ -68,7 +68,7 @@ class PhpDumper extends Dumper
private $variableCount; private $variableCount;
private $inlinedDefinitions; private $inlinedDefinitions;
private $serviceCalls; private $serviceCalls;
private $reservedVariables = ['instance', 'class', 'this']; private $reservedVariables = ['instance', 'class', 'this', 'container'];
private $expressionLanguage; private $expressionLanguage;
private $targetDirRegex; private $targetDirRegex;
private $targetDirMaxMatches; private $targetDirMaxMatches;
@ -246,20 +246,24 @@ class PhpDumper extends Dumper
if ($this->addGetService) { if ($this->addGetService) {
$code = preg_replace( $code = preg_replace(
"/(\r?\n\r?\n public function __construct.+?\\{\r?\n)/s", "/(\r?\n\r?\n public function __construct.+?\\{\r?\n)/s",
"\n private \$getService;$1 \$this->getService = \\Closure::fromCallable([\$this, 'getService']);\n", "\n protected \$getService;$1 \$this->getService = \\Closure::fromCallable([\$this, 'getService']);\n",
$code, $code,
1 1
); );
} }
if ($this->asFiles) { if ($this->asFiles) {
$fileStart = <<<EOF $fileTemplate = <<<EOF
<?php <?php
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /*{$this->docStar}
* @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class %s extends {$options['class']}
{%s}
EOF; EOF;
$files = []; $files = [];
@ -281,7 +285,7 @@ EOF;
if (!$this->inlineFactories) { if (!$this->inlineFactories) {
foreach ($this->generateServiceFiles($services) as $file => $c) { foreach ($this->generateServiceFiles($services) as $file => $c) {
$files[$file] = $fileStart.$c; $files[$file] = sprintf($fileTemplate, substr($file, 0, -4), $c);
} }
foreach ($proxyClasses as $file => $c) { foreach ($proxyClasses as $file => $c) {
$files[$file] = "<?php\n".$c; $files[$file] = "<?php\n".$c;
@ -301,10 +305,8 @@ EOF;
$code = []; $code = [];
foreach ($files as $file => $c) { foreach ($files as $file => $c) {
$code["Container{$hash}/{$file}"] = $c; $code["Container{$hash}/{$file}"] = substr_replace($c, "<?php\n\nnamespace Container{$hash};\n", 0, 6);
} }
array_pop($code);
$code["Container{$hash}/{$options['class']}.php"] = substr_replace($files[$options['class'].'.php'], "<?php\n\nnamespace Container{$hash};\n", 0, 6);
$namespaceLine = $this->namespace ? "\nnamespace {$this->namespace};\n" : ''; $namespaceLine = $this->namespace ? "\nnamespace {$this->namespace};\n" : '';
$time = $options['build_time']; $time = $options['build_time'];
$id = hash('crc32', $hash.$time); $id = hash('crc32', $hash.$time);
@ -313,6 +315,9 @@ EOF;
if ($this->preload && null !== $autoloadFile = $this->getAutoloadFile()) { if ($this->preload && null !== $autoloadFile = $this->getAutoloadFile()) {
$autoloadFile = substr($this->export($autoloadFile), 2, -1); $autoloadFile = substr($this->export($autoloadFile), 2, -1);
$factoryFiles = array_reverse(array_keys($code));
$factoryFiles = implode("';\nrequire __DIR__.'/", $factoryFiles);
$code[$options['class'].'.preload.php'] = <<<EOF $code[$options['class'].'.preload.php'] = <<<EOF
<?php <?php
@ -322,7 +327,7 @@ EOF;
use Symfony\Component\DependencyInjection\Dumper\Preloader; use Symfony\Component\DependencyInjection\Dumper\Preloader;
require $autoloadFile; require $autoloadFile;
require __DIR__.'/Container{$hash}/{$options['class']}.php'; require __DIR__.'/$factoryFiles';
\$classes = []; \$classes = [];
@ -546,7 +551,13 @@ EOF;
$proxyCode = substr(Kernel::stripComments($proxyCode), 5); $proxyCode = substr(Kernel::stripComments($proxyCode), 5);
} }
$proxyClasses[sprintf('%s.php', explode(' ', $this->inlineRequires ? substr($proxyCode, \strlen($code)) : $proxyCode, 3)[1])] = $proxyCode; $proxyClass = explode(' ', $this->inlineRequires ? substr($proxyCode, \strlen($code)) : $proxyCode, 3)[1];
if ($this->asFiles || $this->namespace) {
$proxyCode .= "\n\\class_alias(__NAMESPACE__.'\\\\$proxyClass', '$proxyClass', false);\n";
}
$proxyClasses[$proxyClass.'.php'] = $proxyCode;
} }
return $proxyClasses; return $proxyClasses;
@ -784,34 +795,35 @@ EOF;
$shared = $definition->isShared() ? ' shared' : ''; $shared = $definition->isShared() ? ' shared' : '';
$public = $definition->isPublic() ? 'public' : 'private'; $public = $definition->isPublic() ? 'public' : 'private';
$autowired = $definition->isAutowired() ? ' autowired' : ''; $autowired = $definition->isAutowired() ? ' autowired' : '';
$asFile = $this->asFiles && !$this->inlineFactories && !$this->isHotPath($definition);
$methodName = $this->generateMethodName($id);
if ($definition->isLazy()) { if ($asFile || $definition->isLazy()) {
$lazyInitialization = '$lazyLoad = true'; $lazyInitialization = '$lazyLoad = true';
} else { } else {
$lazyInitialization = ''; $lazyInitialization = '';
} }
$asFile = $this->asFiles && !$this->inlineFactories && !$this->isHotPath($definition); $code = <<<EOF
$methodName = $this->generateMethodName($id);
if ($asFile) {
$file = $methodName.'.php';
$code = " // Returns the $public '$id'$shared$autowired service.\n\n";
} else {
$file = null;
$code = <<<EOF
/*{$this->docStar} /*{$this->docStar}
* Gets the $public '$id'$shared$autowired service. * Gets the $public '$id'$shared$autowired service.
* *
* $return * $return
EOF; EOF;
$code = str_replace('*/', ' ', $code).<<<EOF $code = str_replace('*/', ' ', $code).<<<EOF
*/ */
protected function {$methodName}($lazyInitialization) protected function {$methodName}($lazyInitialization)
{ {
EOF; EOF;
if ($asFile) {
$file = $methodName.'.php';
$code = str_replace("protected function {$methodName}(", 'public static function do($container, ', $code);
} else {
$file = null;
} }
if ($definition->hasErrors() && $e = $definition->getErrors()) { if ($definition->hasErrors() && $e = $definition->getErrors()) {
@ -833,8 +845,8 @@ EOF;
} }
if ($this->getProxyDumper()->isProxyCandidate($definition)) { if ($this->getProxyDumper()->isProxyCandidate($definition)) {
$factoryCode = $asFile ? ($definition->isShared() ? "\$this->load('%s.php', false)" : '$this->factories[%2$s](false)') : '$this->%s(false)'; $factoryCode = $asFile ? "\$this->load('%s', false)" : '$this->%s(false)';
$code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, sprintf($factoryCode, $methodName, $this->doExport($id))); $code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, sprintf($factoryCode, $methodName));
} }
$code .= $this->addServiceInclude($id, $definition); $code .= $this->addServiceInclude($id, $definition);
@ -842,11 +854,12 @@ EOF;
} }
if ($asFile) { if ($asFile) {
$code = implode("\n", array_map(function ($line) { return $line ? substr($line, 8) : $line; }, explode("\n", $code))); $code = str_replace('$this', '$container', $code);
} else { $code = str_replace('function () {', 'function () use ($container) {', $code);
$code .= " }\n";
} }
$code .= " }\n";
$this->definitionVariables = $this->inlinedDefinitions = null; $this->definitionVariables = $this->inlinedDefinitions = null;
$this->referenceVariables = $this->serviceCalls = null; $this->referenceVariables = $this->serviceCalls = null;
@ -1017,21 +1030,6 @@ EOTXT
ksort($definitions); ksort($definitions);
foreach ($definitions as $id => $definition) { foreach ($definitions as $id => $definition) {
if ((list($file, $code) = $services[$id]) && null !== $file && ($definition->isPublic() || !$this->isTrivialInstance($definition) || isset($this->locatedIds[$id]))) { if ((list($file, $code) = $services[$id]) && null !== $file && ($definition->isPublic() || !$this->isTrivialInstance($definition) || isset($this->locatedIds[$id]))) {
if (!$definition->isShared()) {
$i = strpos($code, "\n\ninclude_once ");
if (false !== $i && false !== $i = strpos($code, "\n\n", 2 + $i)) {
$code = [substr($code, 0, 2 + $i), substr($code, 2 + $i)];
} else {
$code = ["\n", $code];
}
$code[1] = implode("\n", array_map(function ($line) { return $line ? ' '.$line : $line; }, explode("\n", $code[1])));
$factory = sprintf('$this->factories%s[%s]', $definition->isPublic() ? '' : "['service_container']", $this->doExport($id));
$lazyloadInitialization = $definition->isLazy() ? '$lazyLoad = true' : '';
$code[1] = sprintf("%s = function (%s) {\n%s};\n\nreturn %1\$s();\n", $factory, $lazyloadInitialization, $code[1]);
$code = $code[0].$code[1];
}
yield $file => $code; yield $file => $code;
} }
} }
@ -1112,27 +1110,24 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/*{$this->docStar} /*{$this->docStar}
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class $class extends $baseClass class $class extends $baseClass
{ {
private \$parameters = []; protected \$parameters = [];
public function __construct() public function __construct()
{ {
EOF; EOF;
if ($this->asFiles) { if ($this->asFiles) {
$code = str_replace('$parameters', "\$buildParameters;\n private \$containerDir;\n private \$parameters", $code); $code = str_replace('$parameters = []', "\$containerDir;\n protected \$parameters = [];\n private \$buildParameters", $code);
$code = str_replace('__construct()', '__construct(array $buildParameters = [], $containerDir = __DIR__)', $code); $code = str_replace('__construct()', '__construct(array $buildParameters = [], $containerDir = __DIR__)', $code);
$code .= " \$this->buildParameters = \$buildParameters;\n"; $code .= " \$this->buildParameters = \$buildParameters;\n";
$code .= " \$this->containerDir = \$containerDir;\n"; $code .= " \$this->containerDir = \$containerDir;\n";
if (null !== $this->targetDirRegex) { if (null !== $this->targetDirRegex) {
$code = str_replace('$parameters', "\$targetDir;\n private \$parameters", $code); $code = str_replace('$parameters = []', "\$targetDir;\n protected \$parameters = []", $code);
$code .= ' $this->targetDir = \\dirname($containerDir);'."\n"; $code .= ' $this->targetDir = \\dirname($containerDir);'."\n";
} }
} }
@ -1176,11 +1171,23 @@ EOF;
$code .= $this->addRemovedIds(); $code .= $this->addRemovedIds();
if ($this->asFiles && !$this->inlineFactories) { if ($this->asFiles && !$this->inlineFactories) {
$code .= <<<EOF $code .= <<<'EOF'
protected function load(\$file, \$lazyLoad = true) protected function load($file, $lazyLoad = true)
{ {
return require \$this->containerDir.\\DIRECTORY_SEPARATOR.\$file; if (class_exists($class = __NAMESPACE__.'\\'.$file, false)) {
return $class::do($this, $lazyLoad);
}
if ('.' === $file[-4]) {
$class = substr($class, 0, -4);
} else {
$file .= '.php';
}
$service = require $this->containerDir.\DIRECTORY_SEPARATOR.$file;
return class_exists($class, false) ? $class::do($this, $lazyLoad) : $service;
} }
EOF; EOF;
@ -1191,16 +1198,13 @@ EOF;
if (!$proxyDumper->isProxyCandidate($definition)) { if (!$proxyDumper->isProxyCandidate($definition)) {
continue; continue;
} }
if ($this->asFiles && !$this->inlineFactories) { if ($this->asFiles && !$this->inlineFactories) {
$proxyLoader = '$this->load("{$class}.php")'; $proxyLoader = "class_exists(\$class, false) || require __DIR__.'/'.\$class.'.php';\n\n ";
} elseif ($this->namespace || $this->inlineFactories) {
$proxyLoader = 'class_alias(__NAMESPACE__."\\\\$class", $class, false)';
} else { } else {
$proxyLoader = ''; $proxyLoader = '';
} }
if ($proxyLoader) {
$proxyLoader = "class_exists(\$class, false) || {$proxyLoader};\n\n ";
}
$code .= <<<EOF $code .= <<<EOF
protected function createProxy(\$class, \Closure \$factory) protected function createProxy(\$class, \Closure \$factory)
@ -1295,7 +1299,7 @@ EOF;
ksort($definitions); ksort($definitions);
foreach ($definitions as $id => $definition) { foreach ($definitions as $id => $definition) {
if (!$definition->isSynthetic() && $definition->isPublic() && !$this->isHotPath($definition)) { if (!$definition->isSynthetic() && $definition->isPublic() && !$this->isHotPath($definition)) {
$code .= sprintf(" %s => '%s.php',\n", $this->doExport($id), $this->generateMethodName($id)); $code .= sprintf(" %s => '%s',\n", $this->doExport($id), $this->generateMethodName($id));
} }
} }
@ -1709,7 +1713,7 @@ EOF;
$this->export($k), $this->export($k),
$this->export($definition->isShared() ? ($definition->isPublic() ? 'services' : 'privates') : false), $this->export($definition->isShared() ? ($definition->isPublic() ? 'services' : 'privates') : false),
$this->doExport($id), $this->doExport($id),
$this->export(ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $v->getInvalidBehavior() && !\is_string($load) ? $this->generateMethodName($id).($load ? '.php' : '') : null), $this->export(ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $v->getInvalidBehavior() && !\is_string($load) ? $this->generateMethodName($id) : null),
$this->export($load) $this->export($load)
); );
$serviceTypes .= sprintf("\n %s => %s,", $this->export($k), $this->export($v instanceof TypedReference ? $v->getType() : '?')); $serviceTypes .= sprintf("\n %s => %s,", $this->export($k), $this->export($v instanceof TypedReference ? $v->getType() : '?'));
@ -1850,11 +1854,7 @@ EOF;
} }
$code = "($code)"; $code = "($code)";
} elseif ($this->asFiles && !$this->inlineFactories && !$this->isHotPath($definition)) { } elseif ($this->asFiles && !$this->inlineFactories && !$this->isHotPath($definition)) {
$code = sprintf("\$this->load('%s.php')", $this->generateMethodName($id)); $code = sprintf("\$this->load('%s')", $this->generateMethodName($id));
if (!$definition->isShared()) {
$factory = sprintf('$this->factories%s[%s]', $definition->isPublic() ? '' : "['service_container']", $this->doExport($id));
$code = sprintf('(isset(%s) ? %1$s() : %s)', $factory, $code);
}
} else { } else {
$code = sprintf('$this->%s()', $this->generateMethodName($id)); $code = sprintf('$this->%s()', $this->generateMethodName($id));
} }
@ -2045,6 +2045,14 @@ EOF;
} else { } else {
$export = var_export($value, true); $export = var_export($value, true);
} }
if ($this->asFiles) {
if (false !== strpos($export, '$this')) {
$export = str_replace('$this', "$'.'this", $export);
}
if (false !== strpos($export, 'function () {')) {
$export = str_replace('function () {', "function ('.') {", $export);
}
}
if ($resolveEnv && "'" === $export[0] && $export !== $resolvedExport = $this->container->resolveEnvPlaceholders($export, "'.\$this->getEnv('string:%s').'")) { if ($resolveEnv && "'" === $export[0] && $export !== $resolvedExport = $this->container->resolveEnvPlaceholders($export, "'.\$this->getEnv('string:%s').'")) {
$export = $resolvedExport; $export = $resolvedExport;

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_Aliases_Deprecation extends Container class Symfony_DI_PhpDumper_Test_Aliases_Deprecation extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -12,14 +12,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithoutArgumentsContainer class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithoutArgumentsContainer
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -12,14 +12,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithMandatoryArgumentsContainer class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithMandatoryArgumentsContainer
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -12,14 +12,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithOptionalArgumentsContainer class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithOptionalArgumentsContainer
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -12,14 +12,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\NoConstructorContainer class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\NoConstructorContainer
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -12,14 +12,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Container extends \Symfony\Component\DependencyInjection\Dump\AbstractContainer class Container extends \Symfony\Component\DependencyInjection\Dump\AbstractContainer
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_EnvParameters extends Container class Symfony_DI_PhpDumper_Test_EnvParameters extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -2,6 +2,8 @@ Array
( (
[Container%s/removed-ids.php] => <?php [Container%s/removed-ids.php] => <?php
namespace Container%s;
return [ return [
'Psr\\Container\\ContainerInterface' => true, 'Psr\\Container\\ContainerInterface' => true,
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
@ -19,337 +21,657 @@ return [
[Container%s/getBAR2Service.php] => <?php [Container%s/getBAR2Service.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'BAR' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getBAR2Service extends ProjectServiceContainer
{
/**
* Gets the public 'BAR' shared service.
*
* @return \stdClass
*/
public static function do($container, $lazyLoad = true)
{
$container->services['BAR'] = $instance = new \stdClass();
$this->services['BAR'] = $instance = new \stdClass(); $instance->bar = ($container->services['bar'] ?? $container->getBarService());
$instance->bar = ($this->services['bar'] ?? $this->getBarService()); return $instance;
}
return $instance; }
[Container%s/getBAR22Service.php] => <?php [Container%s/getBAR22Service.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'BAR2' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['BAR2'] = new \stdClass(); class getBAR22Service extends ProjectServiceContainer
{
/**
* Gets the public 'BAR2' shared service.
*
* @return \stdClass
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['BAR2'] = new \stdClass();
}
}
[Container%s/getBar23Service.php] => <?php [Container%s/getBar23Service.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'bar2' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['bar2'] = new \stdClass(); class getBar23Service extends ProjectServiceContainer
{
/**
* Gets the public 'bar2' shared service.
*
* @return \stdClass
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['bar2'] = new \stdClass();
}
}
[Container%s/getBazService.php] => <?php [Container%s/getBazService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'baz' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getBazService extends ProjectServiceContainer
{
/**
* Gets the public 'baz' shared service.
*
* @return \Baz
*/
public static function do($container, $lazyLoad = true)
{
$container->services['baz'] = $instance = new \Baz();
$this->services['baz'] = $instance = new \Baz(); $instance->setFoo(($container->services['foo_with_inline'] ?? $container->load('getFooWithInlineService')));
$instance->setFoo(($this->services['foo_with_inline'] ?? $this->load('getFooWithInlineService.php'))); return $instance;
}
return $instance; }
[Container%s/getConfiguredServiceService.php] => <?php [Container%s/getConfiguredServiceService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'configured_service' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getConfiguredServiceService extends ProjectServiceContainer
{
/**
* Gets the public 'configured_service' shared service.
*
* @return \stdClass
*/
public static function do($container, $lazyLoad = true)
{
$container->services['configured_service'] = $instance = new \stdClass();
$this->services['configured_service'] = $instance = new \stdClass(); $a = new \ConfClass();
$a->setFoo(($container->services['baz'] ?? $container->load('getBazService')));
$a = new \ConfClass(); $a->configureStdClass($instance);
$a->setFoo(($this->services['baz'] ?? $this->load('getBazService.php')));
$a->configureStdClass($instance); return $instance;
}
return $instance; }
[Container%s/getConfiguredServiceSimpleService.php] => <?php [Container%s/getConfiguredServiceSimpleService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'configured_service_simple' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getConfiguredServiceSimpleService extends ProjectServiceContainer
{
/**
* Gets the public 'configured_service_simple' shared service.
*
* @return \stdClass
*/
public static function do($container, $lazyLoad = true)
{
$container->services['configured_service_simple'] = $instance = new \stdClass();
$this->services['configured_service_simple'] = $instance = new \stdClass(); (new \ConfClass('bar'))->configureStdClass($instance);
(new \ConfClass('bar'))->configureStdClass($instance); return $instance;
}
return $instance; }
[Container%s/getDecoratorServiceService.php] => <?php [Container%s/getDecoratorServiceService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'decorator_service' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['decorator_service'] = new \stdClass(); class getDecoratorServiceService extends ProjectServiceContainer
{
/**
* Gets the public 'decorator_service' shared service.
*
* @return \stdClass
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['decorator_service'] = new \stdClass();
}
}
[Container%s/getDecoratorServiceWithNameService.php] => <?php [Container%s/getDecoratorServiceWithNameService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'decorator_service_with_name' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['decorator_service_with_name'] = new \stdClass(); class getDecoratorServiceWithNameService extends ProjectServiceContainer
{
/**
* Gets the public 'decorator_service_with_name' shared service.
*
* @return \stdClass
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['decorator_service_with_name'] = new \stdClass();
}
}
[Container%s/getDeprecatedServiceService.php] => <?php [Container%s/getDeprecatedServiceService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'deprecated_service' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getDeprecatedServiceService extends ProjectServiceContainer
{
/**
* Gets the public 'deprecated_service' shared service.
*
* @return \stdClass
*
* @deprecated The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.
*/
public static function do($container, $lazyLoad = true)
{
trigger_deprecation('', '', 'The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.');
trigger_deprecation('', '', 'The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.'); return $container->services['deprecated_service'] = new \stdClass();
}
return $this->services['deprecated_service'] = new \stdClass(); }
[Container%s/getFactoryServiceService.php] => <?php [Container%s/getFactoryServiceService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'factory_service' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['factory_service'] = ($this->services['foo.baz'] ?? $this->load('getFoo_BazService.php'))->getInstance(); class getFactoryServiceService extends ProjectServiceContainer
{
/**
* Gets the public 'factory_service' shared service.
*
* @return \Bar
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['factory_service'] = ($container->services['foo.baz'] ?? $container->load('getFoo_BazService'))->getInstance();
}
}
[Container%s/getFactoryServiceSimpleService.php] => <?php [Container%s/getFactoryServiceSimpleService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'factory_service_simple' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['factory_service_simple'] = $this->load('getFactorySimpleService.php')->getInstance(); class getFactoryServiceSimpleService extends ProjectServiceContainer
{
/**
* Gets the public 'factory_service_simple' shared service.
*
* @return \Bar
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['factory_service_simple'] = $container->load('getFactorySimpleService')->getInstance();
}
}
[Container%s/getFactorySimpleService.php] => <?php [Container%s/getFactorySimpleService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the private 'factory_simple' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getFactorySimpleService extends ProjectServiceContainer
{
/**
* Gets the private 'factory_simple' shared service.
*
* @return \SimpleFactoryClass
*
* @deprecated The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.
*/
public static function do($container, $lazyLoad = true)
{
trigger_deprecation('', '', 'The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.');
trigger_deprecation('', '', 'The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.'); return new \SimpleFactoryClass('foo');
}
return new \SimpleFactoryClass('foo'); }
[Container%s/getFooService.php] => <?php [Container%s/getFooService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'foo' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getFooService extends ProjectServiceContainer
{
/**
* Gets the public 'foo' shared service.
*
* @return \Bar\FooClass
*/
public static function do($container, $lazyLoad = true)
{
$a = ($container->services['foo.baz'] ?? $container->load('getFoo_BazService'));
$a = ($this->services['foo.baz'] ?? $this->load('getFoo_BazService.php')); $container->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, ['bar' => 'foo is bar', 'foobar' => 'bar'], true, $container);
$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, ['bar' => 'foo is bar', 'foobar' => 'bar'], true, $this); $instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = ['bar' => 'foo is bar', 'foobar' => 'bar'];
$instance->setBar(($container->services['bar'] ?? $container->getBarService()));
$instance->initialize();
sc_configure($instance);
$instance->foo = 'bar'; return $instance;
$instance->moo = $a; }
$instance->qux = ['bar' => 'foo is bar', 'foobar' => 'bar']; }
$instance->setBar(($this->services['bar'] ?? $this->getBarService()));
$instance->initialize();
sc_configure($instance);
return $instance;
[Container%s/getFoo_BazService.php] => <?php [Container%s/getFoo_BazService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'foo.baz' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getFoo_BazService extends ProjectServiceContainer
{
/**
* Gets the public 'foo.baz' shared service.
*
* @return \BazClass
*/
public static function do($container, $lazyLoad = true)
{
$container->services['foo.baz'] = $instance = \BazClass::getInstance();
$this->services['foo.baz'] = $instance = \BazClass::getInstance(); \BazClass::configureStatic1($instance);
\BazClass::configureStatic1($instance); return $instance;
}
return $instance; }
[Container%s/getFooBarService.php] => <?php [Container%s/getFooBarService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
* @internal This class has been auto-generated by the Symfony Dependency Injection Component.
$this->factories['foo_bar'] = function () { */
// Returns the public 'foo_bar' service. class getFooBarService extends ProjectServiceContainer
{
return new \Bar\FooClass(($this->services['deprecated_service'] ?? $this->load('getDeprecatedServiceService.php'))); /**
}; * Gets the public 'foo_bar' service.
*
return $this->factories['foo_bar'](); * @return \Bar\FooClass
*/
public static function do($container, $lazyLoad = true)
{
return new \Bar\FooClass(($container->services['deprecated_service'] ?? $container->load('getDeprecatedServiceService')));
}
}
[Container%s/getFooWithInlineService.php] => <?php [Container%s/getFooWithInlineService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'foo_with_inline' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getFooWithInlineService extends ProjectServiceContainer
{
/**
* Gets the public 'foo_with_inline' shared service.
*
* @return \Foo
*/
public static function do($container, $lazyLoad = true)
{
$container->services['foo_with_inline'] = $instance = new \Foo();
$this->services['foo_with_inline'] = $instance = new \Foo(); $a = new \Bar();
$a->pub = 'pub';
$a->setBaz(($container->services['baz'] ?? $container->load('getBazService')));
$a = new \Bar(); $instance->setBar($a);
$a->pub = 'pub';
$a->setBaz(($this->services['baz'] ?? $this->load('getBazService.php')));
$instance->setBar($a); return $instance;
}
return $instance; }
[Container%s/getLazyContextService.php] => <?php [Container%s/getLazyContextService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'lazy_context' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () { class getLazyContextService extends ProjectServiceContainer
yield 'k1' => ($this->services['foo.baz'] ?? $this->load('getFoo_BazService.php')); {
yield 'k2' => $this; /**
}, 2), new RewindableGenerator(function () { * Gets the public 'lazy_context' shared service.
return new \EmptyIterator(); *
}, 0)); * @return \LazyContext
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () use ($container) {
yield 'k1' => ($container->services['foo.baz'] ?? $container->load('getFoo_BazService'));
yield 'k2' => $container;
}, 2), new RewindableGenerator(function () use ($container) {
return new \EmptyIterator();
}, 0));
}
}
[Container%s/getLazyContextIgnoreInvalidRefService.php] => <?php [Container%s/getLazyContextIgnoreInvalidRefService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'lazy_context_ignore_invalid_ref' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () { class getLazyContextIgnoreInvalidRefService extends ProjectServiceContainer
yield 0 => ($this->services['foo.baz'] ?? $this->load('getFoo_BazService.php')); {
}, 1), new RewindableGenerator(function () { /**
return new \EmptyIterator(); * Gets the public 'lazy_context_ignore_invalid_ref' shared service.
}, 0)); *
* @return \LazyContext
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () use ($container) {
yield 0 => ($container->services['foo.baz'] ?? $container->load('getFoo_BazService'));
}, 1), new RewindableGenerator(function () use ($container) {
return new \EmptyIterator();
}, 0));
}
}
[Container%s/getMethodCall1Service.php] => <?php [Container%s/getMethodCall1Service.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'method_call1' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getMethodCall1Service extends ProjectServiceContainer
{
/**
* Gets the public 'method_call1' shared service.
*
* @return \Bar\FooClass
*/
public static function do($container, $lazyLoad = true)
{
include_once $container->targetDir.''.'/Fixtures/includes/foo.php';
include_once $this->targetDir.''.'/Fixtures/includes/foo.php'; $container->services['method_call1'] = $instance = new \Bar\FooClass();
$this->services['method_call1'] = $instance = new \Bar\FooClass(); $instance->setBar(($container->services['foo'] ?? $container->load('getFooService')));
$instance->setBar(NULL);
$instance->setBar((($container->services['foo'] ?? $container->load('getFooService'))->foo() . (($container->hasParameter("foo")) ? ($container->getParameter("foo")) : ("default"))));
$instance->setBar(($this->services['foo'] ?? $this->load('getFooService.php'))); return $instance;
$instance->setBar(NULL); }
$instance->setBar((($this->services['foo'] ?? $this->load('getFooService.php'))->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); }
return $instance;
[Container%s/getNewFactoryServiceService.php] => <?php [Container%s/getNewFactoryServiceService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'new_factory_service' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getNewFactoryServiceService extends ProjectServiceContainer
{
/**
* Gets the public 'new_factory_service' shared service.
*
* @return \FooBarBaz
*/
public static function do($container, $lazyLoad = true)
{
$a = new \FactoryClass();
$a->foo = 'bar';
$a = new \FactoryClass(); $container->services['new_factory_service'] = $instance = $a->getInstance();
$a->foo = 'bar';
$this->services['new_factory_service'] = $instance = $a->getInstance(); $instance->foo = 'bar';
$instance->foo = 'bar'; return $instance;
}
return $instance; }
[Container%s/getNonSharedFooService.php] => <?php [Container%s/getNonSharedFooService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'non_shared_foo' service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getNonSharedFooService extends ProjectServiceContainer
{
/**
* Gets the public 'non_shared_foo' service.
*
* @return \Bar\FooClass
*/
public static function do($container, $lazyLoad = true)
{
include_once $container->targetDir.''.'/Fixtures/includes/foo.php';
include_once $this->targetDir.''.'/Fixtures/includes/foo.php'; return new \Bar\FooClass();
}
$this->factories['non_shared_foo'] = function () { }
return new \Bar\FooClass();
};
return $this->factories['non_shared_foo']();
[Container%s/getRuntimeErrorService.php] => <?php [Container%s/getRuntimeErrorService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'runtime_error' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['runtime_error'] = new \stdClass($this->throw('Service "errored_definition" is broken.')); class getRuntimeErrorService extends ProjectServiceContainer
{
/**
* Gets the public 'runtime_error' shared service.
*
* @return \stdClass
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['runtime_error'] = new \stdClass($container->throw('Service "errored_definition" is broken.'));
}
}
[Container%s/getServiceFromStaticMethodService.php] => <?php [Container%s/getServiceFromStaticMethodService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'service_from_static_method' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['service_from_static_method'] = \Bar\FooClass::getInstance(); class getServiceFromStaticMethodService extends ProjectServiceContainer
{
/**
* Gets the public 'service_from_static_method' shared service.
*
* @return \Bar\FooClass
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['service_from_static_method'] = \Bar\FooClass::getInstance();
}
}
[Container%s/getTaggedIteratorService.php] => <?php [Container%s/getTaggedIteratorService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'tagged_iterator' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['tagged_iterator'] = new \Bar(new RewindableGenerator(function () { class getTaggedIteratorService extends ProjectServiceContainer
yield 0 => ($this->services['foo'] ?? $this->load('getFooService.php')); {
yield 1 => ($this->privates['tagged_iterator_foo'] ?? ($this->privates['tagged_iterator_foo'] = new \Bar())); /**
}, 2)); * Gets the public 'tagged_iterator' shared service.
*
* @return \Bar
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['tagged_iterator'] = new \Bar(new RewindableGenerator(function () use ($container) {
yield 0 => ($container->services['foo'] ?? $container->load('getFooService'));
yield 1 => ($container->privates['tagged_iterator_foo'] ?? ($container->privates['tagged_iterator_foo'] = new \Bar()));
}, 2));
}
}
[Container%s/getThrowingOneService.php] => <?php [Container%s/getThrowingOneService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'throwing_one' shared service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
return $this->services['throwing_one'] = new \Bar\FooClass($this->throw('No-no-no-no')); class getThrowingOneService extends ProjectServiceContainer
{
/**
* Gets the public 'throwing_one' shared service.
*
* @return \Bar\FooClass
*/
public static function do($container, $lazyLoad = true)
{
return $container->services['throwing_one'] = new \Bar\FooClass($container->throw('No-no-no-no'));
}
}
[Container%s/ProjectServiceContainer.php] => <?php [Container%s/ProjectServiceContainer.php] => <?php
@ -365,17 +687,14 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
protected $containerDir;
protected $targetDir;
protected $parameters = [];
private $buildParameters; private $buildParameters;
private $containerDir;
private $targetDir;
private $parameters = [];
public function __construct(array $buildParameters = [], $containerDir = __DIR__) public function __construct(array $buildParameters = [], $containerDir = __DIR__)
{ {
@ -392,30 +711,30 @@ class ProjectServiceContainer extends Container
'bar' => 'getBarService', 'bar' => 'getBarService',
]; ];
$this->fileMap = [ $this->fileMap = [
'BAR' => 'getBAR2Service.php', 'BAR' => 'getBAR2Service',
'BAR2' => 'getBAR22Service.php', 'BAR2' => 'getBAR22Service',
'bar2' => 'getBar23Service.php', 'bar2' => 'getBar23Service',
'baz' => 'getBazService.php', 'baz' => 'getBazService',
'configured_service' => 'getConfiguredServiceService.php', 'configured_service' => 'getConfiguredServiceService',
'configured_service_simple' => 'getConfiguredServiceSimpleService.php', 'configured_service_simple' => 'getConfiguredServiceSimpleService',
'decorator_service' => 'getDecoratorServiceService.php', 'decorator_service' => 'getDecoratorServiceService',
'decorator_service_with_name' => 'getDecoratorServiceWithNameService.php', 'decorator_service_with_name' => 'getDecoratorServiceWithNameService',
'deprecated_service' => 'getDeprecatedServiceService.php', 'deprecated_service' => 'getDeprecatedServiceService',
'factory_service' => 'getFactoryServiceService.php', 'factory_service' => 'getFactoryServiceService',
'factory_service_simple' => 'getFactoryServiceSimpleService.php', 'factory_service_simple' => 'getFactoryServiceSimpleService',
'foo' => 'getFooService.php', 'foo' => 'getFooService',
'foo.baz' => 'getFoo_BazService.php', 'foo.baz' => 'getFoo_BazService',
'foo_bar' => 'getFooBarService.php', 'foo_bar' => 'getFooBarService',
'foo_with_inline' => 'getFooWithInlineService.php', 'foo_with_inline' => 'getFooWithInlineService',
'lazy_context' => 'getLazyContextService.php', 'lazy_context' => 'getLazyContextService',
'lazy_context_ignore_invalid_ref' => 'getLazyContextIgnoreInvalidRefService.php', 'lazy_context_ignore_invalid_ref' => 'getLazyContextIgnoreInvalidRefService',
'method_call1' => 'getMethodCall1Service.php', 'method_call1' => 'getMethodCall1Service',
'new_factory_service' => 'getNewFactoryServiceService.php', 'new_factory_service' => 'getNewFactoryServiceService',
'non_shared_foo' => 'getNonSharedFooService.php', 'non_shared_foo' => 'getNonSharedFooService',
'runtime_error' => 'getRuntimeErrorService.php', 'runtime_error' => 'getRuntimeErrorService',
'service_from_static_method' => 'getServiceFromStaticMethodService.php', 'service_from_static_method' => 'getServiceFromStaticMethodService',
'tagged_iterator' => 'getTaggedIteratorService.php', 'tagged_iterator' => 'getTaggedIteratorService',
'throwing_one' => 'getThrowingOneService.php', 'throwing_one' => 'getThrowingOneService',
]; ];
$this->aliases = [ $this->aliases = [
'alias_for_alias' => 'foo', 'alias_for_alias' => 'foo',
@ -441,7 +760,19 @@ class ProjectServiceContainer extends Container
protected function load($file, $lazyLoad = true) protected function load($file, $lazyLoad = true)
{ {
return require $this->containerDir.\DIRECTORY_SEPARATOR.$file; if (class_exists($class = __NAMESPACE__.'\\'.$file, false)) {
return $class::do($this, $lazyLoad);
}
if ('.' === $file[-4]) {
$class = substr($class, 0, -4);
} else {
$file .= '.php';
}
$service = require $this->containerDir.\DIRECTORY_SEPARATOR.$file;
return class_exists($class, false) ? $class::do($this, $lazyLoad) : $service;
} }
/** /**
@ -451,7 +782,7 @@ class ProjectServiceContainer extends Container
*/ */
protected function getBarService() protected function getBarService()
{ {
$a = ($this->services['foo.baz'] ?? $this->load('getFoo_BazService.php')); $a = ($this->services['foo.baz'] ?? $this->load('getFoo_BazService'));
$this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar')); $this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar'));
@ -530,7 +861,40 @@ class ProjectServiceContainer extends Container
} }
[ProjectServiceContainer.preload.php] => <?php [ProjectServiceContainer.preload.php] => <?php
%A
// This file has been auto-generated by the Symfony Dependency Injection Component
// You can reference it in the "opcache.preload" php.ini setting on PHP >= 7.4 when preloading is desired
use Symfony\Component\DependencyInjection\Dumper\Preloader;
require dirname(__DIR__, %d).'%svendor/autoload.php';
require __DIR__.'/Container%s/ProjectServiceContainer.php';
require __DIR__.'/Container%s/getThrowingOneService.php';
require __DIR__.'/Container%s/getTaggedIteratorService.php';
require __DIR__.'/Container%s/getServiceFromStaticMethodService.php';
require __DIR__.'/Container%s/getRuntimeErrorService.php';
require __DIR__.'/Container%s/getNonSharedFooService.php';
require __DIR__.'/Container%s/getNewFactoryServiceService.php';
require __DIR__.'/Container%s/getMethodCall1Service.php';
require __DIR__.'/Container%s/getLazyContextIgnoreInvalidRefService.php';
require __DIR__.'/Container%s/getLazyContextService.php';
require __DIR__.'/Container%s/getFooWithInlineService.php';
require __DIR__.'/Container%s/getFooBarService.php';
require __DIR__.'/Container%s/getFoo_BazService.php';
require __DIR__.'/Container%s/getFooService.php';
require __DIR__.'/Container%s/getFactorySimpleService.php';
require __DIR__.'/Container%s/getFactoryServiceSimpleService.php';
require __DIR__.'/Container%s/getFactoryServiceService.php';
require __DIR__.'/Container%s/getDeprecatedServiceService.php';
require __DIR__.'/Container%s/getDecoratorServiceWithNameService.php';
require __DIR__.'/Container%s/getDecoratorServiceService.php';
require __DIR__.'/Container%s/getConfiguredServiceSimpleService.php';
require __DIR__.'/Container%s/getConfiguredServiceService.php';
require __DIR__.'/Container%s/getBazService.php';
require __DIR__.'/Container%s/getBar23Service.php';
require __DIR__.'/Container%s/getBAR22Service.php';
require __DIR__.'/Container%s/getBAR2Service.php';
require __DIR__.'/Container%s/removed-ids.php';
$classes = []; $classes = [];
$classes[] = 'Bar\FooClass'; $classes[] = 'Bar\FooClass';
@ -545,7 +909,7 @@ $classes[] = 'FactoryClass';
$classes[] = 'Request'; $classes[] = 'Request';
$classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface'; $classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface';
%A Preloader::preload($classes);
[ProjectServiceContainer.php] => <?php [ProjectServiceContainer.php] => <?php

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -2,6 +2,8 @@ Array
( (
[Container%s/removed-ids.php] => <?php [Container%s/removed-ids.php] => <?php
namespace Container%s;
return [ return [
'Psr\\Container\\ContainerInterface' => true, 'Psr\\Container\\ContainerInterface' => true,
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
@ -31,17 +33,14 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
protected $containerDir;
protected $targetDir;
protected $parameters = [];
private $buildParameters; private $buildParameters;
private $containerDir;
private $targetDir;
private $parameters = [];
public function __construct(array $buildParameters = [], $containerDir = __DIR__) public function __construct(array $buildParameters = [], $containerDir = __DIR__)
{ {
@ -530,7 +529,15 @@ class ProjectServiceContainer extends Container
} }
[ProjectServiceContainer.preload.php] => <?php [ProjectServiceContainer.preload.php] => <?php
%A
// This file has been auto-generated by the Symfony Dependency Injection Component
// You can reference it in the "opcache.preload" php.ini setting on PHP >= 7.4 when preloading is desired
use Symfony\Component\DependencyInjection\Dumper\Preloader;
require dirname(__DIR__, %d).'%svendor/autoload.php';
require __DIR__.'/Container%s/ProjectServiceContainer.php';
require __DIR__.'/Container%s/removed-ids.php';
$classes = []; $classes = [];
$classes[] = 'Bar\FooClass'; $classes[] = 'Bar\FooClass';
@ -545,7 +552,7 @@ $classes[] = 'FactoryClass';
$classes[] = 'Request'; $classes[] = 'Request';
$classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface'; $classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface';
%A Preloader::preload($classes);
[ProjectServiceContainer.php] => <?php [ProjectServiceContainer.php] => <?php

View File

@ -2,6 +2,8 @@ Array
( (
[Container%s/removed-ids.php] => <?php [Container%s/removed-ids.php] => <?php
namespace Container%s;
return [ return [
'Psr\\Container\\ContainerInterface' => true, 'Psr\\Container\\ContainerInterface' => true,
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
@ -21,17 +23,14 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
protected $containerDir;
protected $targetDir;
protected $parameters = [];
private $buildParameters; private $buildParameters;
private $containerDir;
private $targetDir;
private $parameters = [];
public function __construct(array $buildParameters = [], $containerDir = __DIR__) public function __construct(array $buildParameters = [], $containerDir = __DIR__)
{ {
@ -65,8 +64,6 @@ class ProjectServiceContainer extends Container
protected function createProxy($class, \Closure $factory) protected function createProxy($class, \Closure $factory)
{ {
class_exists($class, false) || class_alias(__NAMESPACE__."\\$class", $class, false);
return $factory(); return $factory();
} }
@ -78,8 +75,8 @@ class ProjectServiceContainer extends Container
protected function getLazyFooService($lazyLoad = true) protected function getLazyFooService($lazyLoad = true)
{ {
if ($lazyLoad) { if ($lazyLoad) {
return $this->services['lazy_foo'] = $this->createProxy('FooClass_%s', function () { return $this->services['lazy_foo'] = $this->createProxy('FooClass_8976cfa', function () {
return \FooClass_%s::staticProxyConstructor(function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) { return \FooClass_8976cfa::staticProxyConstructor(function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) {
$wrappedInstance = $this->getLazyFooService(false); $wrappedInstance = $this->getLazyFooService(false);
$proxy->setProxyInitializer(null); $proxy->setProxyInitializer(null);
@ -163,15 +160,25 @@ class FooClass_%s extends \Bar\FooClass implements \ProxyManager\Proxy\VirtualPr
%A %A
} }
\class_alias(__NAMESPACE__.'\\FooClass_%s', 'FooClass_%s', false);
[ProjectServiceContainer.preload.php] => <?php [ProjectServiceContainer.preload.php] => <?php
%A
// This file has been auto-generated by the Symfony Dependency Injection Component
// You can reference it in the "opcache.preload" php.ini setting on PHP >= 7.4 when preloading is desired
use Symfony\Component\DependencyInjection\Dumper\Preloader;
require dirname(__DIR__, %d).'%svendor/autoload.php';
require __DIR__.'/Container%s/ProjectServiceContainer.php';
require __DIR__.'/Container%s/removed-ids.php';
$classes = []; $classes = [];
$classes[] = 'Bar\FooClass'; $classes[] = 'Bar\FooClass';
$classes[] = 'Bar\FooLazyClass'; $classes[] = 'Bar\FooLazyClass';
$classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface'; $classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface';
%A Preloader::preload($classes);
[ProjectServiceContainer.php] => <?php [ProjectServiceContainer.php] => <?php

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_Almost_Circular_Private extends Container class Symfony_DI_PhpDumper_Test_Almost_Circular_Private extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_CsvParameters extends Container class Symfony_DI_PhpDumper_Test_CsvParameters extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_Deep_Graph extends Container class Symfony_DI_PhpDumper_Test_Deep_Graph extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_DefaultParameters extends Container class Symfony_DI_PhpDumper_Test_DefaultParameters extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Errored_Definition extends Container class Symfony_DI_PhpDumper_Errored_Definition extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_Inline_Self_Ref extends Container class Symfony_DI_PhpDumper_Test_Inline_Self_Ref extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_JsonParameters extends Container class Symfony_DI_PhpDumper_Test_JsonParameters extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -2,6 +2,8 @@ Array
( (
[Container%s/removed-ids.php] => <?php [Container%s/removed-ids.php] => <?php
namespace Container%s;
return [ return [
'Psr\\Container\\ContainerInterface' => true, 'Psr\\Container\\ContainerInterface' => true,
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
@ -9,19 +11,28 @@ return [
[Container%s/getNonSharedFooService.php] => <?php [Container%s/getNonSharedFooService.php] => <?php
namespace Container%s;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use. /**
// Returns the public 'non_shared_foo' service. * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
*/
class getNonSharedFooService extends ProjectServiceContainer
{
/**
* Gets the public 'non_shared_foo' service.
*
* @return \Bar\FooLazyClass
*/
public static function do($container, $lazyLoad = true)
{
include_once $container->targetDir.''.'/Fixtures/includes/foo_lazy.php';
include_once $this->targetDir.''.'/Fixtures/includes/foo_lazy.php'; return new \Bar\FooLazyClass();
}
$this->factories['non_shared_foo'] = function ($lazyLoad = true) { }
return new \Bar\FooLazyClass();
};
return $this->factories['non_shared_foo']();
[Container%s/ProjectServiceContainer.php] => <?php [Container%s/ProjectServiceContainer.php] => <?php
@ -37,17 +48,14 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
protected $containerDir;
protected $targetDir;
protected $parameters = [];
private $buildParameters; private $buildParameters;
private $containerDir;
private $targetDir;
private $parameters = [];
public function __construct(array $buildParameters = [], $containerDir = __DIR__) public function __construct(array $buildParameters = [], $containerDir = __DIR__)
{ {
@ -56,7 +64,7 @@ class ProjectServiceContainer extends Container
$this->targetDir = \dirname($containerDir); $this->targetDir = \dirname($containerDir);
$this->services = $this->privates = []; $this->services = $this->privates = [];
$this->fileMap = [ $this->fileMap = [
'non_shared_foo' => 'getNonSharedFooService.php', 'non_shared_foo' => 'getNonSharedFooService',
]; ];
$this->aliases = []; $this->aliases = [];
@ -79,18 +87,39 @@ class ProjectServiceContainer extends Container
protected function load($file, $lazyLoad = true) protected function load($file, $lazyLoad = true)
{ {
return require $this->containerDir.\DIRECTORY_SEPARATOR.$file; if (class_exists($class = __NAMESPACE__.'\\'.$file, false)) {
return $class::do($this, $lazyLoad);
}
if ('.' === $file[-4]) {
$class = substr($class, 0, -4);
} else {
$file .= '.php';
}
$service = require $this->containerDir.\DIRECTORY_SEPARATOR.$file;
return class_exists($class, false) ? $class::do($this, $lazyLoad) : $service;
} }
} }
[ProjectServiceContainer.preload.php] => <?php [ProjectServiceContainer.preload.php] => <?php
%A
// This file has been auto-generated by the Symfony Dependency Injection Component
// You can reference it in the "opcache.preload" php.ini setting on PHP >= 7.4 when preloading is desired
use Symfony\Component\DependencyInjection\Dumper\Preloader;
require dirname(__DIR__, %d).'%svendor/autoload.php';
require __DIR__.'/Container%s/ProjectServiceContainer.php';
require __DIR__.'/Container%s/getNonSharedFooService.php';
require __DIR__.'/Container%s/removed-ids.php';
$classes = []; $classes = [];
$classes[] = 'Bar\FooLazyClass'; $classes[] = 'Bar\FooLazyClass';
$classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface'; $classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface';
%A Preloader::preload($classes);
[ProjectServiceContainer.php] => <?php [ProjectServiceContainer.php] => <?php

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_QueryStringParameters extends Container class Symfony_DI_PhpDumper_Test_QueryStringParameters extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,15 +10,12 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container
{ {
private $parameters = []; protected $parameters = [];
private $getService; protected $getService;
public function __construct() public function __construct()
{ {

View File

@ -10,15 +10,12 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Service_Locator_Argument extends Container class Symfony_DI_PhpDumper_Service_Locator_Argument extends Container
{ {
private $parameters = []; protected $parameters = [];
private $getService; protected $getService;
public function __construct() public function __construct()
{ {

View File

@ -10,15 +10,12 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
private $getService; protected $getService;
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class ProjectServiceContainer extends Container class ProjectServiceContainer extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_Uninitialized_Reference extends Container class Symfony_DI_PhpDumper_Test_Uninitialized_Reference extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_Unsupported_Characters extends Container class Symfony_DI_PhpDumper_Test_Unsupported_Characters extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Test_UrlParameters extends Container class Symfony_DI_PhpDumper_Test_UrlParameters extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {

View File

@ -10,14 +10,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/** /**
* This class has been auto-generated * @internal This class has been auto-generated by the Symfony Dependency Injection Component.
* by the Symfony Dependency Injection Component.
*
* @final
*/ */
class Symfony_DI_PhpDumper_Service_Wither extends Container class Symfony_DI_PhpDumper_Service_Wither extends Container
{ {
private $parameters = []; protected $parameters = [];
public function __construct() public function __construct()
{ {