[DI] register alias after defining the class
This commit is contained in:
parent
64e1da0581
commit
d8d44170f0
@ -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);
|
||||||
|
@ -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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user