Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Feature Request] Tagged iterators without tags! #53090

Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
@sylfabre

Description

@sylfabre
Issue body actions

Description

I use tagged iterators mostly to autowire implementations of a given interface as an iterable.

#[AutoconfigureTag('app.some_tag')]
interface SomeInterface
{
    ...
}

class SomeService
{
    public function __construct(
        /** @var SomeInterface[] */
        #[TaggedIterator('app.some_tag')]
        protected iterable $somes
    ) {
    }
}

It works great 👍
And I understand I have to provide a tag because this is how the system works today ✅
And I understand that the tag may be useful for other use cases ✅
However, from a developer's POV, I don't care about what this tag is 99% of the time so I would like it to be optional.

Example

It would be amazing if this simpler code was working 🤩

class SomeService
{
    public function __construct(
        /** @var SomeInterface[] */
        #[InterfaceIterator(SomeInterface::class)]
        protected iterable $somes
    ) {
    }
}

Or if it makes it easier to implement

#[AutoconfigureForIterable]
interface SomeInterface
{
    ...
}
class SomeService
{
    public function __construct(
        /** @var SomeInterface[] */
        #[InterfaceIterator(SomeInterface::class)]
        protected iterable $somes
    ) {
    }
}

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.