-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrector.php
More file actions
100 lines (97 loc) · 4.24 KB
/
rector.php
File metadata and controls
100 lines (97 loc) · 4.24 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\BooleanAnd\RepeatedAndNotEqualToNotInArrayRector;
use Rector\CodeQuality\Rector\BooleanOr\RepeatedOrEqualToInArrayRector;
use Rector\CodeQuality\Rector\Catch_\ThrowWithPreviousExceptionRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\CodeQuality\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector;
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\CodingStyle\Rector\ClassLike\NewlineBetweenClassLikeStmtsRector;
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\CodingStyle\Rector\String_\SimplifyQuoteEscapeRector;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\NoSetupWithParentCallOverrideRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitSelfCallRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\Php53\Rector\FuncCall\DirNameFileConstantToDirConstantRector;
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
use Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector;
use Rector\Php71\Rector\TryCatch\MultiExceptionCatchRector;
use Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
use Rector\Php83\Rector\Class_\ReadOnlyAnonymousClassRector;
use Rector\Php84\Rector\FuncCall\RoundingModeEnumRector;
use Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
use RectorLaravel\Rector\ClassMethod\ScopeNamedClassMethodToScopeAttributedClassMethodRector;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/Modules',
__DIR__ . '/app',
__DIR__ . '/bootstrap',
__DIR__ . '/config',
__DIR__ . '/database',
__DIR__ . '/routes',
__DIR__ . '/tests',
])
->withRootFiles()
->withSkip([
__DIR__ . '/bootstrap/cache',
])
->withAttributesSets(all: true)
->withComposerBased(
phpunit: true,
symfony: true,
laravel: true,
)
->withImportNames(removeUnusedImports: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
privatization: true,
instanceOf: true,
earlyReturn: true,
carbon: true,
rectorPreset: true,
phpunitCodeQuality: true,
symfonyCodeQuality: true,
symfonyConfigs: true,
)
->withRules([
AddOverrideAttributeToOverriddenMethodsRector::class,
AddTypeToConstRector::class,
ArrayKeyFirstLastRector::class,
DirNameFileConstantToDirConstantRector::class,
ExceptionHandlerTypehintRector::class,
ExplicitNullableParamTypeRector::class,
MultiExceptionCatchRector::class,
PreferPHPUnitSelfCallRector::class,
ReadOnlyAnonymousClassRector::class,
ReadOnlyPropertyRector::class,
RoundingModeEnumRector::class,
ScopeNamedClassMethodToScopeAttributedClassMethodRector::class,
ThisCallOnStaticMethodToStaticCallRector::class,
])
->withSkip([
CatchExceptionNameMatchingTypeRector::class,
// Adds strict_types grot to blade files in modules.
DeclareStrictTypesRector::class,
IssetOnPropertyObjectToPropertyExistsRector::class,
MakeInheritedMethodVisibilitySameAsParentRector::class,
NewlineAfterStatementRector::class,
NewlineBeforeNewAssignSetRector::class,
NewlineBetweenClassLikeStmtsRector::class,
NoSetupWithParentCallOverrideRector::class,
PreferPHPUnitThisCallRector::class,
RepeatedAndNotEqualToNotInArrayRector::class,
RepeatedOrEqualToInArrayRector::class,
SimplifyIfElseToTernaryRector::class,
SimplifyQuoteEscapeRector::class,
ThrowWithPreviousExceptionRector::class,
]);