Skip to content

Support tag for AutowireLocatorΒ #376

Description

@pkly

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions