Skip to content

[ServiceContainer] Php example does not work #22154

@Fan2Shrek

Description

@Fan2Shrek

Hello,

Regarding the documentation example:
https://symfony.com/doc/current/service_container.html#binding-arguments-by-name-or-type

The following configuration example does not appear to work:

return App::config([
    'services' => [
        '_defaults' => [
            'bind' => [
                'iterable $rules' => tagged_iterator('app.foo.rule'),
            ],
        ],
    ],
]);

According to the documentation, this should inject all services tagged with app.foo.rule into the $rules iterable.

However, it throws the following error:

Image

Am I missing something in the configuration, or is the documentation example incorrect?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions