From d8d44170f0816520b87a09d9282fd22804b2fd7f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 29 Dec 2016 16:20:01 +0100 Subject: [PATCH] [DI] register alias after defining the class --- .../Component/DependencyInjection/ChildDefinition.php | 4 ++-- .../DependencyInjection/Tests/ChildDefinitionTest.php | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/ChildDefinition.php b/src/Symfony/Component/DependencyInjection/ChildDefinition.php index 53a1d188a0e90..b157642bd3060 100644 --- a/src/Symfony/Component/DependencyInjection/ChildDefinition.php +++ b/src/Symfony/Component/DependencyInjection/ChildDefinition.php @@ -14,8 +14,6 @@ use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException; -class_alias(ChildDefinition::class, DefinitionDecorator::class); - /** * This definition extends another definition. * @@ -199,3 +197,5 @@ public function replaceArgument($index, $value) return $this; } } + +class_alias(ChildDefinition::class, DefinitionDecorator::class); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php index 8f89e3b626da4..1b84cf90bb993 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ChildDefinitionTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\DependencyInjection\Tests; use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\DefinitionDecorator; class ChildDefinitionTest extends \PHPUnit_Framework_TestCase { @@ -125,4 +126,9 @@ public function testGetArgumentShouldCheckBounds() $def->getArgument(1); } + + public function testDefinitionDecoratorAliasExistsForBackwardsCompatibility() + { + $this->assertInstanceOf(ChildDefinition::class, new DefinitionDecorator('foo')); + } }