-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrector.php
75 lines (59 loc) · 2.52 KB
/
rector.php
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
75
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\If_\CombineIfRector;
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
use Rector\Symfony\Rector\ClassMethod\ConsoleExecuteReturnIntRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use WeCreateSolutions\Rector\WafConfigs;
use WeCreateSolutions\Rector\WcsBase;
// @see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md
return static function (RectorConfig $rectorConfig): void {
$projectRoot = WcsBase::getProjectRoot();
$rectorConfig->paths(
[
$projectRoot . '/src',
]
);
// @see https://github.com/rectorphp/rector/blob/main/docs/how_to_persist_cache_between_ci_runs.md
$rectorConfig->cacheDirectory($projectRoot . '/var/tmp/rector');
// @see https://github.com/rectorphp/rector/blob/main/docs/how_to_troubleshoot_parallel_issues.md
$rectorConfig->parallel(4800);
// @see https://github.com/rectorphp/rector/blob/main/docs/auto_import_names.md
$rectorConfig->importNames();
$rectorConfig->rules(
[
// TypedPropertyRector::class, // UNSAFE
]
);
$rectorConfig->ruleWithConfiguration(
AnnotationToAttributeRector::class,
[
]
);
// @see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md
$rectorConfig->skip(
array_merge(
WafConfigs::SKIPS,
[
FuncGetArgsToVariadicParamRector::class => [],
// region slow rules
TypedPropertyFromAssignsRector::class,
RemoveEmptyMethodCallRector::class,
ParamTypeByParentCallTypeRector::class => [],
// endregion
// region to review with team
CombineIfRector::class => [],
// endregion
// region false-positive
ConsoleExecuteReturnIntRector::class => [
],
// endregion
Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector::class, // https://blog.jetbrains.com/phpstorm/2022/06/phpstorm-2022-2-eap-5/#Anonymous_var_in_return_statements
]
)
);
};