-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
66 lines (62 loc) · 2.41 KB
/
rector.php
File metadata and controls
66 lines (62 loc) · 2.41 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
<?php declare(strict_types=1);
require_once __DIR__ . '/util/rector/RemoveAlwaysFalseIfStatementRector.php';
require_once __DIR__ . '/util/rector/RemoveAlwaysTrueIfConditionRector2.php';
require_once __DIR__ . '/util/rector/ReplaceKnownDefinedWithBooleanRector.php';
require_once __DIR__ . '/util/rector/ReplaceNegatedBooleanRector.php';
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\Config\RectorConfig;
use Rector\Constants\Rector\FuncCall\ReplaceKnownDefinedWithBooleanRector;
use Rector\DeadCode\Rector\For_\RemoveDeadContinueRector;
use Rector\DeadCode\Rector\If_\RemoveAlwaysFalseIfStatementRector;
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector2;
use Rector\Php53\Rector\Ternary\TernaryToElvisRector;
use Rector\Set\ValueObject\SetList;
use Rector\Transform\Rector\BooleanNot\ReplaceNegatedBooleanRector;
// Search rules at https://getrector.com/find-rule
return RectorConfig::configure()
->withBootstrapFiles(
[
__DIR__ . '/constants.php',
],
)
->withPaths(
[
__DIR__ . '/src',
]
)
->withRootFiles() // Include snapcache.php and uninstall.php
->withPhpSets() // Detects PHP version from composer.json
->withRules(
[
RemoveAlwaysFalseIfStatementRector::class,
RemoveAlwaysTrueIfConditionRector2::class,
ReplaceKnownDefinedWithBooleanRector::class,
ReplaceNegatedBooleanRector::class,
]
)
->withSets(
[
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
SetList::PRIVATIZATION,
SetList::TYPE_DECLARATION,
SetList::TYPE_DECLARATION_DOCBLOCKS,
]
)
->withSkip(
[
CatchExceptionNameMatchingTypeRector::class,
EncapsedStringsToSprintfRector::class,
NewlineAfterStatementRector::class,
NewlineBeforeNewAssignSetRector::class,
// Allow explicit loops to consume iterators for side-effects
RemoveDeadContinueRector::class,
TernaryToElvisRector::class,
]
);