Skip to content

Commit a443f26

Browse files
authored
Add rector to CI (#61)
1 parent 6045d9d commit a443f26

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

.github/workflows/rector.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
on:
2+
pull_request_target:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
- 'infection.json.dist'
10+
- 'psalm.xml'
11+
12+
name: rector
13+
14+
jobs:
15+
rector:
16+
uses: yiisoft/actions/.github/workflows/rector.yml@master
17+
secrets:
18+
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
19+
with:
20+
repository: ${{ github.event.pull_request.head.repo.full_name }}
21+
os: >-
22+
['ubuntu-latest']
23+
php: >-
24+
['8.3']

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"require-dev": {
3535
"maglnet/composer-require-checker": "^3.8|^4.4",
3636
"phpunit/phpunit": "^9.5",
37+
"rector/rector": "^1.2",
3738
"roave/infection-static-analysis-plugin": "^1.16",
3839
"spatie/phpunit-watcher": "^1.23",
3940
"vimeo/psalm": "^4.18"

rector.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
6+
use Rector\Config\RectorConfig;
7+
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
8+
use Rector\Set\ValueObject\LevelSetList;
9+
10+
return static function (RectorConfig $rectorConfig): void {
11+
$rectorConfig->paths([
12+
__DIR__ . '/src',
13+
__DIR__ . '/tests',
14+
]);
15+
16+
// register a single rule
17+
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
18+
19+
// define sets of rules
20+
$rectorConfig->sets([
21+
LevelSetList::UP_TO_PHP_74,
22+
]);
23+
24+
$rectorConfig->skip([
25+
ClosureToArrowFunctionRector::class,
26+
]);
27+
};

0 commit comments

Comments
 (0)