Skip to content

Commit 6b40a9f

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: (64 commits) Show exception is checked twice in ExceptionController of twig allow SSI fragments configuration in XML files Display a better error message when the toolbar cannot be displayed render hidden _method field in form_rest() Add Doctrine Cache to dev dependencies to fix failing unit tests. return fallback locales whenever possible Fix Predis client cluster with pipeline [Dotenv] Test load() with multiple paths [Console] Fix catching exception type in QuestionHelper Improved the exception page when there is no message [WebProfilerBundle] Eliminate line wrap on count columnt (routing) [Validator] replace hardcoded service id [Routing] Fix XmlFileLoader exception message [DI] Dedup tags when using instanceof/autoconfigure [Translation] Fix FileLoader::loadResource() php doc Sessions: configurable "use_strict_mode" option for NativeSessionStorage [FrameworkBundle] [Command] Clean bundle directory, fixes #23177 fixed CS [WebProfilerBundle] Fix the icon for the Cache panel [WebServerBundle] Fix router script path and check existence ...
2 parents 25f7a9a + 986a633 commit 6b40a9f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Compiler/ResolveInstanceofConditionalsPass.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ private function processDefinition(ContainerBuilder $container, $id, Definition
107107
while (0 <= --$i) {
108108
foreach ($instanceofTags[$i] as $k => $v) {
109109
foreach ($v as $v) {
110+
if ($definition->hasTag($k) && in_array($v, $definition->getTag($k))) {
111+
continue;
112+
}
110113
$definition->addTag($k, $v);
111114
}
112115
}

Tests/Compiler/ResolveInstanceofConditionalsPassTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,29 @@ public function testProcessUsesAutoconfiguredInstanceof()
130130
$this->assertSame(array('local_instanceof_tag' => array(array()), 'autoconfigured_tag' => array(array())), $def->getTags());
131131
}
132132

133+
public function testAutoconfigureInstanceofDoesNotDuplicateTags()
134+
{
135+
$container = new ContainerBuilder();
136+
$def = $container->register('normal_service', self::class);
137+
$def
138+
->addTag('duplicated_tag')
139+
->addTag('duplicated_tag', array('and_attributes' => 1))
140+
;
141+
$def->setInstanceofConditionals(array(
142+
parent::class => (new ChildDefinition(''))->addTag('duplicated_tag'),
143+
));
144+
$def->setAutoconfigured(true);
145+
$container->registerForAutoconfiguration(parent::class)
146+
->addTag('duplicated_tag', array('and_attributes' => 1))
147+
;
148+
149+
(new ResolveInstanceofConditionalsPass())->process($container);
150+
(new ResolveDefinitionTemplatesPass())->process($container);
151+
152+
$def = $container->getDefinition('normal_service');
153+
$this->assertSame(array('duplicated_tag' => array(array(), array('and_attributes' => 1))), $def->getTags());
154+
}
155+
133156
public function testProcessDoesNotUseAutoconfiguredInstanceofIfNotEnabled()
134157
{
135158
$container = new ContainerBuilder();

0 commit comments

Comments
 (0)