-
Notifications
You must be signed in to change notification settings - Fork 1
/
rector.php
73 lines (62 loc) · 2.83 KB
/
rector.php
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
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* @noinspection DevelopmentDependenciesUsageInspection
*/
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector;
use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\CodingStyle\Rector\Use_\SeparateMultiUseImportsRector;
use Rector\Config\RectorConfig;
use Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchExprVariableRector;
use Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchMethodCallReturnTypeRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
use Rector\ValueObject\PhpVersion;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->bootstrapFiles([__DIR__ . '/vendor/autoload.php']);
$rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']);
$rectorConfig->skip([__DIR__ . '/bootstrap/cache']);
// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
$rectorConfig->rule(RenameForeachValueVariableToMatchExprVariableRector::class);
$rectorConfig->rule(RenameForeachValueVariableToMatchMethodCallReturnTypeRector::class);
$rectorConfig->rule(TypedPropertyFromStrictConstructorRector::class);
$rectorConfig->rule(NullableCompareToNullRector::class);
$rectorConfig->rule(EncapsedStringsToSprintfRector::class);
$rectorConfig->rule(NewlineAfterStatementRector::class);
$rectorConfig->rule(NewlineBeforeNewAssignSetRector::class);
$rectorConfig->rule(PostIncDecToPreIncDecRector::class);
$rectorConfig->rule(SeparateMultiUseImportsRector::class);
$rectorConfig->rule(SplitDoubleAssignRector::class);
$rectorConfig->phpVersion(PhpVersion::PHP_82);
// define sets of rules
$rectorConfig->sets(
[
LevelSetList::UP_TO_PHP_82,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::PHP_82,
SetList::TYPE_DECLARATION,
SetList::NAMING,
SetList::PRIVATIZATION,
SetList::STRICT_BOOLEANS,
SetList::INSTANCEOF,
]
);
$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
$rectorConfig->skip(
[
FlipTypeControlToUseExclusiveTypeRector::class,
]
);
};