Repository navigation
Expand file tree
/
Copy pathrector.php
More file actions
77 lines (70 loc) · 3.68 KB
/
Copy pathrector.php
File metadata and controls
77 lines (70 loc) · 3.68 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
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\DeadCode\Rector\Ternary\RemoveUselessTernaryRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\SafeDeclareStrictTypesRector;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withSkip([
// Hand-crafted annotator inputs / generated code — must not be rewritten.
__DIR__ . '/tests/test_app',
__DIR__ . '/tests/test_files',
// Conflicts with house style: plugins deliberately omit declare(strict_types=1).
SafeDeclareStrictTypesRector::class,
// Conflicts with house style: we prefer `if ($var)` over explicit `!== null` / `!== 0`.
ExplicitBoolCompareRector::class,
DisallowedEmptyRuleFixerRector::class,
// Opinionated, large churn — revisit deliberately, not in a sweep.
ClassPropertyAssignToConstructorPromotionRector::class,
ClosureToArrowFunctionRector::class,
// Adds untyped `public $Foo;` properties (CS then wants a @var docblock); cake core skips it.
CompleteDynamicPropertiesRector::class,
// Docblock cleanup is a separate, deliberate pass — keep redundant tags for now.
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
RemoveUselessVarTagRector::class,
RemoveNonExistingVarAnnotationRector::class,
// Broken / unsafe rules (see upstream issues):
// rectorphp/rector#9767 — converts a string callable to a namespace-relative
// first-class callable, turning working code into a fatal class-not-found.
FunctionFirstClassCallableRector::class,
// rectorphp/rector#9768 — rewrites empty() on a possibly-undefined variable to
// `=== []`, introducing an undefined-variable warning and flipping behavior.
SimplifyEmptyCheckOnEmptyArrayRector::class,
// Drops the leading backslash from class-name strings used as data (e.g. docblock
// fragments); the deprecated should_keep_pre_slash knob no longer prevents it.
StringClassNameToClassConstantRector::class,
// get_class() -> ::class invalidates existing phpstan ignore patterns; opt in per plugin.
ClassOnObjectRector::class,
// Removes intentional/defensive (string) casts that coerce Stringable/mixed values
// to real strings, relying on phpstan's optimistic inference; cake core skips it too.
RecastingRemovalRector::class,
// Strips an unused assignment but leaves the call as a dead bare statement; cake core skips it.
RemoveUnusedVariableAssignRector::class,
// Removes defensive `expr ?: []` fallbacks; can change behavior on undefined/empty
// values (e.g. `$_SESSION ?: []`). Skipped on cakephp core's 2.4 bump too.
RemoveUselessTernaryRector::class,
])
->withPhpSets(php82: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
);