Skip to content

Commit a17a299

Browse files
committed
Merge branch '6.4' into 7.1
* 6.4: Fix Twig deprecation notice [DependencyInjection] Fix issue between decorator and service locator index [AssetMapper] Fix JsDeliver import regexp do not overwrite the host to request
2 parents 32b1c5b + cb127a4 commit a17a299

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Compiler/PriorityTaggedServiceTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ private function findAndSortTaggedServices(string|TaggedIteratorArgument $tagNam
8585
} elseif (null === $defaultIndex && $defaultPriorityMethod && $class) {
8686
$defaultIndex = PriorityTaggedServiceUtil::getDefault($container, $serviceId, $class, $defaultIndexMethod ?? 'getDefaultName', $tagName, $indexAttribute, $checkTaggedItem);
8787
}
88-
$index ??= $defaultIndex ??= $serviceId;
88+
$decorated = $definition->getTag('container.decorator')[0]['id'] ?? null;
89+
$index = $index ?? $defaultIndex ?? $defaultIndex = $decorated ?? $serviceId;
8990

9091
$services[] = [$priority, ++$i, $index, $serviceId, $class];
9192
}

Tests/Compiler/PriorityTaggedServiceTraitTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ public function testTheIndexedTagsByDefaultIndexMethod()
153153

154154
$container->register('service4', HelloInterface::class)->addTag('my_custom_tag');
155155

156+
$definition = $container->register('debug.service5', \stdClass::class)->addTag('my_custom_tag');
157+
$definition->addTag('container.decorator', ['id' => 'service5']);
158+
156159
$priorityTaggedServiceTraitImplementation = new PriorityTaggedServiceTraitImplementation();
157160

158161
$tag = new TaggedIteratorArgument('my_custom_tag', 'foo', 'getFooBar');
@@ -161,6 +164,7 @@ public function testTheIndexedTagsByDefaultIndexMethod()
161164
'service1' => new TypedReference('service1', FooTagClass::class),
162165
'10' => new TypedReference('service3', IntTagClass::class),
163166
'service4' => new TypedReference('service4', HelloInterface::class),
167+
'service5' => new TypedReference('debug.service5', \stdClass::class),
164168
];
165169
$services = $priorityTaggedServiceTraitImplementation->test($tag, $container);
166170
$this->assertSame(array_keys($expected), array_keys($services));

0 commit comments

Comments
 (0)