i want to use Rector for refactoring my code because i update my project to symfony 5.4 to 6.1. My php project version : 8.1.5
So, i want to use a simple rule who change my annotation to attribut with rector. but when i execute rector with command : vendor/bin/rector process src
rector inform me : [OK] Rector is done!
But my file don't change, my entity annotation don't change. i try to follow this documentation for config my rector.php and use rector with symfony.
https://github.com/rectorphp/rector-symfony
https://github.com/rectorphp/rector
what i do wrong ?
this is my rector.php
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Php80\ValueObject\AnnotationToAttribute;
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
use Rector\Symfony\Rector\MethodCall\StringFormTypeToClassRector;
use Rector\Symfony\Rector\Class_\CommandPropertyToAttributeRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src'
]);
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon');
$rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml');
$rectorConfig->ruleWithConfiguration(
AnnotationToAttributeRector::class,
[new AnnotationToAttribute('Symfony\Routing\Annotation\Route')]
);
// register a single rule
//$rectorConfig->rule(CommandPropertyToAttributeRector::class);
// define sets of rules
/* $rectorConfig->sets([
SymfonySetList::SYMFONY_60,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
]);*/
};
this is my composer.json
{
"type": "project",
"license": "proprietary",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "1.11.99.1",
"doctrine/annotations": "^1.12",
"doctrine/dbal": "^2.0",
"doctrine/doctrine-bundle": "^2.2",
"doctrine/doctrine-fixtures-bundle": "^3.4",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.8",
"fakerphp/faker": "^1.19",
"gedmo/doctrine-extensions": "^3.8",
"giggsey/libphonenumber-for-php": "^8.12",
"knplabs/knp-paginator-bundle": "^5.3",
"phpdocumentor/reflection-docblock": "^5.2",
"sensio/framework-extra-bundle": "^6.2",
"symfony/asset": "6.1.*",
"symfony/console": "6.1.*",
"symfony/doctrine-bridge": "6.1.*",
"symfony/dotenv": "6.1.*",
"symfony/expression-language": "6.1.*",
"symfony/flex": "^1.3.1",
"symfony/form": "6.1.*",
"symfony/framework-bundle": "6.1.*",
"symfony/http-client": "6.1.*",
"symfony/http-foundation": "6.1.*",
"symfony/intl": "6.1.*",
"symfony/mailer": "6.1.*",
"symfony/mime": "6.1.*",
"symfony/monolog-bundle": "^3.1",
"symfony/notifier": "6.1.*",
"symfony/options-resolver": "6.1.*",
"symfony/process": "6.1.*",
"symfony/property-access": "6.1.*",
"symfony/property-info": "5.4.*",
"symfony/proxy-manager-bridge": "6.1.*",
"symfony/rate-limiter": "6.1.*",
"symfony/runtime": "6.1.*",
"symfony/security-bundle": "6.1.*",
"symfony/serializer": "6.1.*",
"symfony/string": "6.1.*",
"symfony/translation": "6.1.*",
"symfony/twig-bundle": "6.1.*",
"symfony/validator": "6.1.*",
"symfony/web-link": "6.1.*",
"symfony/webpack-encore-bundle": "^1.14",
"symfony/yaml": "6.0.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
},
"require-dev": {
"fakerphp/faker": "^1.19",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-doctrine": "^1.3",
"rector/rector": "^0.13.9",
"symfony/browser-kit": "6.1.*",
"symfony/css-selector": "6.1.*",
"symfony/debug-bundle": "6.1.*",
"symfony/maker-bundle": "^1.30",
"symfony/phpunit-bridge": "6.1.*",
"symfony/stopwatch": "6.1.*",
"symfony/var-dumper": "6.1.*",
"symfony/web-profiler-bundle": "6.1.*"
},
Thanks for your help !