Skip to content

[DIC] Improve error message when a service is badly configured #31265

@lyrixx

Description

@lyrixx

When making this typo:

    App\Word\WordChecker:
        arguments:
            checkers:
                - '@App\Word\Checker\StaticWordChecker'
                - '@App\Word\Checker\BannedWorldListChecker'

The error is the following:

Invalid service "App\Word\WordChecker": the value of argument "checkers" of method "__construct()" must be null, an instance of Symfony\Component\DependencyInjection\Reference or an instance of Symfony\Component\DependencyInjection\Definition, array given.

Honestly, I don't understand the error. IMHO, we could improve it

We could add Did you forgot to prefix $ to checkers ?

(Question: Did you get the error at the first glance ? 😂 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    DependencyInjectionRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions