Array ( [Container%s/removed-ids.php] => true, 'configurator_service' => true, 'configurator_service_simple' => true, 'decorated.pif-pouf' => true, 'decorator_service.inner' => true, 'errored_definition' => true, 'errored_one' => true, 'factory_simple' => true, 'inlined' => true, 'new_factory' => true, 'tagged_iterator_foo' => true, ]; [Container%s/getBAR2Service.php] => services['BAR'] = $instance = new \stdClass(); $instance->bar = ($container->services['bar'] ?? self::getBarService($container)); return $instance; } } [Container%s/getBAR22Service.php] => services['BAR2'] = new \stdClass(); } } [Container%s/getAServiceService.php] => services['a_service'] = ($container->privates['a_factory'] ??= new \Bar())->getBar(); } } [Container%s/getBServiceService.php] => services['b_service'] = ($container->privates['a_factory'] ??= new \Bar())->getBar(); } } [Container%s/getBar23Service.php] => services['bar2'] = new \stdClass(); } } [Container%s/getBazService.php] => services['baz'] = $instance = new \Baz(); $instance->setFoo(($container->services['foo_with_inline'] ?? $container->load('getFooWithInlineService'))); return $instance; } } [Container%s/getConfiguredServiceService.php] => services['configured_service'] = $instance = new \stdClass(); $a = new \ConfClass(); $a->setFoo(($container->services['baz'] ?? $container->load('getBazService'))); $a->configureStdClass($instance); return $instance; } } [Container%s/getConfiguredServiceSimpleService.php] => services['configured_service_simple'] = $instance = new \stdClass(); (new \ConfClass('bar'))->configureStdClass($instance); return $instance; } } [Container%s/getDecoratorServiceService.php] => services['decorator_service'] = new \stdClass(); } } [Container%s/getDecoratorServiceWithNameService.php] => services['decorator_service_with_name'] = new \stdClass(); } } [Container%s/getDeprecatedServiceService.php] => services['deprecated_service'] = new \stdClass(); } } [Container%s/getFactoryServiceService.php] => services['factory_service'] = ($container->services['foo.baz'] ?? $container->load('getFoo_BazService'))->getInstance(); } } [Container%s/getFactoryServiceSimpleService.php] => services['factory_service_simple'] = $container->load('getFactorySimpleService')->getInstance(); } } [Container%s/getFactorySimpleService.php] => services['foo.baz'] ?? $container->load('getFoo_BazService')); $container->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, ['bar' => 'foo is bar', 'foobar' => 'bar'], true, $container); $instance->foo = 'bar'; $instance->moo = $a; $instance->qux = ['bar' => 'foo is bar', 'foobar' => 'bar']; $instance->setBar(($container->services['bar'] ?? self::getBarService($container))); $instance->initialize(); sc_configure($instance); return $instance; } } [Container%s/getFoo_BazService.php] => services['foo.baz'] = $instance = \BazClass::getInstance(); \BazClass::configureStatic1($instance); return $instance; } } [Container%s/getFooBarService.php] => factories['foo_bar'] = function ($container) { return new \Bar\FooClass(($container->services['deprecated_service'] ?? $container->load('getDeprecatedServiceService'))); }; return $container->factories['foo_bar']($container); } } [Container%s/getFooWithInlineService.php] => services['foo_with_inline'] = $instance = new \Foo(); $a = new \Bar(); $a->pub = 'pub'; $a->setBaz(($container->services['baz'] ?? $container->load('getBazService'))); $instance->setBar($a); return $instance; } } [Container%s/getLazyContextService.php] => 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(fn () => new \EmptyIterator(), 0)); } } [Container%s/getLazyContextIgnoreInvalidRefService.php] => 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(fn () => new \EmptyIterator(), 0)); } } [Container%s/getMethodCall1Service.php] => targetDir.''.'/Fixtures/includes/foo.php'; $container->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")))); return $instance; } } [Container%s/getNewFactoryServiceService.php] => foo = 'bar'; $container->services['new_factory_service'] = $instance = $a->getInstance(); $instance->foo = 'bar'; return $instance; } } [Container%s/getNonSharedFooService.php] => targetDir.''.'/Fixtures/includes/foo.php'; $container->factories['non_shared_foo'] = function ($container) { return new \Bar\FooClass(); }; return $container->factories['non_shared_foo']($container); } } [Container%s/getPreloadSidekickService.php] => services['preload_sidekick'] = new \stdClass(); } } [Container%s/getRuntimeErrorService.php] => services['runtime_error'] = new \stdClass(throw new RuntimeException('Service "errored_definition" is broken.')); } } [Container%s/getServiceFromStaticMethodService.php] => services['service_from_static_method'] = \Bar\FooClass::getInstance(); } } [Container%s/getTaggedIteratorService.php] => 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'] ??= new \Bar()); }, 2)); } } [Container%s/getThrowingOneService.php] => services['throwing_one'] = new \Bar\FooClass(throw new RuntimeException('No-no-no-no')); } } [Container%s/ProjectServiceContainer.php] => targetDir = \dirname($containerDir); $this->parameters = $this->getDefaultParameters(); $this->services = $this->privates = []; $this->syntheticIds = [ 'request' => true, ]; $this->methodMap = [ 'bar' => 'getBarService', ]; $this->fileMap = [ 'BAR' => 'getBAR2Service', 'BAR2' => 'getBAR22Service', 'a_service' => 'getAServiceService', 'b_service' => 'getBServiceService', 'bar2' => 'getBar23Service', 'baz' => 'getBazService', 'configured_service' => 'getConfiguredServiceService', 'configured_service_simple' => 'getConfiguredServiceSimpleService', 'decorator_service' => 'getDecoratorServiceService', 'decorator_service_with_name' => 'getDecoratorServiceWithNameService', 'deprecated_service' => 'getDeprecatedServiceService', 'factory_service' => 'getFactoryServiceService', 'factory_service_simple' => 'getFactoryServiceSimpleService', 'foo' => 'getFooService', 'foo.baz' => 'getFoo_BazService', 'foo_bar' => 'getFooBarService', 'foo_with_inline' => 'getFooWithInlineService', 'lazy_context' => 'getLazyContextService', 'lazy_context_ignore_invalid_ref' => 'getLazyContextIgnoreInvalidRefService', 'method_call1' => 'getMethodCall1Service', 'new_factory_service' => 'getNewFactoryServiceService', 'non_shared_foo' => 'getNonSharedFooService', 'preload_sidekick' => 'getPreloadSidekickService', 'runtime_error' => 'getRuntimeErrorService', 'service_from_static_method' => 'getServiceFromStaticMethodService', 'tagged_iterator' => 'getTaggedIteratorService', 'throwing_one' => 'getThrowingOneService', ]; $this->aliases = [ 'alias_for_alias' => 'foo', 'alias_for_foo' => 'foo', 'decorated' => 'decorator_service_with_name', ]; } public function compile(): void { throw new LogicException('You cannot compile a dumped container that was already compiled.'); } public function isCompiled(): bool { return true; } public function getRemovedIds(): array { return require $this->containerDir.\DIRECTORY_SEPARATOR.'removed-ids.php'; } protected function load($file, $lazyLoad = true): mixed { 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; } /** * Gets the public 'bar' shared service. * * @return \Bar\FooClass */ protected static function getBarService($container) { $a = ($container->services['foo.baz'] ?? $container->load('getFoo_BazService')); $container->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $container->getParameter('foo_bar')); $a->configure($instance); return $instance; } public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null { if (isset($this->buildParameters[$name])) { return $this->buildParameters[$name]; } if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new ParameterNotFoundException($name); } if (isset($this->loadedDynamicParameters[$name])) { return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } return $this->parameters[$name]; } public function hasParameter(string $name): bool { if (isset($this->buildParameters[$name])) { return true; } return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); } public function setParameter(string $name, $value): void { throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); } public function getParameterBag(): ParameterBagInterface { if (!isset($this->parameterBag)) { $parameters = $this->parameters; foreach ($this->loadedDynamicParameters as $name => $loaded) { $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); } foreach ($this->buildParameters as $name => $value) { $parameters[$name] = $value; } $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } private $loadedDynamicParameters = []; private $dynamicParameters = []; private function getDynamicParameter(string $name) { throw new ParameterNotFoundException($name); } protected function getDefaultParameters(): array { return [ 'baz_class' => 'BazClass', 'foo_class' => 'Bar\\FooClass', 'foo' => 'bar', ]; } } [ProjectServiceContainer.preload.php] => = 7.4 when preloading is desired use Symfony\Component\DependencyInjection\Dumper\Preloader; if (in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { return; } require dirname(__DIR__, %d).'%svendor/autoload.php'; (require __DIR__.'/ProjectServiceContainer.php')->set(\Container%s\ProjectServiceContainer::class, null); 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/getPreloadSidekickService.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/getFactoryServiceSimpleService.php'; require __DIR__.'/Container%s/getFactoryServiceService.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/getBServiceService.php'; require __DIR__.'/Container%s/getAServiceService.php'; require __DIR__.'/Container%s/getBAR22Service.php'; require __DIR__.'/Container%s/getBAR2Service.php'; $classes = []; $classes[] = 'Bar'; $classes[] = 'Bar\FooClass'; $classes[] = 'Baz'; $classes[] = 'ConfClass'; $classes[] = 'BazClass'; $classes[] = 'Foo'; $classes[] = 'LazyContext'; $classes[] = 'FooBarBaz'; $classes[] = 'FactoryClass'; $classes[] = 'Some\Sidekick1'; $classes[] = 'Some\Sidekick2'; $classes[] = 'Request'; $classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface'; $preloaded = Preloader::preload($classes); [ProjectServiceContainer.php] => '%s', 'container.build_id' => '%s', 'container.build_time' => %d, 'container.runtime_mode' => \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1', ], __DIR__.\DIRECTORY_SEPARATOR.'Container%s'); )