Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DI][RFC] Allow to check the class of the tagged collection's item #32815

Closed
@vudaltsov

Description

@vudaltsov

Since #30257 we can inject complex tagged collections easily.

The only thing left before PHP gets generics is compile-time checking of the collection item type.

The syntax I propose:

services:
    foo_service:
        class: Foo
        tags:
            - foo

    bar:
        class: Bar
        arguments:
            - !tagged
                tag: foo
                # new attribute
                instanceof: FooInterface

Note that having the foo tag does not imply being an instance of FooInterface.

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