-
Notifications
You must be signed in to change notification settings - Fork 3
/
rector.php
66 lines (56 loc) · 2.83 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
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src/',
__DIR__ . '/tests/'
]);
$rectorConfig->skip([
\Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector::class,
\Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector::class,
\Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector::class,
\Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector::class
]);
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
$rectorConfig->rule(ExplicitBoolCompareRector::class);
$rectorConfig->rule(\Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector::class);
$rectorConfig->rule(\Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector::class);
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationBasedOnParentClassMethodRector::class);
$rectorConfig->rule(\Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeFromPropertyTypeRector::class);
$rectorConfig->removeUnusedImports(true);
$rectorConfig->importNames(true, true);
// define sets of rules
$rectorConfig->sets([
SetList::CODE_QUALITY,
SetList::TYPE_DECLARATION,
SetList::PSR_4,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_74,
//SetList::PHP_74,
]);
$rectorConfig->skip([
\Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector::class,
\Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector::class,
\Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector::class,
\Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector::class,
\Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector::class,
\Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector::class,
\Rector\TypeDeclaration\Rector\ClassMethod\ReturnAnnotationIncorrectNullableRector::class => [
__DIR__ . '/src/Util/ResponseHelper.php'
],
\Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector::class => [
__DIR__ . '/src/Model/'
]
]);
$rectorConfig->ruleWithConfiguration(ConsistentPregDelimiterRector::class, [
ConsistentPregDelimiterRector::DELIMITER => '/',
]);
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon');
};