-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Milestone
Description
Symfony version(s) affected: 4.3.2+
Description
Using the !tagged
handler in YAML service definitions throws
Notice: Undefined index: index_by
How to reproduce
Define any service with:
App\MyService:
$tagged: !tagged_iterator {tag: test.tag}
Please note that the string version works:
App\MyService:
$tagged: !tagged_iterator test.tag
Possible Solution
Although the key seems to be optional (at least all the docs tell me it should be) there is no fallback in the array access.
This line:
$argument = new TaggedIteratorArgument($argument['tag'], $argument['index_by'], $argument['default_index_method'] ?? null, $forLocator);
should probably be
$argument = new TaggedIteratorArgument($argument['tag'], $argument['index_by'] ?? null, $argument['default_index_method'] ?? null, $forLocator);
// ^^^^^^^^
Additional context