Skip to content

Commit e982ad5

Browse files
committed
[DI] register alias after defining the class
1 parent 308a8c3 commit e982ad5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ChildDefinition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1515
use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
1616

17-
class_alias(ChildDefinition::class, DefinitionDecorator::class);
18-
1917
/**
2018
* This definition extends another definition.
2119
*
@@ -199,3 +197,5 @@ public function replaceArgument($index, $value)
199197
return $this;
200198
}
201199
}
200+
201+
class_alias(ChildDefinition::class, DefinitionDecorator::class);

Tests/ChildDefinitionTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Tests;
1313

1414
use Symfony\Component\DependencyInjection\ChildDefinition;
15+
use Symfony\Component\DependencyInjection\DefinitionDecorator;
1516

1617
class ChildDefinitionTest extends \PHPUnit_Framework_TestCase
1718
{
@@ -125,4 +126,9 @@ public function testGetArgumentShouldCheckBounds()
125126

126127
$def->getArgument(1);
127128
}
129+
130+
public function testDefinitionDecoratorAliasExistsForBackwardsCompatibility()
131+
{
132+
$this->assertInstanceOf(ChildDefinition::class, new DefinitionDecorator('foo'));
133+
}
128134
}

0 commit comments

Comments
 (0)