feature #24484 [DI] Throw accurate failures when accessing removed services (nicolas-grekas)
This PR was merged into the 3.4 branch.
Discussion
----------
[DI] Throw accurate failures when accessing removed services
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #24444
| License | MIT
| Doc PR | -
See linked issue.
This will throw a useful message when accessing a removed service.
When setting a removed service, a deprecation notice will be thrown also so that in master we can throw an exception then.
Commits
-------
fe7f26d4f3
[DI] Throw accurate failures when accessing removed services
This commit is contained in:
commit
d48bcbfcf6
@ -50,6 +50,7 @@ class Container implements ResettableContainerInterface
|
|||||||
protected $aliases = array();
|
protected $aliases = array();
|
||||||
protected $loading = array();
|
protected $loading = array();
|
||||||
protected $resolving = array();
|
protected $resolving = array();
|
||||||
|
protected $syntheticIds = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -179,31 +180,34 @@ class Container implements ResettableContainerInterface
|
|||||||
throw new InvalidArgumentException('You cannot set service "service_container".');
|
throw new InvalidArgumentException('You cannot set service "service_container".');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->aliases[$id])) {
|
if (isset($this->privates[$id]) || !(isset($this->fileMap[$id]) || isset($this->methodMap[$id]))) {
|
||||||
unset($this->aliases[$id]);
|
if (isset($this->syntheticIds[$id]) || (!isset($this->privates[$id]) && !isset($this->getRemovedIds()[$id]))) {
|
||||||
}
|
// no-op
|
||||||
|
} elseif (null === $service) {
|
||||||
$wasSet = isset($this->services[$id]);
|
|
||||||
$this->services[$id] = $service;
|
|
||||||
|
|
||||||
if (null === $service) {
|
|
||||||
unset($this->services[$id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($this->privates[$id])) {
|
|
||||||
if (null === $service) {
|
|
||||||
@trigger_error(sprintf('The "%s" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED);
|
||||||
unset($this->privates[$id]);
|
unset($this->privates[$id]);
|
||||||
} else {
|
} else {
|
||||||
@trigger_error(sprintf('The "%s" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
} elseif ($wasSet && (isset($this->fileMap[$id]) || isset($this->methodMap[$id]))) {
|
} elseif (isset($this->services[$id])) {
|
||||||
if (null === $service) {
|
if (null === $service) {
|
||||||
@trigger_error(sprintf('The "%s" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED);
|
||||||
} else {
|
} else {
|
||||||
@trigger_error(sprintf('The "%s" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($this->aliases[$id])) {
|
||||||
|
unset($this->aliases[$id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $service) {
|
||||||
|
unset($this->services[$id]);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->services[$id] = $service;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -275,7 +279,7 @@ class Container implements ResettableContainerInterface
|
|||||||
// calling $this->normalizeId($id) unless necessary.
|
// calling $this->normalizeId($id) unless necessary.
|
||||||
for ($i = 2;;) {
|
for ($i = 2;;) {
|
||||||
if (isset($this->privates[$id])) {
|
if (isset($this->privates[$id])) {
|
||||||
@trigger_error(sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.', $id), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.', $id), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
if (isset($this->aliases[$id])) {
|
if (isset($this->aliases[$id])) {
|
||||||
$id = $this->aliases[$id];
|
$id = $this->aliases[$id];
|
||||||
@ -325,6 +329,12 @@ class Container implements ResettableContainerInterface
|
|||||||
if (!$id) {
|
if (!$id) {
|
||||||
throw new ServiceNotFoundException($id);
|
throw new ServiceNotFoundException($id);
|
||||||
}
|
}
|
||||||
|
if (isset($this->syntheticIds[$id])) {
|
||||||
|
throw new ServiceNotFoundException($id, null, null, array(), sprintf('The "%s" service is synthetic, it needs to be set at boot time before it can be used.', $id));
|
||||||
|
}
|
||||||
|
if (isset($this->getRemovedIds()[$id])) {
|
||||||
|
throw new ServiceNotFoundException($id, null, null, array(), sprintf('The "%s" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.', $id));
|
||||||
|
}
|
||||||
|
|
||||||
$alternatives = array();
|
$alternatives = array();
|
||||||
foreach ($this->getServiceIds() as $knownId) {
|
foreach ($this->getServiceIds() as $knownId) {
|
||||||
@ -397,6 +407,16 @@ class Container implements ResettableContainerInterface
|
|||||||
return array_unique(array_merge($ids, array_keys($this->methodMap), array_keys($this->fileMap), array_keys($this->services)));
|
return array_unique(array_merge($ids, array_keys($this->methodMap), array_keys($this->fileMap), array_keys($this->services)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets service ids that existed at compile time.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Camelizes a string.
|
* Camelizes a string.
|
||||||
*
|
*
|
||||||
|
@ -121,6 +121,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
|
|
||||||
private $autoconfiguredInstanceof = array();
|
private $autoconfiguredInstanceof = array();
|
||||||
|
|
||||||
|
private $removedIds = array();
|
||||||
|
|
||||||
public function __construct(ParameterBagInterface $parameterBag = null)
|
public function __construct(ParameterBagInterface $parameterBag = null)
|
||||||
{
|
{
|
||||||
parent::__construct($parameterBag);
|
parent::__construct($parameterBag);
|
||||||
@ -517,7 +519,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id));
|
throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->definitions[$id], $this->aliasDefinitions[$id]);
|
unset($this->definitions[$id], $this->aliasDefinitions[$id], $this->removedIds[$id]);
|
||||||
|
|
||||||
parent::set($id, $service);
|
parent::set($id, $service);
|
||||||
}
|
}
|
||||||
@ -529,7 +531,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
*/
|
*/
|
||||||
public function removeDefinition($id)
|
public function removeDefinition($id)
|
||||||
{
|
{
|
||||||
unset($this->definitions[$this->normalizeId($id)]);
|
if (isset($this->definitions[$id = $this->normalizeId($id)])) {
|
||||||
|
unset($this->definitions[$id]);
|
||||||
|
$this->removedIds[$id] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -793,6 +798,16 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()));
|
return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets removed service or alias ids.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return $this->removedIds;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the service aliases.
|
* Adds the service aliases.
|
||||||
*
|
*
|
||||||
@ -841,7 +856,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias));
|
throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->definitions[$alias]);
|
unset($this->definitions[$alias], $this->removedIds[$alias]);
|
||||||
|
|
||||||
return $this->aliasDefinitions[$alias] = $id;
|
return $this->aliasDefinitions[$alias] = $id;
|
||||||
}
|
}
|
||||||
@ -853,7 +868,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
*/
|
*/
|
||||||
public function removeAlias($alias)
|
public function removeAlias($alias)
|
||||||
{
|
{
|
||||||
unset($this->aliasDefinitions[$this->normalizeId($alias)]);
|
if (isset($this->aliasDefinitions[$alias = $this->normalizeId($alias)])) {
|
||||||
|
unset($this->aliasDefinitions[$alias]);
|
||||||
|
$this->removedIds[$alias] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -981,7 +999,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
|
|
||||||
$id = $this->normalizeId($id);
|
$id = $this->normalizeId($id);
|
||||||
|
|
||||||
unset($this->aliasDefinitions[$id]);
|
unset($this->aliasDefinitions[$id], $this->removedIds[$id]);
|
||||||
|
|
||||||
return $this->definitions[$id] = $definition;
|
return $this->definitions[$id] = $definition;
|
||||||
}
|
}
|
||||||
|
@ -172,6 +172,16 @@ use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
|
|||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
$files = array();
|
$files = array();
|
||||||
|
|
||||||
|
if ($ids = array_keys($this->container->getRemovedIds())) {
|
||||||
|
sort($ids);
|
||||||
|
$c = "<?php\n\nreturn array(\n";
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
$c .= ' '.$this->export($id)." => true,\n";
|
||||||
|
}
|
||||||
|
$files['removed-ids.php'] = $c .= ");\n";
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->generateServiceFiles() as $file => $c) {
|
foreach ($this->generateServiceFiles() as $file => $c) {
|
||||||
$files[$file] = $fileStart.$c;
|
$files[$file] = $fileStart.$c;
|
||||||
}
|
}
|
||||||
@ -888,6 +898,7 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
$code .= $this->addNormalizedIds();
|
$code .= $this->addNormalizedIds();
|
||||||
|
$code .= $this->addSyntheticIds();
|
||||||
$code .= $this->addMethodMap();
|
$code .= $this->addMethodMap();
|
||||||
$code .= $this->asFiles ? $this->addFileMap() : '';
|
$code .= $this->asFiles ? $this->addFileMap() : '';
|
||||||
$code .= $this->addPrivateServices();
|
$code .= $this->addPrivateServices();
|
||||||
@ -896,6 +907,8 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
|
$code .= $this->addRemovedIds();
|
||||||
|
|
||||||
if ($this->container->isCompiled()) {
|
if ($this->container->isCompiled()) {
|
||||||
$code .= <<<EOF
|
$code .= <<<EOF
|
||||||
|
|
||||||
@ -978,6 +991,58 @@ EOF;
|
|||||||
return $code ? " \$this->normalizedIds = array(\n".$code." );\n" : '';
|
return $code ? " \$this->normalizedIds = array(\n".$code." );\n" : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the syntheticIds definition.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function addSyntheticIds()
|
||||||
|
{
|
||||||
|
$code = '';
|
||||||
|
$definitions = $this->container->getDefinitions();
|
||||||
|
ksort($definitions);
|
||||||
|
foreach ($definitions as $id => $definition) {
|
||||||
|
if ($definition->isSynthetic() && 'service_container' !== $id) {
|
||||||
|
$code .= ' '.$this->export($id)." => true,\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $code ? " \$this->syntheticIds = array(\n{$code} );\n" : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the removedIds definition.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function addRemovedIds()
|
||||||
|
{
|
||||||
|
if (!$ids = $this->container->getRemovedIds()) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if ($this->asFiles) {
|
||||||
|
$code = "require __DIR__.'/removed-ids.php'";
|
||||||
|
} else {
|
||||||
|
$code = '';
|
||||||
|
$ids = array_keys($ids);
|
||||||
|
sort($ids);
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
$code .= ' '.$this->export($id)." => true,\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$code = "array(\n{$code} )";
|
||||||
|
}
|
||||||
|
|
||||||
|
return <<<EOF
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return {$code};
|
||||||
|
}
|
||||||
|
|
||||||
|
EOF;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the methodMap property definition.
|
* Adds the methodMap property definition.
|
||||||
*
|
*
|
||||||
|
@ -24,9 +24,11 @@ class ServiceNotFoundException extends InvalidArgumentException implements NotFo
|
|||||||
private $sourceId;
|
private $sourceId;
|
||||||
private $alternatives;
|
private $alternatives;
|
||||||
|
|
||||||
public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = array())
|
public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = array(), $msg = null)
|
||||||
{
|
{
|
||||||
if (null === $sourceId) {
|
if (null !== $msg) {
|
||||||
|
// no-op
|
||||||
|
} elseif (null === $sourceId) {
|
||||||
$msg = sprintf('You have requested a non-existent service "%s".', $id);
|
$msg = sprintf('You have requested a non-existent service "%s".', $id);
|
||||||
} else {
|
} else {
|
||||||
$msg = sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id);
|
$msg = sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id);
|
||||||
|
@ -333,16 +333,28 @@ class ContainerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
|
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
|
||||||
* @expectedExceptionMessage You have requested a non-existent service "request".
|
* @expectedExceptionMessage The "request" service is synthetic, it needs to be set at boot time before it can be used.
|
||||||
*/
|
*/
|
||||||
public function testGetSyntheticServiceThrows()
|
public function testGetSyntheticServiceThrows()
|
||||||
{
|
{
|
||||||
require_once __DIR__.'/Fixtures/php/services9.php';
|
require_once __DIR__.'/Fixtures/php/services9_compiled.php';
|
||||||
|
|
||||||
$container = new \ProjectServiceContainer();
|
$container = new \ProjectServiceContainer();
|
||||||
$container->get('request');
|
$container->get('request');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
|
||||||
|
* @expectedExceptionMessage The "inlined" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.
|
||||||
|
*/
|
||||||
|
public function testGetRemovedServiceThrows()
|
||||||
|
{
|
||||||
|
require_once __DIR__.'/Fixtures/php/services9_compiled.php';
|
||||||
|
|
||||||
|
$container = new \ProjectServiceContainer();
|
||||||
|
$container->get('inlined');
|
||||||
|
}
|
||||||
|
|
||||||
public function testHas()
|
public function testHas()
|
||||||
{
|
{
|
||||||
$sc = new ProjectServiceContainer();
|
$sc = new ProjectServiceContainer();
|
||||||
@ -505,7 +517,7 @@ class ContainerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @expectedDeprecation The "internal" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.
|
* @expectedDeprecation The "internal" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
|
||||||
*/
|
*/
|
||||||
public function testRequestAnInternalSharedPrivateServiceIsDeprecated()
|
public function testRequestAnInternalSharedPrivateServiceIsDeprecated()
|
||||||
{
|
{
|
||||||
|
@ -287,37 +287,17 @@ class PhpDumperTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @expectedDeprecation The "bar" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.
|
* @expectedDeprecation The "decorator_service" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.
|
||||||
*/
|
*/
|
||||||
public function testOverrideServiceWhenUsingADumpedContainer()
|
public function testOverrideServiceWhenUsingADumpedContainer()
|
||||||
{
|
{
|
||||||
require_once self::$fixturesPath.'/php/services9.php';
|
require_once self::$fixturesPath.'/php/services9_compiled.php';
|
||||||
require_once self::$fixturesPath.'/includes/foo.php';
|
|
||||||
|
|
||||||
$container = new \ProjectServiceContainer();
|
$container = new \ProjectServiceContainer();
|
||||||
$container->setParameter('foo_bar', 'foo_bar');
|
$container->get('decorator_service');
|
||||||
$container->get('bar');
|
$container->set('decorator_service', $decorator = new \stdClass());
|
||||||
$container->set('bar', $bar = new \stdClass());
|
|
||||||
|
|
||||||
$this->assertSame($bar, $container->get('bar'), '->set() overrides an already defined service');
|
$this->assertSame($decorator, $container->get('decorator_service'), '->set() overrides an already defined service');
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
* @expectedDeprecation The "bar" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.
|
|
||||||
*/
|
|
||||||
public function testOverrideServiceWhenUsingADumpedContainerAndServiceIsUsedFromAnotherOne()
|
|
||||||
{
|
|
||||||
require_once self::$fixturesPath.'/php/services9.php';
|
|
||||||
require_once self::$fixturesPath.'/includes/foo.php';
|
|
||||||
require_once self::$fixturesPath.'/includes/classes.php';
|
|
||||||
|
|
||||||
$container = new \ProjectServiceContainer();
|
|
||||||
$container->setParameter('foo_bar', 'foo_bar');
|
|
||||||
$container->get('bar');
|
|
||||||
$container->set('bar', $bar = new \stdClass());
|
|
||||||
|
|
||||||
$this->assertSame($bar, $container->get('foo')->bar, '->set() overrides an already defined service');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -799,14 +779,14 @@ class PhpDumperTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
* @expectedDeprecation The "private" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.
|
* @expectedDeprecation The "private" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
|
||||||
* @expectedDeprecation The "private_alias" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.
|
* @expectedDeprecation The "private_alias" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
|
||||||
* @expectedDeprecation The "decorated_private" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.
|
* @expectedDeprecation The "decorated_private" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
|
||||||
* @expectedDeprecation The "decorated_private_alias" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.
|
* @expectedDeprecation The "decorated_private_alias" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
|
||||||
* @expectedDeprecation The "private_not_inlined" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.
|
* @expectedDeprecation The "private_not_inlined" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
|
||||||
* @expectedDeprecation The "private_not_removed" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.
|
* @expectedDeprecation The "private_not_removed" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
|
||||||
* @expectedDeprecation The "private_child" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.
|
* @expectedDeprecation The "private_child" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
|
||||||
* @expectedDeprecation The "private_parent" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop getting services directly from the container and use dependency injection instead.
|
* @expectedDeprecation The "private_parent" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
|
||||||
*/
|
*/
|
||||||
public function testLegacyPrivateServices()
|
public function testLegacyPrivateServices()
|
||||||
{
|
{
|
||||||
|
@ -40,9 +40,6 @@ return function (ContainerConfigurator $c) {
|
|||||||
->args(array(ref('deprecated_service')))
|
->args(array(ref('deprecated_service')))
|
||||||
->share(false);
|
->share(false);
|
||||||
|
|
||||||
$s->alias('alias_for_foo', 'foo')->private()->public();
|
|
||||||
$s->alias('alias_for_alias', ref('alias_for_foo'));
|
|
||||||
|
|
||||||
$s->set('method_call1', 'Bar\FooClass')
|
$s->set('method_call1', 'Bar\FooClass')
|
||||||
->file(realpath(__DIR__.'/../includes/foo.php'))
|
->file(realpath(__DIR__.'/../includes/foo.php'))
|
||||||
->call('setBar', array(ref('foo')))
|
->call('setBar', array(ref('foo')))
|
||||||
@ -125,4 +122,7 @@ return function (ContainerConfigurator $c) {
|
|||||||
$s->set('tagged_iterator', 'Bar')
|
$s->set('tagged_iterator', 'Bar')
|
||||||
->public()
|
->public()
|
||||||
->args(array(tagged('foo')));
|
->args(array(tagged('foo')));
|
||||||
|
|
||||||
|
$s->alias('alias_for_foo', 'foo')->private()->public();
|
||||||
|
$s->alias('alias_for_alias', ref('alias_for_foo'));
|
||||||
};
|
};
|
||||||
|
@ -48,8 +48,6 @@ $container->getParameterBag()->add(array(
|
|||||||
'foo_class' => 'Bar\FooClass',
|
'foo_class' => 'Bar\FooClass',
|
||||||
'foo' => 'bar',
|
'foo' => 'bar',
|
||||||
));
|
));
|
||||||
$container->setAlias('alias_for_foo', 'foo')->setPublic(true);
|
|
||||||
$container->setAlias('alias_for_alias', 'alias_for_foo')->setPublic(true);
|
|
||||||
$container
|
$container
|
||||||
->register('method_call1', 'Bar\FooClass')
|
->register('method_call1', 'Bar\FooClass')
|
||||||
->setFile(realpath(__DIR__.'/../includes/foo.php'))
|
->setFile(realpath(__DIR__.'/../includes/foo.php'))
|
||||||
@ -172,5 +170,7 @@ $container
|
|||||||
->addArgument(new TaggedIteratorArgument('foo'))
|
->addArgument(new TaggedIteratorArgument('foo'))
|
||||||
->setPublic(true)
|
->setPublic(true)
|
||||||
;
|
;
|
||||||
|
$container->setAlias('alias_for_foo', 'foo')->setPublic(true);
|
||||||
|
$container->setAlias('alias_for_alias', 'alias_for_foo')->setPublic(true);
|
||||||
|
|
||||||
return $container;
|
return $container;
|
||||||
|
@ -28,6 +28,14 @@ class Container extends AbstractContainer
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -26,6 +26,14 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -31,6 +31,14 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -35,6 +35,14 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -29,6 +29,15 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
'foo' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -30,6 +30,14 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -29,6 +29,14 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -35,6 +35,14 @@ class Symfony_DI_PhpDumper_Test_EnvParameters extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -34,6 +34,14 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -28,6 +28,14 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -26,6 +26,9 @@ class ProjectServiceContainer extends Container
|
|||||||
'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
|
'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface',
|
||||||
'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
|
'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
|
||||||
);
|
);
|
||||||
|
$this->syntheticIds = array(
|
||||||
|
'request' => true,
|
||||||
|
);
|
||||||
$this->methodMap = array(
|
$this->methodMap = array(
|
||||||
'bar' => 'getBarService',
|
'bar' => 'getBarService',
|
||||||
'baz' => 'getBazService',
|
'baz' => 'getBazService',
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
|
[Container%s/removed-ids.php] => <?php
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
'configurator_service' => true,
|
||||||
|
'configurator_service_simple' => true,
|
||||||
|
'decorated.pif-pouf' => true,
|
||||||
|
'decorator_service.inner' => true,
|
||||||
|
'inlined' => true,
|
||||||
|
'new_factory' => true,
|
||||||
|
);
|
||||||
|
|
||||||
[Container%s/getBarService.php] => <?php
|
[Container%s/getBarService.php] => <?php
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
|
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
|
||||||
@ -286,6 +299,9 @@ class Container%s extends Container
|
|||||||
$this->parameters = $this->getDefaultParameters();
|
$this->parameters = $this->getDefaultParameters();
|
||||||
|
|
||||||
$this->services = array();
|
$this->services = array();
|
||||||
|
$this->syntheticIds = array(
|
||||||
|
'request' => true,
|
||||||
|
);
|
||||||
$this->methodMap = array(
|
$this->methodMap = array(
|
||||||
'foo_bar' => 'getFooBarService',
|
'foo_bar' => 'getFooBarService',
|
||||||
);
|
);
|
||||||
@ -322,6 +338,11 @@ class Container%s extends Container
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return require __DIR__.'/removed-ids.php';
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -24,6 +24,9 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->parameters = $this->getDefaultParameters();
|
$this->parameters = $this->getDefaultParameters();
|
||||||
|
|
||||||
$this->services = array();
|
$this->services = array();
|
||||||
|
$this->syntheticIds = array(
|
||||||
|
'request' => true,
|
||||||
|
);
|
||||||
$this->methodMap = array(
|
$this->methodMap = array(
|
||||||
'bar' => 'getBarService',
|
'bar' => 'getBarService',
|
||||||
'baz' => 'getBazService',
|
'baz' => 'getBazService',
|
||||||
@ -58,6 +61,20 @@ class ProjectServiceContainer extends Container
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
'configurator_service' => true,
|
||||||
|
'configurator_service_simple' => true,
|
||||||
|
'decorated.pif-pouf' => true,
|
||||||
|
'decorator_service.inner' => true,
|
||||||
|
'inlined' => true,
|
||||||
|
'new_factory' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -35,6 +35,14 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -28,6 +28,14 @@ class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -55,6 +55,17 @@ class Symfony_DI_PhpDumper_Test_Legacy_Privates extends Container
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
'foo' => true,
|
||||||
|
'private_alias_decorator.inner' => true,
|
||||||
|
'private_decorator.inner' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -40,6 +40,17 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
'translator.loader_1_locator' => true,
|
||||||
|
'translator.loader_2_locator' => true,
|
||||||
|
'translator.loader_3_locator' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -34,6 +34,14 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -33,6 +33,15 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
'private_bar' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -35,6 +35,14 @@ class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -38,6 +38,15 @@ class ProjectServiceContainer extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
'service_locator.jmktfsv' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -35,6 +35,15 @@ class Symfony_DI_PhpDumper_Test_Uninitialized_Reference extends Container
|
|||||||
$this->aliases = array();
|
$this->aliases = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRemovedIds()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
|
'foo2' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
throw new LogicException('You cannot compile a dumped container that was already compiled.');
|
||||||
|
@ -43,8 +43,6 @@
|
|||||||
</argument>
|
</argument>
|
||||||
</call>
|
</call>
|
||||||
</service>
|
</service>
|
||||||
<service id="alias_for_foo" alias="foo" />
|
|
||||||
<service id="another_alias_for_foo" alias="foo" public="false" />
|
|
||||||
<service id="request" class="Request" synthetic="true" lazy="true"/>
|
<service id="request" class="Request" synthetic="true" lazy="true"/>
|
||||||
<service id="decorator_service" decorates="decorated" />
|
<service id="decorator_service" decorates="decorated" />
|
||||||
<service id="decorator_service_with_name" decorates="decorated" decoration-inner-name="decorated.pif-pouf"/>
|
<service id="decorator_service_with_name" decorates="decorated" decoration-inner-name="decorated.pif-pouf"/>
|
||||||
@ -61,5 +59,7 @@
|
|||||||
<service id="new_factory4" class="BazClass">
|
<service id="new_factory4" class="BazClass">
|
||||||
<factory method="getInstance" />
|
<factory method="getInstance" />
|
||||||
</service>
|
</service>
|
||||||
|
<service id="alias_for_foo" alias="foo" />
|
||||||
|
<service id="another_alias_for_foo" alias="foo" public="false" />
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
@ -17,16 +17,10 @@ services:
|
|||||||
class: FooClass
|
class: FooClass
|
||||||
calls:
|
calls:
|
||||||
- [ setBar, [ foo, '@foo', [true, false] ] ]
|
- [ setBar, [ foo, '@foo', [true, false] ] ]
|
||||||
alias_for_foo: '@foo'
|
|
||||||
another_alias_for_foo:
|
|
||||||
alias: foo
|
|
||||||
public: false
|
|
||||||
request:
|
request:
|
||||||
class: Request
|
class: Request
|
||||||
synthetic: true
|
synthetic: true
|
||||||
lazy: true
|
lazy: true
|
||||||
another_third_alias_for_foo:
|
|
||||||
alias: foo
|
|
||||||
decorator_service:
|
decorator_service:
|
||||||
decorates: decorated
|
decorates: decorated
|
||||||
decorator_service_with_name:
|
decorator_service_with_name:
|
||||||
@ -41,3 +35,9 @@ services:
|
|||||||
new_factory3: { class: FooBarClass, factory: [BazClass, getInstance]}
|
new_factory3: { class: FooBarClass, factory: [BazClass, getInstance]}
|
||||||
new_factory4: { class: BazClass, factory: [~, getInstance]}
|
new_factory4: { class: BazClass, factory: [~, getInstance]}
|
||||||
Acme\WithShortCutArgs: [foo, '@baz']
|
Acme\WithShortCutArgs: [foo, '@baz']
|
||||||
|
alias_for_foo: '@foo'
|
||||||
|
another_alias_for_foo:
|
||||||
|
alias: foo
|
||||||
|
public: false
|
||||||
|
another_third_alias_for_foo:
|
||||||
|
alias: foo
|
||||||
|
@ -139,12 +139,6 @@ services:
|
|||||||
class: LazyContext
|
class: LazyContext
|
||||||
arguments: [!iterator ['@foo.baz', '@?invalid'], !iterator []]
|
arguments: [!iterator ['@foo.baz', '@?invalid'], !iterator []]
|
||||||
public: true
|
public: true
|
||||||
alias_for_foo:
|
|
||||||
alias: 'foo'
|
|
||||||
public: true
|
|
||||||
alias_for_alias:
|
|
||||||
alias: 'foo'
|
|
||||||
public: true
|
|
||||||
tagged_iterator_foo:
|
tagged_iterator_foo:
|
||||||
class: Bar
|
class: Bar
|
||||||
tags:
|
tags:
|
||||||
@ -161,3 +155,9 @@ services:
|
|||||||
Symfony\Component\DependencyInjection\ContainerInterface:
|
Symfony\Component\DependencyInjection\ContainerInterface:
|
||||||
alias: service_container
|
alias: service_container
|
||||||
public: false
|
public: false
|
||||||
|
alias_for_foo:
|
||||||
|
alias: 'foo'
|
||||||
|
public: true
|
||||||
|
alias_for_alias:
|
||||||
|
alias: 'foo'
|
||||||
|
public: true
|
||||||
|
Reference in New Issue
Block a user