Skip to content

Named argument binding doesn't support !tagged_locator #34913

@Bilge

Description

@Bilge

Symfony version(s) affected: 4.4.0

Description
Named argument binding doesn't support !tagged_locator.

How to reproduce

services:
    _defaults:
        bind:
            Psr\Container\ContainerInterface $foo: !tagged_locator my.locator

Invalid value for binding key "Psr\Container\ContainerInterface $foo" for service "Some\Unrelated\Service\That\Doesn't\Even\Have$foo\Argument": expected null, an instance of Symfony\Component\DependencyInjection\Reference or an instance of Symfony\Component\DependencyInjection\Definition or an instance of Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument, object given.

Possible Solution
Works fine if type is omitted, e.g. $foo: !tagged_locator my.locator. Breaks as soon as Psr\Container\ContainerInterface is specified as a type prefix, by attempting to inject into every service instead of just those with matching parameters.

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