[DI] register alias after defining the class

This commit is contained in:
Christian Flothmann 2016-12-29 16:20:01 +01:00
parent 64e1da0581
commit d8d44170f0
2 changed files with 8 additions and 2 deletions

View File

@ -14,8 +14,6 @@ namespace Symfony\Component\DependencyInjection;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException; use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
class_alias(ChildDefinition::class, DefinitionDecorator::class);
/** /**
* This definition extends another definition. * This definition extends another definition.
* *
@ -199,3 +197,5 @@ class ChildDefinition extends Definition
return $this; return $this;
} }
} }
class_alias(ChildDefinition::class, DefinitionDecorator::class);

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests; namespace Symfony\Component\DependencyInjection\Tests;
use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
class ChildDefinitionTest extends \PHPUnit_Framework_TestCase class ChildDefinitionTest extends \PHPUnit_Framework_TestCase
{ {
@ -125,4 +126,9 @@ class ChildDefinitionTest extends \PHPUnit_Framework_TestCase
$def->getArgument(1); $def->getArgument(1);
} }
public function testDefinitionDecoratorAliasExistsForBackwardsCompatibility()
{
$this->assertInstanceOf(ChildDefinition::class, new DefinitionDecorator('foo'));
}
} }