Skip to content

Commit 3af71db

Browse files
committed
bug #38999 [DependencyInjection] autoconfigure behavior describing tags on decorators (xabbuh)
This PR was merged into the 4.4 branch. Discussion ---------- [DependencyInjection] autoconfigure behavior describing tags on decorators | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- 73a3b838b7 autoconfigure behavior describing tags on decorators
2 parents 04ccf9e + 4f4ab74 commit 3af71db

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,14 @@ public function load(array $configs, ContainerBuilder $container)
470470

471471
$container->registerForAutoconfiguration(RouteLoaderInterface::class)
472472
->addTag('routing.route_loader');
473+
474+
$container->setParameter('container.behavior_describing_tags', [
475+
'container.service_locator',
476+
'container.service_subscriber',
477+
'kernel.event_subscriber',
478+
'kernel.locale_aware',
479+
'kernel.reset',
480+
]);
473481
}
474482

475483
/**

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,20 @@ public function testMailer(string $configFile, array $expectedTransports): void
16561656
$this->assertSame(['redirected@example.org', 'redirected1@example.org'], $l->getArgument(1));
16571657
}
16581658

1659+
public function testRegisterParameterCollectingBehaviorDescribingTags()
1660+
{
1661+
$container = $this->createContainerFromFile('default_config');
1662+
1663+
$this->assertTrue($container->hasParameter('container.behavior_describing_tags'));
1664+
$this->assertEquals([
1665+
'container.service_locator',
1666+
'container.service_subscriber',
1667+
'kernel.event_subscriber',
1668+
'kernel.locale_aware',
1669+
'kernel.reset',
1670+
], $container->getParameter('container.behavior_describing_tags'));
1671+
}
1672+
16591673
protected function createContainer(array $data = [])
16601674
{
16611675
return new ContainerBuilder(new EnvPlaceholderParameterBag(array_merge([

0 commit comments

Comments
 (0)