You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Argument/TaggedIteratorArgument.php
+11-6Lines changed: 11 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -21,22 +21,22 @@ class TaggedIteratorArgument extends IteratorArgument
21
21
private$tag;
22
22
private$indexAttribute;
23
23
private$defaultIndexMethod;
24
+
private$useFqcnAsFallback = false;
24
25
25
26
/**
26
27
* @param string $tag The name of the tag identifying the target services
27
28
* @param string|null $indexAttribute The name of the attribute that defines the key referencing each service in the tagged collection
28
29
* @param string|null $defaultIndexMethod The static method that should be called to get each service's key when their tag doesn't define the previous attribute
30
+
* @param bool $useFqcnAsFallback Whether the FQCN of the service should be used as index when neither the attribute nor the method are defined
thrownewInvalidArgumentException(sprintf('Method "%s::%s()" not found: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
72
87
}
73
88
@@ -85,7 +100,7 @@ private function findAndSortTaggedServices($tagName, ContainerBuilder $container
85
100
thrownewInvalidArgumentException(sprintf('Method "%s::%s()" should return a string, got %s: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, \gettype($key), $tagName, $serviceId, $indexAttribute));
thrownewInvalidArgumentException(sprintf('Tag "<%s>" with type="service_locator" only accepts maps of type="service" references in "%s".', $name, $file));
534
534
}
535
535
break;
536
+
case'tagged':
536
537
case'tagged_locator':
537
-
if (!$arg->getAttribute('tag') || !$arg->getAttribute('index-by')) {
538
-
thrownewInvalidArgumentException(sprintf('Tag "<%s>" with type="tagged_locator" has no or empty "tag" or "index-by" attributes in "%s".', $name, $file));
$this->assertTrue($s->getParam() instanceof ServiceLocator, sprintf('Wrong instance, should be an instance of ServiceLocator, %s given', \is_object($serviceLocator) ? \get_class($serviceLocator) : \gettype($serviceLocator)));
0 commit comments