Repository navigation
Expand file tree
/
Copy pathrector.php
More file actions
58 lines (56 loc) · 2.07 KB
/
Copy pathrector.php
File metadata and controls
58 lines (56 loc) · 2.07 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
<?php
/**
* Rector configuration.
*
* Rector keeps the plugin's PHP on current idioms. CI runs it as a dry run
* (`composer rector`), which fails when any rule would change the code.
*
* @package OptimizationsAceMc
*/
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\Instanceof_\Rector\Ternary\FlipNegatedTernaryInstanceofRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\SafeDeclareStrictTypesRector;
return RectorConfig::configure()
->withPaths(
[
__DIR__ . '/optimizations-ace-mc.php',
__DIR__ . '/includes',
]
)
->withBootstrapFiles(
[
__DIR__ . '/vendor/php-stubs/wordpress-stubs/wordpress-stubs.php',
__DIR__ . '/stubs/woocommerce.php',
]
)
->withPhpSets( php82: true )
->withPreparedSets(
deadCode: true,
codeQuality: true,
typeDeclarations: true,
earlyReturn: true,
)
->withSkip(
[
// Turns hook callbacks into closures, which has_action() and remove_action() cannot find.
ArrayToFirstClassCallableRector::class,
// The plugin header must be the first docblock of the main file.
SafeDeclareStrictTypesRector::class,
// WordPress-Docs requires @var on properties.
RemoveUselessVarTagRector::class,
// Writes `$x === []`, which is not a Yoda condition.
SimplifyEmptyCheckOnEmptyArrayRector::class,
// A plain null check reads better than a negated instanceof.
FlipTypeControlToUseExclusiveTypeRector::class,
FlipNegatedTernaryInstanceofRector::class,
// The tests reset the coordinator singleton between cases by writing its settings.
ReadOnlyPropertyRector::class => [ __DIR__ . '/includes/class-optimizations-ace-mc.php' ],
ReadOnlyClassRector::class => [ __DIR__ . '/includes/class-optimizations-ace-mc.php' ],
]
);