Skip to content

[DependencyInjection] Symfony 7.4 tagged_locator with default-index-method getType throws error #62374

@alexander-schranz

Description

@alexander-schranz

Symfony version(s) affected

7.4-dev (something merged into 7.4 between 2025-11-12 14:00 and today 2025-11-13 08:00)
7.3-dev

It seems related to: #62329

Description

During run a CI against 7.4 I stumbled over following error. https://github.com/sulu/SuluThemeBundle/actions/runs/19323576704/job/55269640877?pr=37

Either method "Sulu\Bundle\ContactBundle\Infrastructure\Sulu\Content\SmartContent\ContactSmartContentProvider::getType()"
should be static or tag "sulu_content.smart_content_provider"
on service "sulu_contact.contact_smart_content_provider"
is missing attribute "type".      

This error does not happening on 7.3 and 6.4 currently and looks like accidently added error.

How to reproduce

The service is:

<service id="sulu_content.smart_content_smart_resolver"
         class="Sulu\Content\Application\SmartResolver\Resolver\SmartContentSmartResolver">
    <argument
        type="tagged_locator"
        tag="sulu_content.smart_content_provider"
        default-index-method="getType"
        index-by="type"
    />
    <!- ... -->
</service>

and the injected service is:

<service id="sulu_contact.contact_smart_content_provider" class="Sulu\Bundle\ContactBundle\Infrastructure\Sulu\Content\SmartContent\ContactSmartContentProvider">
    <!- ... -->

    <tag name="sulu_content.smart_content_provider" type="contacts"/>
</service>

As you see the type is defined via <tag> and so this error should not happening.

I'm unsure if getType previously could have been unstatic, but currently is in our case, but as we defined always on a tag level the type should be got from there.

Possible Solution

No response

Additional Context

Looks like it must be something merged today or yesterday to 7.4-dev.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions