diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e296a7c..e59e02a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,7 @@ jobs: - "json:lint" - "php:cs-fixer" - "php:mess" + - "php:rector" - "php:sniff" - "php:stan" - "typoscript:lint" diff --git a/.gitlab/pipeline/.gitlab-ci.yml b/.gitlab/pipeline/.gitlab-ci.yml index 0523d6a..ee51fac 100644 --- a/.gitlab/pipeline/.gitlab-ci.yml +++ b/.gitlab/pipeline/.gitlab-ci.yml @@ -35,6 +35,7 @@ include: - '/.gitlab/pipeline/jobs/php-lint-php8.2.yml' - '/.gitlab/pipeline/jobs/php-lint-php8.3.yml' - '/.gitlab/pipeline/jobs/phpcs.yml' + - '/.gitlab/pipeline/jobs/rector.yml' - '/.gitlab/pipeline/jobs/typoscript-lint.yml' - '/.gitlab/pipeline/jobs/unit-php7.4-v11-highest.yml' - '/.gitlab/pipeline/jobs/unit-php7.4-v11-lowest.yml' diff --git a/.gitlab/pipeline/jobs/rector.yml b/.gitlab/pipeline/jobs/rector.yml new file mode 100644 index 0000000..013e940 --- /dev/null +++ b/.gitlab/pipeline/jobs/rector.yml @@ -0,0 +1,11 @@ +rector: + extends: .default + stage: codestyle + needs: + - build-composer-dependencies + - php-lint-php7.4 + - php-lint-php8.0 + - php-lint-php8.1 + - php-lint-php8.2 + script: + - composer ci:php:rector diff --git a/composer.json b/composer.json index dbba5be..8bbfcee 100644 --- a/composer.json +++ b/composer.json @@ -147,6 +147,7 @@ "ci:php:cs-fixer": "php-cs-fixer fix --config .php-cs-fixer.php -v --dry-run --diff", "ci:php:lint": "parallel-lint .*.php *.php Classes Configuration Tests", "ci:php:mess": "phpmd Classes text Build/phpmd/phpmd.xml", + "ci:php:rector": "rector --dry-run", "ci:php:sniff": "phpcs --standard=Build/phpcs/phpcs.xml Classes Configuration Tests", "ci:php:stan": "phpstan --no-progress -v", "ci:static": [ @@ -155,6 +156,7 @@ "@ci:json:lint", "@ci:php:cs-fixer", "@ci:php:lint", + "@ci:php:rector", "@ci:php:sniff", "@ci:php:stan", "@ci:typoscript:lint", @@ -174,10 +176,12 @@ "docs:generate": "docker run --rm --pull always -v $(pwd):/project -it ghcr.io/typo3-documentation/render-guides:latest --config=Documentation", "fix:composer:normalize": "@composer normalize --no-check-lock", "fix:php": [ + "@fix:php:rector", "@fix:php:cs", "@fix:php:sniff" ], "fix:php:cs": "php-cs-fixer fix --config .php-cs-fixer.php", + "fix:php:rector": "rector", "fix:php:sniff": "phpcbf --standard=Build/phpcs/phpcs.xml Classes Configuration Tests", "phpstan:baseline": "phpstan --generate-baseline --allow-empty-baseline", "prepare-release": [ @@ -218,6 +222,7 @@ "ci:php:cs-fixer": "Checks the code style with the PHP Coding Standards Fixer (PHP-CS-Fixer).", "ci:php:lint": "Lints the PHP files for syntax errors.", "ci:php:mess": "Runs PHP mess detection.", + "ci:php:rector": "Checks for code for changes by Rector.", "ci:php:sniff": "Checks the code style with PHP_CodeSniffer (PHPCS).", "ci:php:stan": "Checks the PHP types using PHPStan.", "ci:static": "Runs all static code checks (syntax, style, types).", @@ -232,6 +237,7 @@ "fix:composer:normalize": "Normalizes composer.json file content.", "fix:php": "Runs all fixers for the PHP code.", "fix:php:cs": "Fixes the code style with PHP-CS-Fixer.", + "fix:php:rector": "Updates the code with Rector.", "fix:php:sniff": "Fixes the code style with PHP_CodeSniffer.", "phpstan:baseline": "Updates the PHPStan baseline file to match the code.", "prepare-release": "Removes development-only files in preparation of a TER release."