From a443f262a4c0af8b26c06bd0c951b73d31d28b00 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Sat, 3 Aug 2024 08:36:10 +0300 Subject: [PATCH] Add rector to CI (#61) --- .github/workflows/rector.yml | 24 ++++++++++++++++++++++++ composer.json | 1 + rector.php | 27 +++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 .github/workflows/rector.yml create mode 100644 rector.php diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml new file mode 100644 index 0000000..457772a --- /dev/null +++ b/.github/workflows/rector.yml @@ -0,0 +1,24 @@ +on: + pull_request_target: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'psalm.xml' + +name: rector + +jobs: + rector: + uses: yiisoft/actions/.github/workflows/rector.yml@master + secrets: + token: ${{ secrets.YIISOFT_GITHUB_TOKEN }} + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + os: >- + ['ubuntu-latest'] + php: >- + ['8.3'] diff --git a/composer.json b/composer.json index db50379..05dd624 100644 --- a/composer.json +++ b/composer.json @@ -34,6 +34,7 @@ "require-dev": { "maglnet/composer-require-checker": "^3.8|^4.4", "phpunit/phpunit": "^9.5", + "rector/rector": "^1.2", "roave/infection-static-analysis-plugin": "^1.16", "spatie/phpunit-watcher": "^1.23", "vimeo/psalm": "^4.18" diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..b4b9e11 --- /dev/null +++ b/rector.php @@ -0,0 +1,27 @@ +paths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]); + + // register a single rule + $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); + + // define sets of rules + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_74, + ]); + + $rectorConfig->skip([ + ClosureToArrowFunctionRector::class, + ]); +};