-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphprector.php
More file actions
59 lines (56 loc) · 2.03 KB
/
Copy pathphprector.php
File metadata and controls
59 lines (56 loc) · 2.03 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
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Php53\Rector\Ternary\TernaryToElvisRector;
use Rector\Php54\Rector\Array_\LongArrayToShortArrayRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
use Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector;
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
return RectorConfig::configure()
->withPaths(
array(
__DIR__,
)
)
->withSkipPath( __DIR__ . '/.github' )
->withSkipPath( __DIR__ . '/languages' )
->withSkipPath( __DIR__ . '/vendor' )
// Don't auto-refactor test code: rector strips the @var tags that WPCS requires.
->withSkipPath( __DIR__ . '/tests' )
// examples/ are reference snippets, kept verbatim for copying.
->withSkipPath( __DIR__ . '/examples' )
->withPhpSets( php82: true )
->withPreparedSets(
deadCode: true,
)
->withImportNames(
removeUnusedImports: true,
importShortClasses: false,
)
->withRules(
array(
ChangeNestedForeachIfsToEarlyContinueRector::class,
ChangeIfElseValueAssignToEarlyReturnRector::class,
ChangeNestedIfsToEarlyReturnRector::class,
RemoveAlwaysElseRector::class,
PreparedValueToEarlyReturnRector::class,
ReturnBinaryOrToEarlyReturnRector::class,
ReturnEarlyIfVariableRector::class,
)
)
->withSkip(
array(
LongArrayToShortArrayRector::class,
TernaryToElvisRector::class,
NullToStrictStringFuncCallArgRector::class, // PHPStan handles this better.
ArrayToFirstClassCallableRector::class,
IfIssetToCoalescingRector::class,
),
);