Skip to content

Commit a7f3294

Browse files
authored
Improve rector CI (#432)
1 parent 9e904c4 commit a7f3294

3 files changed

Lines changed: 14 additions & 20 deletions

File tree

.github/workflows/rector.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
on:
2-
pull_request:
2+
pull_request_target:
33
paths:
44
- 'src/**'
55
- '.github/workflows/rector.yml'
@@ -15,7 +15,10 @@ concurrency:
1515
jobs:
1616
rector:
1717
uses: yiisoft/actions/.github/workflows/rector.yml@master
18+
secrets:
19+
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
1820
with:
21+
repository: ${{ github.event.pull_request.head.repo.full_name }}
1922
php: >-
2023
['8.4']
2124
required-packages: >-

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"require-dev": {
3636
"maglnet/composer-require-checker": "^4.7.1",
3737
"phpunit/phpunit": "^10.5.45",
38-
"rector/rector": "^2.0.10",
38+
"rector/rector": "^2.0.18",
3939
"roave/infection-static-analysis-plugin": "^1.35",
4040
"spatie/phpunit-watcher": "^1.24",
4141
"vimeo/psalm": "^5.26.1 || ^6.8.8",

rector.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,16 @@
66
use Rector\Config\RectorConfig;
77
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
88
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
9-
use Rector\Set\ValueObject\LevelSetList;
109

11-
return static function (RectorConfig $rectorConfig): void {
12-
$rectorConfig->paths([
10+
return RectorConfig::configure()
11+
->withPaths([
1312
__DIR__ . '/src',
14-
/** Disable rector on tests */
15-
// __DIR__ . '/tests',
16-
]);
17-
18-
// register a single rule
19-
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
20-
21-
// define sets of rules
22-
$rectorConfig->sets([
23-
LevelSetList::UP_TO_PHP_81,
24-
]);
25-
26-
$rectorConfig->skip([
27-
NullToStrictStringFuncCallArgRector::class,
13+
])
14+
->withPhpSets(php81: true)
15+
->withRules([
16+
InlineConstructorDefaultToPropertyRector::class,
17+
])
18+
->withSkip([
2819
ReadOnlyPropertyRector::class,
20+
NullToStrictStringFuncCallArgRector::class,
2921
]);
30-
};

0 commit comments

Comments
 (0)