TaggedLocatorToAutowireLocatorRector
Replace #[TaggedLocator] with #[AutowireLocator], renaming the "tag" named argument to "services"
-use Symfony\Component\DependencyInjection\Attribute\TaggedLocator;
use Symfony\Component\DependencyInjection\ServiceLocator;
final class SomeService
{
public function __construct(
- #[TaggedLocator(tag: 'app.handler')]
+ #[\Symfony\Component\DependencyInjection\Attribute\AutowireLocator(services: 'app.handler')]
private ServiceLocator $handlers
) {
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony80\Rector\Attribute\TaggedLocatorToAutowireLocatorRector;
return RectorConfig::configure()
->withRules([
TaggedLocatorToAutowireLocatorRector::class,
]);
PACKAGE:
symfony/dependency-injection >=7.1