diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 48267b0d03..5e2f7d2dd4 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1226,7 +1226,7 @@ EOF; $methodNameAlias = $this->generateMethodName($alias); $idExported = $this->export($id); $messageExported = $this->export($definition->getDeprecationMessage($alias)); - $code = <<docStar} * Gets the $public '$alias' alias. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index b78fcb32e4..d0fb5ab8c6 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -1283,6 +1283,30 @@ class PhpDumperTest extends TestCase $wither = $container->get('wither'); $this->assertInstanceOf(Foo::class, $wither->foo); } + + /** + * @group legacy + * @expectedDeprecation The "deprecated1" service alias is deprecated. You should stop using it, as it will be removed in the future. + * @expectedDeprecation The "deprecated2" service alias is deprecated. You should stop using it, as it will be removed in the future. + */ + public function testMultipleDeprecatedAliasesWorking() + { + $container = new ContainerBuilder(); + $container->setDefinition('bar', new Definition('stdClass'))->setPublic(true); + $container->setAlias('deprecated1', 'bar')->setPublic(true)->setDeprecated('%alias_id% is deprecated'); + $container->setAlias('deprecated2', 'bar')->setPublic(true)->setDeprecated('%alias_id% is deprecated'); + $container->compile(); + + $dumper = new PhpDumper($container); + $dump = $dumper->dump(['class' => $class = __FUNCTION__]); + + eval('?>'.$dump); + $container = new $class(); + + $this->assertInstanceOf(\stdClass::class, $container->get('bar')); + $this->assertInstanceOf(\stdClass::class, $container->get('deprecated1')); + $this->assertInstanceOf(\stdClass::class, $container->get('deprecated2')); + } } class Rot13EnvVarProcessor implements EnvVarProcessorInterface