Enable auto alias compiler pass by default
This commit is contained in:
parent
ae00ff4cfa
commit
4fde51745b
@ -49,6 +49,7 @@ class PassConfig
|
|||||||
];
|
];
|
||||||
|
|
||||||
$this->optimizationPasses = [[
|
$this->optimizationPasses = [[
|
||||||
|
new AutoAliasServicePass(),
|
||||||
new ValidateEnvPlaceholdersPass(),
|
new ValidateEnvPlaceholdersPass(),
|
||||||
new ResolveChildDefinitionsPass(),
|
new ResolveChildDefinitionsPass(),
|
||||||
new RegisterServiceSubscribersPass(),
|
new RegisterServiceSubscribersPass(),
|
||||||
|
@ -1601,6 +1601,24 @@ class ContainerBuilderTest extends TestCase
|
|||||||
$wither = $container->get('wither');
|
$wither = $container->get('wither');
|
||||||
$this->assertInstanceOf(Foo::class, $wither->foo);
|
$this->assertInstanceOf(Foo::class, $wither->foo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAutoAliasing()
|
||||||
|
{
|
||||||
|
$container = new ContainerBuilder();
|
||||||
|
$container->register(C::class);
|
||||||
|
$container->register(D::class);
|
||||||
|
|
||||||
|
$container->setParameter('foo', D::class);
|
||||||
|
|
||||||
|
$definition = new Definition(X::class);
|
||||||
|
$definition->setPublic(true);
|
||||||
|
$definition->addTag('auto_alias', ['format' => '%foo%']);
|
||||||
|
$container->setDefinition(X::class, $definition);
|
||||||
|
|
||||||
|
$container->compile();
|
||||||
|
|
||||||
|
$this->assertInstanceOf(D::class, $container->get(X::class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class FooClass
|
class FooClass
|
||||||
@ -1617,3 +1635,15 @@ class B
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface X
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
class C implements X
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
class D implements X
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user