From c5ec0e77ff9366226f2ef5e90460f0af0fbb92a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 28 Mar 2023 23:16:03 +0200 Subject: [PATCH] DX: bootstrap rector --- .gitlab-ci.yml | 14 ++++++++++++++ composer.json | 1 + rector.php | 25 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 rector.php diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7ce9e1835..8fcd1a637 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -79,6 +79,20 @@ phpstan_tests: - bin - tests/app/vendor/ +rector_tests: + stage: Tests + image: gitea.champs-libres.be/chill-project/chill-skeleton-basic/base-image:php82 + script: + - bin/rector --dry-run + cache: + paths: + - .cache/ + artifacts: + expire_in: 30 min + paths: + - bin + - tests/app/vendor/ + # psalm_tests: # stage: Tests # image: gitea.champs-libres.be/chill-project/chill-skeleton-basic/base-image:php82 diff --git a/composer.json b/composer.json index 12fa59fd1..033b3f19b 100644 --- a/composer.json +++ b/composer.json @@ -75,6 +75,7 @@ "phpunit/phpunit": ">= 7.5", "psalm/plugin-phpunit": "^0.18.4", "psalm/plugin-symfony": "^4.0.2", + "rector/rector": "^0.15.23", "symfony/debug-bundle": "^5.1", "symfony/dotenv": "^4.4", "symfony/maker-bundle": "^1.20", diff --git a/rector.php b/rector.php new file mode 100644 index 000000000..2c5b08bec --- /dev/null +++ b/rector.php @@ -0,0 +1,25 @@ +paths([ + __DIR__ . '/docs', + __DIR__ . '/src', + ]); + + $rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class); + $rectorConfig->cacheDirectory(__DIR__.'/.cache/rector'); + + // register a single rule + $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); + + // define sets of rules + // $rectorConfig->sets([ + // LevelSetList::UP_TO_PHP_74 + // ]); +};