-
Notifications
You must be signed in to change notification settings - Fork 50
/
rector.php
71 lines (64 loc) · 2.5 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
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector;
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\Php54\Rector\Array_\LongArrayToShortArrayRector;
use Rector\Php80\Rector\Identical\StrEndsWithRector;
use Rector\Php80\Rector\Identical\StrStartsWithRector;
use Rector\Php80\Rector\NotIdentical\StrContainsRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Php82\Rector\Encapsed\VariableInStringInterpolationFixerRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
use Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
return RectorConfig::configure()
->withPaths(
array(
__DIR__ . '/includes',
__DIR__ . '/lib',
__DIR__ . '/tests',
__DIR__ . '/functions.php',
__DIR__ . '/widget.zone-posts.php',
__DIR__ . '/zoninator.php',
)
)
->withSkip(
array(
LongArrayToShortArrayRector::class,
// Need a better understanding of intent in this file before switching out the use of empty().
DisallowedEmptyRuleFixerRector::class => array(
__DIR__ . '/lib/zoninator_rest/type/class-zoninator-rest-type-registry.php',
),
// Child classes can legitimately relax the visibility of a method, so while this
// might not be desirable, changing them from public to the original parent-defined
// protected would count as a breaking change.
MakeInheritedMethodVisibilitySameAsParentRector::class,
)
)
->withPhpSets( php74: true )
// Changes from later PHP Sets that are backwards compatible:
->withRules(
array(
// 8.0
ConsistentImplodeRector::class,
OptionalParametersAfterRequiredRector::class,
RemoveParentCallWithoutParentRector::class,
// Backfilled from PHP 8.0 into WP 5.9, so these can be used.
StrContainsRector::class,
StrEndsWithRector::class,
StrStartsWithRector::class,
// 8.1
NullToStrictStringFuncCallArgRector::class,
// 8.2
VariableInStringInterpolationFixerRector::class,
// 8.3
AddOverrideAttributeToOverriddenMethodsRector::class,
// 8.4
ExplicitNullableParamTypeRector::class,
)
)
->withPreparedSets( deadCode: true, codeQuality: true, instanceOf: true, codingStyle: true )
->withTypeCoverageLevel( 1 );