Skip to content

[DependencyInjection] Bad error message for unused bind under _defaults #27828

Closed
@weaverryan

Description

@weaverryan

Symfony version(s) affected: 3.4

How to reproduce

Bind a value beneath _defaults or _instanceof:

# config/services.yaml
services:
    _defaults:
        # ...
        bind:
            $variableName: 'someValue'

If this bind is not actually used, the error is attached to the last service that the rule was applied to. So, something like:

Unused binding "$variableName" in service ".abstract.instanceof.App\Twig\AppExtension".

A better error would be:

You have a "bind" configured for an argument named $variableName. But, this argument was not found in any of the services it was applied to. The bind may be unused and can be removed. Or, the bind may have a typo.

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