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

[Config] Add configurable AutowireAttributeRector to add #[Autowire(...)] to services #637

Merged
merged 8 commits into from
Jul 4, 2024

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Jul 4, 2024

This is amazing feature from Symfony 6.1: https://symfony.com/blog/new-in-symfony-6-1-service-autowiring-attributes

All you need to do is provide path to your /config directory and rule is ready to go 👍

// rector.php
use Rector\Config\RectorConfig;
use Rector\Symfony\Configs\Rector\Class_\AutowireAttributeRector;

return RectorConfig::configure()
    ->withConfiguredRule(AutowireAttributeRector::class, [
        AutowireAttributeRector::CONFIGS_DIRECTORY => __DIR__ . '/configs',
    ]);

@TomasVotruba TomasVotruba changed the title tv autowire attribute [Config] Add configurable AutowireAttributeRector to add #[Autowire(...)] to services Jul 4, 2024
@TomasVotruba TomasVotruba merged commit 1fcf66e into main Jul 4, 2024
5 checks passed
@TomasVotruba TomasVotruba deleted the tv-autowire-attribute branch July 4, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant