Skip to content

Commit ba932ae

Browse files
committed
minor #21096 [DependencyInjection] register alias after defining the class (xabbuh)
This PR was merged into the 3.3-dev branch. Discussion ---------- [DependencyInjection] register alias after defining the class | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- d8d4417 [DI] register alias after defining the class
2 parents 64e1da0 + d8d4417 commit ba932ae

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Symfony/Component/DependencyInjection/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);

src/Symfony/Component/DependencyInjection/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)