-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefault-rector.php
More file actions
60 lines (54 loc) · 2.62 KB
/
Copy pathdefault-rector.php
File metadata and controls
60 lines (54 loc) · 2.62 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
<?php
declare(strict_types=1);
use BrandEmbassyCodingStandard\Rector\DoctrineEntitiesCannotBeFinalRector\DoctrineEntitiesCannotBeFinalRector;
use BrandEmbassyCodingStandard\Rector\NetteStringsContainsToNativeCallRector\NetteStringsContainsToNativeCallRector;
use BrandEmbassyCodingStandard\Rector\NetteStringsEndsWithToNativeCallRector\NetteStringsEndsWithToNativeCallRector;
use BrandEmbassyCodingStandard\Rector\NetteStringsStartsWithToNativeCallRector\NetteStringsStartsWithToNativeCallRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\Configuration\RectorConfigBuilder;
use Rector\DeadCode\Rector\Plus\RemoveDeadZeroAndOneOperationRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
use Rector\Php53\Rector\Ternary\TernaryToElvisRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
/**
* @return mixed[] default skip list
*/
return static function (RectorConfigBuilder $rectorConfigBuilder): array {
if (!defined('RECTOR_IS_RUNNING')) {
define('RECTOR_IS_RUNNING', 1);
}
$maxProcesses = getenv('RECTOR_MAX_PROCESSES');
$maxProcesses = $maxProcesses === false ? 16 : (int) $maxProcesses;
$rectorConfigBuilder
->withSets([
LevelSetList::UP_TO_PHP_74,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::CODING_STYLE,
SetList::TYPE_DECLARATION,
SetList::PRIVATIZATION,
SetList::EARLY_RETURN,
])
->withRules([
NetteStringsStartsWithToNativeCallRector::class,
NetteStringsEndsWithToNativeCallRector::class,
NetteStringsContainsToNativeCallRector::class,
DoctrineEntitiesCannotBeFinalRector::class,
])
->withParallel(120, $maxProcesses)
->withImportNames();
return [
ChangeOrIfContinueToMultiContinueRector::class,
ReturnBinaryOrToEarlyReturnRector::class,
CatchExceptionNameMatchingTypeRector::class,
// @see \PHPStan\Rules\DisallowedConstructs\DisallowedShortTernaryRule
// Short ternary operator is not allowed. Use null coalesce operator if applicable or consider using long ternary.
TernaryToElvisRector::class,
// We don't want this because sometimes number is intentionally broken down into x * y * z for better readability
RemoveDeadZeroAndOneOperationRector::class,
FlipTypeControlToUseExclusiveTypeRector::class,
];
};