feature #23561 [DI] Optimize use of private and pre-defined services (nicolas-grekas)

This PR was merged into the 4.0-dev branch.

Discussion
----------

[DI] Optimize use of private and pre-defined services

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes (perf)
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

By making private services really private and taking into account that (un)setting pre-defined services is not allowed anymore, we can go one step further into optimizing the dumped container.

Commits
-------

c0c1881fe4 [DI] Optimize use of private and pre-defined services
This commit is contained in:
Fabien Potencier 2017-07-19 06:19:43 +02:00
commit 1cac0a0bba
18 changed files with 77 additions and 146 deletions

View File

@ -50,11 +50,6 @@ class Container implements ResettableContainerInterface
protected $aliases = array();
protected $loading = array();
/**
* @internal
*/
protected $privates = array();
private $envCache = array();
private $compiled = false;
@ -155,10 +150,6 @@ class Container implements ResettableContainerInterface
throw new InvalidArgumentException('You cannot set service "service_container".');
}
if (isset($this->privates[$id])) {
throw new InvalidArgumentException(sprintf('You cannot set the private service "%s".', $id));
}
if (isset($this->methodMap[$id])) {
throw new InvalidArgumentException(sprintf('You cannot set the pre-defined service "%s".', $id));
}
@ -185,9 +176,6 @@ class Container implements ResettableContainerInterface
*/
public function has($id)
{
if (isset($this->privates[$id])) {
return false;
}
if (isset($this->aliases[$id])) {
$id = $this->aliases[$id];
}
@ -224,13 +212,6 @@ class Container implements ResettableContainerInterface
*/
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)
{
if (isset($this->privates[$id])) {
if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) {
throw new ServiceNotFoundException($id);
}
return;
}
if (isset($this->aliases[$id])) {
$id = $this->aliases[$id];
}
@ -293,10 +274,6 @@ class Container implements ResettableContainerInterface
*/
public function initialized($id)
{
if (isset($this->privates[$id])) {
return false;
}
if (isset($this->aliases[$id])) {
$id = $this->aliases[$id];
}

View File

@ -401,7 +401,7 @@ class PhpDumper extends Dumper
$instantiation = '';
if (!$isProxyCandidate && $definition->isShared()) {
$instantiation = "\$this->services['$id'] = ".($isSimpleInstance ? '' : '$instance');
$instantiation = sprintf('$this->%s[\'%s\'] = %s', $this->container->getDefinition($id)->isPublic() ? 'services' : 'privates', $id, $isSimpleInstance ? '' : '$instance');
} elseif (!$isSimpleInstance) {
$instantiation = '$instance';
}
@ -646,7 +646,7 @@ EOF;
// with proxies, for 5.3.3 compatibility, the getter must be public to be accessible to the initializer
$isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition);
$visibility = $isProxyCandidate ? 'public' : 'protected';
$visibility = $isProxyCandidate ? 'public' : ($definition->isPublic() ? 'protected' : 'private');
$methodName = $this->generateMethodName($id);
$code = <<<EOF
@ -792,6 +792,7 @@ class $class extends $baseClass
{
private \$parameters;
private \$targetDirs = array();
private \$privates = array();
EOF;
}
@ -818,9 +819,8 @@ EOF;
$code .= "\n \$this->parameters = \$this->getDefaultParameters();\n";
}
$code .= "\n \$this->services = array();\n";
$code .= "\n \$this->services = \$this->privates = array();\n";
$code .= $this->addMethodMap();
$code .= $this->addPrivateServices();
$code .= $this->addAliases();
$code .= <<<'EOF'
@ -886,40 +886,12 @@ EOF;
$code = " \$this->methodMap = array(\n";
ksort($definitions);
foreach ($definitions as $id => $definition) {
$code .= ' '.$this->export($id).' => '.$this->export($this->generateMethodName($id)).",\n";
}
return $code." );\n";
}
/**
* Adds the privates property definition.
*
* @return string
*/
private function addPrivateServices()
{
if (!$definitions = $this->container->getDefinitions()) {
return '';
}
$code = '';
ksort($definitions);
foreach ($definitions as $id => $definition) {
if (!$definition->isPublic()) {
$code .= ' '.$this->export($id)." => true,\n";
if ($definition->isPublic()) {
$code .= ' '.$this->export($id).' => '.$this->export($this->generateMethodName($id)).",\n";
}
}
if (empty($code)) {
return '';
}
$out = " \$this->privates = array(\n";
$out .= $code;
$out .= " );\n";
return $out;
return $code." );\n";
}
/**
@ -1535,18 +1507,18 @@ EOF;
return '$this';
}
if ($this->container->hasDefinition($id) && !$this->container->getDefinition($id)->isPublic()) {
if ($this->container->hasDefinition($id)) {
$code = sprintf('$this->%s()', $this->generateMethodName($id));
if ($this->container->getDefinition($id)->isShared()) {
$code = sprintf('($this->%s[\'%s\'] ?? %s)', $this->container->getDefinition($id)->isPublic() ? 'services' : 'privates', $id, $code);
}
} elseif (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
$code = sprintf('$this->get(\'%s\', ContainerInterface::NULL_ON_INVALID_REFERENCE)', $id);
} else {
$code = sprintf('$this->get(\'%s\')', $id);
}
if ($this->container->hasDefinition($id) && $this->container->getDefinition($id)->isShared()) {
$code = "(\$this->services['$id'] ?? $code)";
}
return $code;
}

View File

@ -134,7 +134,7 @@ class ContainerTest extends TestCase
$sc = new ProjectServiceContainer();
$sc->set('foo', $obj = new \stdClass());
$this->assertEquals(array('service_container', 'internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'internal_dependency', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by factory methods in the method map, followed by service ids defined by set()');
$this->assertEquals(array('service_container', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'internal_dependency', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by factory methods in the method map, followed by service ids defined by set()');
}
public function testSet()
@ -340,26 +340,6 @@ class ContainerTest extends TestCase
$this->assertTrue($clone->isPrivate());
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
* @expectedExceptionMessage You cannot set the private service "internal".
*/
public function testUnsetInternalPrivateService()
{
$c = new ProjectServiceContainer();
$c->set('internal', null);
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
* @expectedExceptionMessage You cannot set the private service "internal".
*/
public function testChangeInternalPrivateService()
{
$c = new ProjectServiceContainer();
$c->set('internal', new \stdClass());
}
public function testCheckExistenceOfAnInternalPrivateService()
{
$c = new ProjectServiceContainer();
@ -396,7 +376,6 @@ class ProjectServiceContainer extends Container
public $__foo_baz;
public $__internal;
protected $methodMap = array(
'internal' => 'getInternalService',
'bar' => 'getBarService',
'foo_bar' => 'getFooBarService',
'foo.baz' => 'getFoo_BazService',
@ -414,13 +393,13 @@ class ProjectServiceContainer extends Container
$this->__foo_bar = new \stdClass();
$this->__foo_baz = new \stdClass();
$this->__internal = new \stdClass();
$this->privates = array('internal' => true);
$this->privates = array();
$this->aliases = array('alias' => 'bar');
}
protected function getInternalService()
{
return $this->services['internal'] = $this->__internal;
return $this->privates['internal'] = $this->__internal;
}
protected function getBarService()
@ -459,7 +438,7 @@ class ProjectServiceContainer extends Container
{
$this->services['internal_dependency'] = $instance = new \stdClass();
$instance->internal = isset($this->services['internal']) ? $this->services['internal'] : $this->getInternalService();
$instance->internal = $this->privates['internal'] ?? $this->getInternalService();
return $instance;
}

View File

@ -22,13 +22,14 @@ class Container extends AbstractContainer
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services = array();
$this->services = $this->privates = array();
$this->aliases = array();
}

View File

@ -20,13 +20,14 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services = array();
$this->services = $this->privates = array();
$this->aliases = array();
}

View File

@ -20,6 +20,7 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
@ -28,7 +29,7 @@ class ProjectServiceContainer extends Container
{
$this->parameters = $this->getDefaultParameters();
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'test' => 'getTestService',
);

View File

@ -20,6 +20,7 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
@ -32,7 +33,7 @@ class ProjectServiceContainer extends Container
}
$this->parameters = $this->getDefaultParameters();
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'test' => 'getTestService',
);

View File

@ -20,13 +20,14 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'bar' => 'getBarService',
);

View File

@ -20,13 +20,14 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'service_from_anonymous_factory' => 'getServiceFromAnonymousFactoryService',
'service_with_method_call_and_factory' => 'getServiceWithMethodCallAndFactoryService',

View File

@ -20,13 +20,14 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'foo' => 'getFooService',
);

View File

@ -20,6 +20,7 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
@ -28,7 +29,7 @@ class ProjectServiceContainer extends Container
{
$this->parameters = $this->getDefaultParameters();
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'test' => 'getTestService',
);

View File

@ -20,13 +20,14 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Container33\\Foo' => 'getSymfony_Component_DependencyInjection_Tests_Fixtures_Container33_FooService',
);

View File

@ -20,6 +20,7 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
@ -28,7 +29,7 @@ class ProjectServiceContainer extends Container
{
$this->parameters = $this->getDefaultParameters();
$this->services = array();
$this->services = $this->privates = array();
$this->aliases = array();
}

View File

@ -20,6 +20,7 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
@ -28,7 +29,7 @@ class ProjectServiceContainer extends Container
{
$this->parameters = $this->getDefaultParameters();
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'BAR' => 'getBARService',
'BAR2' => 'getBAR2Service',
@ -87,7 +88,7 @@ class ProjectServiceContainer extends Container
{
$this->services['BAR'] = $instance = new \stdClass();
$instance->bar = ($this->services['bar'] ?? $this->get('bar'));
$instance->bar = ($this->services['bar'] ?? $this->getBar3Service());
return $instance;
}
@ -115,7 +116,7 @@ class ProjectServiceContainer extends Container
*/
protected function getBar3Service()
{
$a = ($this->services['foo.baz'] ?? $this->get('foo.baz'));
$a = ($this->services['foo.baz'] ?? $this->getFoo_BazService());
$this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar'));
@ -149,7 +150,7 @@ class ProjectServiceContainer extends Container
{
$this->services['baz'] = $instance = new \Baz();
$instance->setFoo(($this->services['foo_with_inline'] ?? $this->get('foo_with_inline')));
$instance->setFoo(($this->services['foo_with_inline'] ?? $this->getFooWithInlineService()));
return $instance;
}
@ -165,7 +166,7 @@ class ProjectServiceContainer extends Container
protected function getConfiguredServiceService()
{
$a = new \ConfClass();
$a->setFoo(($this->services['baz'] ?? $this->get('baz')));
$a->setFoo(($this->services['baz'] ?? $this->getBazService()));
$this->services['configured_service'] = $instance = new \stdClass();
@ -244,7 +245,7 @@ class ProjectServiceContainer extends Container
*/
protected function getFactoryServiceService()
{
return $this->services['factory_service'] = ($this->services['foo.baz'] ?? $this->get('foo.baz'))->getInstance();
return $this->services['factory_service'] = ($this->services['foo.baz'] ?? $this->getFoo_BazService())->getInstance();
}
/**
@ -270,14 +271,14 @@ class ProjectServiceContainer extends Container
*/
protected function getFooService()
{
$a = ($this->services['foo.baz'] ?? $this->get('foo.baz'));
$a = ($this->services['foo.baz'] ?? $this->getFoo_BazService());
$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
$instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar');
$instance->setBar(($this->services['bar'] ?? $this->get('bar')));
$instance->setBar(($this->services['bar'] ?? $this->getBar3Service()));
$instance->initialize();
sc_configure($instance);
@ -326,7 +327,7 @@ class ProjectServiceContainer extends Container
$this->services['foo_with_inline'] = $instance = new \Foo();
$a->pub = 'pub';
$a->setBaz(($this->services['baz'] ?? $this->get('baz')));
$a->setBaz(($this->services['baz'] ?? $this->getBazService()));
$instance->setBar($a);
@ -344,7 +345,7 @@ class ProjectServiceContainer extends Container
protected function getLazyContextService()
{
return $this->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () {
yield 'k1' => ($this->services['foo.baz'] ?? $this->get('foo.baz'));
yield 'k1' => ($this->services['foo.baz'] ?? $this->getFoo_BazService());
yield 'k2' => $this;
}, 2), new RewindableGenerator(function () {
return new \EmptyIterator();
@ -362,7 +363,7 @@ class ProjectServiceContainer extends Container
protected function getLazyContextIgnoreInvalidRefService()
{
return $this->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () {
yield 0 => ($this->services['foo.baz'] ?? $this->get('foo.baz'));
yield 0 => ($this->services['foo.baz'] ?? $this->getFoo_BazService());
}, 1), new RewindableGenerator(function () {
return new \EmptyIterator();
}, 0));
@ -382,7 +383,7 @@ class ProjectServiceContainer extends Container
$this->services['method_call1'] = $instance = new \Bar\FooClass();
$instance->setBar(($this->services['foo'] ?? $this->get('foo')));
$instance->setBar(($this->services['foo'] ?? $this->getFooService()));
$instance->setBar(NULL);
$instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));

View File

@ -20,6 +20,7 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
@ -32,7 +33,7 @@ class ProjectServiceContainer extends Container
}
$this->parameters = $this->getDefaultParameters();
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'bar' => 'getBarService',
);

View File

@ -20,16 +20,16 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'bar_service' => 'getBarServiceService',
'baz_service' => 'getBazServiceService',
'foo_service' => 'getFooServiceService',
'translator.loader_1' => 'getTranslator_Loader1Service',
'translator.loader_2' => 'getTranslator_Loader2Service',
@ -38,9 +38,6 @@ class ProjectServiceContainer extends Container
'translator_2' => 'getTranslator2Service',
'translator_3' => 'getTranslator3Service',
);
$this->privates = array(
'baz_service' => true,
);
$this->aliases = array();
}
@ -71,7 +68,7 @@ class ProjectServiceContainer extends Container
*/
protected function getBarServiceService()
{
return $this->services['bar_service'] = new \stdClass(($this->services['baz_service'] ?? $this->getBazServiceService()));
return $this->services['bar_service'] = new \stdClass(($this->privates['baz_service'] ?? $this->getBazServiceService()));
}
/**
@ -85,9 +82,9 @@ class ProjectServiceContainer extends Container
protected function getFooServiceService()
{
return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\ServiceLocator(array('bar' => function () {
return ($this->services['bar_service'] ?? $this->get('bar_service'));
return ($this->services['bar_service'] ?? $this->getBarServiceService());
}, 'baz' => function (): \stdClass {
return ($this->services['baz_service'] ?? $this->getBazServiceService());
return ($this->privates['baz_service'] ?? $this->getBazServiceService());
}, 'nil' => function () {
return NULL;
}));
@ -143,7 +140,7 @@ class ProjectServiceContainer extends Container
protected function getTranslator1Service()
{
return $this->services['translator_1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(array('translator.loader_1' => function () {
return ($this->services['translator.loader_1'] ?? $this->get('translator.loader_1'));
return ($this->services['translator.loader_1'] ?? $this->getTranslator_Loader1Service());
})));
}
@ -158,10 +155,10 @@ class ProjectServiceContainer extends Container
protected function getTranslator2Service()
{
$this->services['translator_2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(array('translator.loader_2' => function () {
return ($this->services['translator.loader_2'] ?? $this->get('translator.loader_2'));
return ($this->services['translator.loader_2'] ?? $this->getTranslator_Loader2Service());
})));
$instance->addResource('db', ($this->services['translator.loader_2'] ?? $this->get('translator.loader_2')), 'nl');
$instance->addResource('db', ($this->services['translator.loader_2'] ?? $this->getTranslator_Loader2Service()), 'nl');
return $instance;
}
@ -176,10 +173,10 @@ class ProjectServiceContainer extends Container
*/
protected function getTranslator3Service()
{
$a = ($this->services['translator.loader_3'] ?? $this->get('translator.loader_3'));
$a = ($this->services['translator.loader_3'] ?? $this->getTranslator_Loader3Service());
$this->services['translator_3'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(array('translator.loader_3' => function () {
return ($this->services['translator.loader_3'] ?? $this->get('translator.loader_3'));
return ($this->services['translator.loader_3'] ?? $this->getTranslator_Loader3Service());
})));
$instance->addResource('db', $a, 'nl');
@ -200,8 +197,8 @@ class ProjectServiceContainer extends Container
*
* @return \stdClass A stdClass instance
*/
protected function getBazServiceService()
private function getBazServiceService()
{
return $this->services['baz_service'] = new \stdClass();
return $this->privates['baz_service'] = new \stdClass();
}
}

View File

@ -20,21 +20,18 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'bar_service' => 'getBarServiceService',
'baz_service' => 'getBazServiceService',
'foo_service' => 'getFooServiceService',
);
$this->privates = array(
'baz_service' => true,
);
$this->aliases = array();
}
@ -65,7 +62,7 @@ class ProjectServiceContainer extends Container
*/
protected function getBarServiceService()
{
return $this->services['bar_service'] = new \stdClass(($this->services['baz_service'] ?? $this->getBazServiceService()));
return $this->services['bar_service'] = new \stdClass(($this->privates['baz_service'] ?? $this->getBazServiceService()));
}
/**
@ -78,7 +75,7 @@ class ProjectServiceContainer extends Container
*/
protected function getFooServiceService()
{
return $this->services['foo_service'] = new \stdClass(($this->services['baz_service'] ?? $this->getBazServiceService()));
return $this->services['foo_service'] = new \stdClass(($this->privates['baz_service'] ?? $this->getBazServiceService()));
}
/**
@ -93,8 +90,8 @@ class ProjectServiceContainer extends Container
*
* @return \stdClass A stdClass instance
*/
protected function getBazServiceService()
private function getBazServiceService()
{
return $this->services['baz_service'] = new \stdClass();
return $this->privates['baz_service'] = new \stdClass();
}
}

View File

@ -20,21 +20,18 @@ class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
private $privates = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services = array();
$this->services = $this->privates = array();
$this->methodMap = array(
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'getSymfony_Component_DependencyInjection_Tests_Fixtures_TestServiceSubscriberService',
'autowired.Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'getAutowired_Symfony_Component_DependencyInjection_Tests_Fixtures_CustomDefinitionService',
'foo_service' => 'getFooServiceService',
);
$this->privates = array(
'autowired.Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true,
);
$this->aliases = array();
}
@ -81,13 +78,13 @@ class ProjectServiceContainer extends Container
protected function getFooServiceService()
{
return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber(new \Symfony\Component\DependencyInjection\ServiceLocator(array('Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function (): \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition {
return ($this->services['autowired.Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] ?? $this->getAutowired_Symfony_Component_DependencyInjection_Tests_Fixtures_CustomDefinitionService());
return ($this->privates['autowired.Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] ?? $this->getAutowired_Symfony_Component_DependencyInjection_Tests_Fixtures_CustomDefinitionService());
}, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => function (): \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber {
return ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] ?? $this->get('Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'));
return ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] ?? $this->getSymfony_Component_DependencyInjection_Tests_Fixtures_TestServiceSubscriberService());
}, 'bar' => function (): \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition {
return ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] ?? $this->get('Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'));
return ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] ?? $this->getSymfony_Component_DependencyInjection_Tests_Fixtures_TestServiceSubscriberService());
}, 'baz' => function (): \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition {
return ($this->services['autowired.Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] ?? $this->getAutowired_Symfony_Component_DependencyInjection_Tests_Fixtures_CustomDefinitionService());
return ($this->privates['autowired.Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] ?? $this->getAutowired_Symfony_Component_DependencyInjection_Tests_Fixtures_CustomDefinitionService());
})));
}
@ -105,8 +102,8 @@ class ProjectServiceContainer extends Container
*
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition A Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition instance
*/
protected function getAutowired_Symfony_Component_DependencyInjection_Tests_Fixtures_CustomDefinitionService()
private function getAutowired_Symfony_Component_DependencyInjection_Tests_Fixtures_CustomDefinitionService()
{
return $this->services['autowired.Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition();
return $this->privates['autowired.Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition();
}
}