Hey, I just noticed in our codebase after disabling tests marking code as used that a bunch of classes implementing interfaces no longer show as used, even though they are.
I traced it back to here
|
if (!isset($arguments['services']) || (!isset($arguments['defaultIndexMethod']) && !isset($arguments['defaultPriorityMethod']))) { |
This bit doesn't support services by indexes. A combination of tag + indexAttribute (or no indexAttribute) can be used here to search for services with that tag and then mark them as used in terms of methods being used in the class, where the locator pulls out a service and calls on it (presumably an interface method).
We often use something like this
#[AutowireLocator('app.tagged.handler', indexAttribute: 'type')] private readonly ServiceLocator $handlersLocator,
so if this would be supported it'd be great.
Hey, I just noticed in our codebase after disabling tests marking code as used that a bunch of classes implementing interfaces no longer show as used, even though they are.
I traced it back to here
dead-code-detector/src/Provider/SymfonyUsageProvider.php
Line 547 in 021aa21
This bit doesn't support services by indexes. A combination of tag + indexAttribute (or no indexAttribute) can be used here to search for services with that tag and then mark them as used in terms of methods being used in the class, where the locator pulls out a service and calls on it (presumably an interface method).
We often use something like this
so if this would be supported it'd be great.