Skip to content

Commit 01dcf14

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [Validator] Add Catalan and Spanish translation for `WordCount` constraint" [DependencyInjection] Do not try to load default method name on interface [PropertyInfo] Fix nullable value returned from extractFromMutator on CollectionType
2 parents 1a97831 + 5caf9c5 commit 01dcf14

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Compiler/PriorityTaggedServiceTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ public static function getDefault(ContainerBuilder $container, string $serviceId
133133
return null;
134134
}
135135

136+
if ($r->isInterface()) {
137+
return null;
138+
}
139+
136140
if (null !== $indexAttribute) {
137141
$service = $class !== $serviceId ? sprintf('service "%s"', $serviceId) : 'on the corresponding service';
138142
$message = [sprintf('Either method "%s::%s()" should ', $class, $defaultMethod), sprintf(' or tag "%s" on %s is missing attribute "%s".', $tagName, $service, $indexAttribute)];

Tests/Compiler/PriorityTaggedServiceTraitTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,16 @@ public function testTheIndexedTagsByDefaultIndexMethod()
151151

152152
$container->register('service3', IntTagClass::class)->addTag('my_custom_tag');
153153

154+
$container->register('service4', HelloInterface::class)->addTag('my_custom_tag');
155+
154156
$priorityTaggedServiceTraitImplementation = new PriorityTaggedServiceTraitImplementation();
155157

156158
$tag = new TaggedIteratorArgument('my_custom_tag', 'foo', 'getFooBar');
157159
$expected = [
158160
'bar_tab_class_with_defaultmethod' => new TypedReference('service2', BarTagClass::class),
159161
'service1' => new TypedReference('service1', FooTagClass::class),
160162
'10' => new TypedReference('service3', IntTagClass::class),
163+
'service4' => new TypedReference('service4', HelloInterface::class),
161164
];
162165
$services = $priorityTaggedServiceTraitImplementation->test($tag, $container);
163166
$this->assertSame(array_keys($expected), array_keys($services));
@@ -247,3 +250,8 @@ class HelloNamedService extends \stdClass
247250
class HelloNamedService2
248251
{
249252
}
253+
254+
interface HelloInterface
255+
{
256+
public static function getFooBar(): string;
257+
}

0 commit comments

Comments
 (0)