From bb635de7c9604a71eb68efc4f94b8591a1bf9823 Mon Sep 17 00:00:00 2001 From: Julien Waguet Date: Fri, 10 Oct 2025 14:59:24 +0200 Subject: [PATCH] Adds Rector for automated code refactoring Introduces Rector to automate code refactoring tasks, improving code quality and consistency. This includes adding the Rector package as a dev dependency and configuring it to analyze and refactor code in the `src` and `tests` directories. It also enables a set of rules from the php-quality-config package. --- composer.json | 3 ++- rector.php | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 rector.php diff --git a/composer.json b/composer.json index ab9f810..a36c542 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ "symfony/yaml": "^5.4|^6.4", "symfony/translation": "^5.4|^6.4", "assoconnect/php-quality-config": "^1.10", - "phpstan/phpstan-symfony": "^1.3.7" + "phpstan/phpstan-symfony": "^1.3.7", + "rector/rector": "^1.2" }, "require": { "php": "^8.2", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..391f508 --- /dev/null +++ b/rector.php @@ -0,0 +1,17 @@ +withPaths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + // uncomment to reach your current PHP version + // ->withPhpSets() + ->withTypeCoverageLevel(0) + ->withSets([ + __DIR__ . '/vendor/assoconnect/php-quality-config/src/Rector/rules.php', + ]);