-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathrector.php
More file actions
68 lines (65 loc) · 2.96 KB
/
rector.php
File metadata and controls
68 lines (65 loc) · 2.96 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
<?php
declare(strict_types=1);
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
return RectorConfig::configure()
->withPhpSets(php81: true)
->withPreparedSets(deadCode: true, codeQuality: true)
->withComposerBased(phpunit: true)
->withParallel(120, 8, 10)
->withCache(
is_dir('/tmp') ? '/tmp/rector' : null,
FileCacheStorage::class,
)
->withPaths([
__DIR__ . '/src',
])
->withAutoloadPaths([
__DIR__ . '/vendor/autoload.php',
])
->withBootstrapFiles([
__DIR__ . '/vendor/codeigniter4/framework/system/Test/bootstrap.php',
])
->withPHPStanConfigs([
__DIR__ . '/phpstan.neon.dist',
])
->withImportNames(removeUnusedImports: true)
->withSkip([
StringifyStrNeedlesRector::class,
RemoveUnusedPromotedPropertyRector::class, // Note: requires php 8
])
->withRules([
ChangeIfElseValueAssignToEarlyReturnRector::class,
ChangeNestedForeachIfsToEarlyContinueRector::class,
CountArrayToEmptyArrayComparisonRector::class,
DisallowedEmptyRuleFixerRector::class,
EmptyOnNullableObjectToInstanceOfRector::class,
FuncGetArgsToVariadicParamRector::class,
MakeInheritedMethodVisibilitySameAsParentRector::class,
PreparedValueToEarlyReturnRector::class,
PrivatizeFinalClassPropertyRector::class,
RemoveAlwaysElseRector::class,
SimplifyUselessVariableRector::class,
StringClassNameToClassConstantRector::class,
VersionCompareFuncCallToConstantRector::class,
])
->withConfiguredRule(TypedPropertyFromAssignsRector::class, [
// Allow public property inlining when BC breaks are acceptable.
TypedPropertyFromAssignsRector::INLINE_PUBLIC => true,
]);