-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
78 lines (70 loc) · 3.46 KB
/
rector.php
File metadata and controls
78 lines (70 loc) · 3.46 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
declare(strict_types=1);
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodeQuality\Rector\Assign\CombinedAssignRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector;
use Rector\Config\RectorConfig;
use Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector;
use Rector\Naming\Rector\Class_\RenamePropertyToMatchTypeRector;
use Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\Visibility\Rector\ClassConst\ChangeConstantVisibilityRector;
use Rector\Visibility\Rector\ClassMethod\ChangeMethodVisibilityRector;
return RectorConfig::configure()
->withCache(
cacheDirectory: '/tmp/rector',
cacheClass: FileCacheStorage::class,
)
->withPaths([
__DIR__,
])
->withSkip([
// —— Excluded paths ———————————————————————————————————————————————————
// Excluded folders
// [dtk]
__DIR__.'/config/reference.php',
__DIR__.'/var',
__DIR__.'/vendor',
// —— Excluded rules ———————————————————————————————————————————————————
// [CODE_QUALITY]
CombinedAssignRector::class,
// [CODING_STYLE]
EncapsedStringsToSprintfRector::class,
// [NAMING]
RenameParamToMatchTypeRector::class,
RenamePropertyToMatchTypeRector::class,
RenameVariableToMatchMethodCallReturnTypeRector::class,
])
->withSets([
// —— PHP ——————————————————————————————————————————————————————————————
SetList::PHP_85,
// —— Core —————————————————————————————————————————————————————————————
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
SetList::NAMING,
SetList::PRIVATIZATION,
SetList::RECTOR_PRESET,
SetList::TYPE_DECLARATION,
SetList::TYPE_DECLARATION_DOCBLOCKS,
// —— PHPUnit ——————————————————————————————————————————————————————————
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_120,
])
->withRules([
// —— Core —————————————————————————————————————————————————————————————
// Inherit parent visibility
ChangeConstantVisibilityRector::class,
ChangeMethodVisibilityRector::class,
// Strict Booleans
DisallowedEmptyRuleFixerRector::class,
// More Coding Style
ArraySpreadInsteadOfArrayMergeRector::class,
StaticClosureRector::class,
]);