-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathrector.php
More file actions
73 lines (63 loc) · 2.99 KB
/
rector.php
File metadata and controls
73 lines (63 loc) · 2.99 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
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withPhpSets(php83: true)
->withSets([
LevelSetList::UP_TO_PHP_83,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
PHPUnitSetList::PHPUNIT_100,
PHPUnitSetList::PHPUNIT_110,
PHPUnitSetList::PHPUNIT_120,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
])
->withImportNames(importShortClasses: false, removeUnusedImports: true)
->withSkip([
// BC breaks in a published library
ReadOnlyPropertyRector::class,
ReadOnlyClassRector::class,
// Changes truthy semantics — "0", null, "" behave differently
ExplicitBoolCompareRector::class,
SimplifyEmptyCheckOnEmptyArrayRector::class,
// Different distribution and failure mode than rand()
RandomFunctionRector::class,
// Subtle casting/control-flow shifts — apply manually
RecastingRemovalRector::class,
FlipTypeControlToUseExclusiveTypeRector::class,
SwitchNegatedTernaryRector::class,
StringClassNameToClassConstantRector::class,
// Promoted properties / nullable defaults — BC shape changes for library
ClassPropertyAssignToConstructorPromotionRector::class,
RestoreDefaultNullToNullableTypePropertyRector::class,
// empty() replacement rarely covers every falsy case Rector's type info misses
DisallowedEmptyRuleFixerRector::class,
// Throws TypeError when args are objects/arrays — review per-call
NullToStrictStringFuncCallArgRector::class,
// Weakens `assertNull` to `assertNotInstanceOf` — keep the stricter assertion
AssertEmptyNullableObjectToAssertInstanceofRector::class,
]);