From 96d5e40b7edae43cf7c6781773f76cd825eb356e Mon Sep 17 00:00:00 2001 From: Dmitriy Derepko Date: Thu, 29 Sep 2022 14:30:07 +0300 Subject: [PATCH] Add rector [batch] (#22) * Add rector files https://github.com/yiisoft/yii-dev-tool/pull/232 * Add rector/rector dependecy * Use predefined rector action * Update rector.php * Apply fixes from StyleCI Co-authored-by: Alexey Rogachev Co-authored-by: StyleCI Bot --- .github/workflows/rector.yml | 21 +++++++++++++++++++++ composer.json | 1 + rector.php | 27 +++++++++++++++++++++++++++ 3 files changed, 49 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..adacd73 --- /dev/null +++ b/.github/workflows/rector.yml @@ -0,0 +1,21 @@ +on: + pull_request: + 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 + with: + os: >- + ['ubuntu-latest'] + php: >- + ['8.0'] diff --git a/composer.json b/composer.json index feea5a6..70a63df 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,7 @@ "require-dev": { "codeception/codeception": "^5.0", "codeception/module-cli": "^2.0", + "rector/rector": "^0.14.3", "vimeo/psalm": "^4.18" }, "autoload": { diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..f55daae --- /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_80, + ]); + + $rectorConfig->skip([ + ClosureToArrowFunctionRector::class, + ]); +};