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
bug #31463 [DI] default to service id - *not* FQCN - when building tagged locators (nicolas-grekas)
This PR was merged into the 4.3 branch.
Discussion
----------
[DI] default to service id - *not* FQCN - when building tagged locators
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | -
| License | MIT
| Doc PR | -
While reviewing #30926 I realized that defaulting to the FQCN is a shortcut that isn't useful enough.
Defaulting to the service id provides the same experience in practice because service ids are FQCN by default.
But when they aren't, the service id is the proper index to default to when building the locator.
Commits
-------
52e827c [DI] default to service id - *not* FQCN - when building tagged locators
Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Argument/TaggedIteratorArgument.php
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -21,22 +21,26 @@ class TaggedIteratorArgument extends IteratorArgument
21
21
private$tag;
22
22
private$indexAttribute;
23
23
private$defaultIndexMethod;
24
-
private$useFqcnAsFallback = false;
24
+
private$needsIndexes = false;
25
25
26
26
/**
27
27
* @param string $tag The name of the tag identifying the target services
28
28
* @param string|null $indexAttribute The name of the attribute that defines the key referencing each service in the tagged collection
29
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
30
+
* @param bool $needsIndexes Whether indexes are required and should be generated when computing the map
$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)));
$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