-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrector.php
More file actions
62 lines (51 loc) · 2.28 KB
/
rector.php
File metadata and controls
62 lines (51 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\ValueObject\PhpVersion;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_82,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_100,
]);
$rectorConfig->parallel();
$rectorConfig->paths([
__DIR__ . '/src/',
__DIR__ . '/tests/',
]);
$rectorConfig->autoloadPaths([
__DIR__ . '/vendor/autoload.php',
]);
$rectorConfig->bootstrapFiles([
realpath(getcwd()) . '/vendor/codeigniter4/framework/system/Test/bootstrap.php',
]);
if (is_file(__DIR__ . '/phpstan.neon.dist')) {
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon.dist');
}
$rectorConfig->phpVersion(PhpVersion::PHP_82);
$rectorConfig->importNames();
// Targeted skips: rules we don't want applied repo-wide.
$rectorConfig->skip([
__DIR__ . '/src/Views',
// Promoted properties may stay even if currently unused (public contract / DI shape).
RemoveUnusedPromotedPropertyRector::class,
// String class names may legitimately point to runtime-only views.
StringClassNameToClassConstantRector::class,
]);
// Selective rules on top of the sets above.
$rectorConfig->rule(RemoveAlwaysElseRector::class);
$rectorConfig->rule(ChangeNestedForeachIfsToEarlyContinueRector::class);
$rectorConfig->rule(ChangeIfElseValueAssignToEarlyReturnRector::class);
$rectorConfig->rule(PreparedValueToEarlyReturnRector::class);
$rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class);
};