Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DependencyInjection] Replace TaggedIterator and TaggedLocator by AutowireIterator and AutowireLocator #20775

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions service_container/service_subscribers_locators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ the following dependency injection attributes in the ``getSubscribedServices()``
method directly:

* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Autowire`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Target`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireDecorated`

Expand All @@ -282,8 +282,8 @@ This is done by having ``getSubscribedServices()`` return an array of
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
use Symfony\Component\DependencyInjection\Attribute\TaggedLocator;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator;
use Symfony\Component\DependencyInjection\Attribute\Target;
use Symfony\Contracts\Service\Attribute\SubscribedService;

Expand All @@ -299,11 +299,11 @@ This is done by having ``getSubscribedServices()`` return an array of
// Target
new SubscribedService('event.logger', LoggerInterface::class, attributes: new Target('eventLogger')),

// TaggedIterator
new SubscribedService('loggers', 'iterable', attributes: new TaggedIterator('logger.tag')),
// AutowireIterator
new SubscribedService('loggers', 'iterable', attributes: new AutowireIterator('logger.tag')),

// TaggedLocator
new SubscribedService('handlers', ContainerInterface::class, attributes: new TaggedLocator('handler.tag')),
// AutowireLocator
new SubscribedService('handlers', ContainerInterface::class, attributes: new AutowireLocator('handler.tag')),
];
}

Expand Down Expand Up @@ -975,8 +975,8 @@ You can use the ``attributes`` argument of ``SubscribedService`` to add any
of the following dependency injection attributes:

* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Autowire`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Target`
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireDecorated`

Expand Down
2 changes: 1 addition & 1 deletion service_container/tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ directly via PHP attributes:

.. note::

Some IDEs will show an error when using ``#[TaggedIterator]`` together
Some IDEs will show an error when using ``#[AutowireIterator]`` together
with the `PHP constructor promotion`_:
*"Attribute cannot be applied to a property because it does not contain the 'Attribute::TARGET_PROPERTY' flag"*.
The reason is that those constructor arguments are both parameters and class
Expand Down