-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrector.php
More file actions
74 lines (70 loc) · 2.78 KB
/
rector.php
File metadata and controls
74 lines (70 loc) · 2.78 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
<?php declare(strict_types=1);
require_once __DIR__ . '/util/rector/RemoveAlwaysFalseIfStatementRector.php';
require_once __DIR__ . '/util/rector/RemoveAlwaysTrueIfConditionRector2.php';
require_once __DIR__ . '/util/rector/ReduceKnownBooleanAnd.php';
require_once __DIR__ . '/util/rector/ReduceKnownBooleanOr.php';
require_once __DIR__ . '/util/rector/ReplaceKnownDefinedWithBooleanRector.php';
require_once __DIR__ . '/util/rector/ReplaceControllerGetHookNameRector.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 StaticDeploy\Rector\ReduceKnownBooleanAnd;
use StaticDeploy\Rector\ReduceKnownBooleanOr;
use StaticDeploy\Rector\ReplaceControllerGetHookNameRector;
// Search rules at https://getrector.com/find-rule
return RectorConfig::configure()
->withBootstrapFiles(
[
__DIR__ . '/constants.php',
],
)
->withPaths(
[
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/views',
]
)
->withRootFiles() // Include staticweb-deploy.php and uninstall.php
->withPhpSets() // Detects PHP version from composer.json
->withRules(
[
RemoveAlwaysFalseIfStatementRector::class,
RemoveAlwaysTrueIfConditionRector2::class,
ReduceKnownBooleanAnd::class,
ReduceKnownBooleanOr::class,
ReplaceKnownDefinedWithBooleanRector::class,
ReplaceControllerGetHookNameRector::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,
]
);