Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@
$phpAttributes = [];
}

$attributes = array_values($attributes);
for ($i = 0; $i < \count($attributes); ++$i) {
if (!($attribute = $attributes[$i]) && $phpAttributes) {

Check failure on line 86 in src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

InvalidArrayOffset

src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php:86:36: InvalidArrayOffset: Cannot access value on variable $attributes using a int<min, 1> offset, expecting int<0, max> (see https://psalm.dev/115)

Check failure on line 86 in src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

InvalidArrayOffset

src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php:86:36: InvalidArrayOffset: Cannot access value on variable $attributes using a int<min, 1> offset, expecting int<0, max> (see https://psalm.dev/115)
array_splice($attributes, $i--, 1, $phpAttributes);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,21 @@ public function testMultiTagsWithMixedAttributesAndNonStaticDefault()
$this->assertArrayHasKey('foo', $services);
$this->assertArrayHasKey('default', $services);
}

public function testTagAttributesAreNotAList()
{
$container = new ContainerBuilder();
$container->register('service1')->setTags([
'my_custom_tag' => [1 => ['attributes' => 'not_a_list']],
]);

$priorityTaggedServiceTraitImplementation = new PriorityTaggedServiceTraitImplementation();

$expected = [
new Reference('service1'),
];
$this->assertEquals($expected, $priorityTaggedServiceTraitImplementation->test('my_custom_tag', $container));
}
}

class PriorityTaggedServiceTraitImplementation
Expand Down
Loading