forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
124 lines (120 loc) · 6.35 KB
/
rector.php
File metadata and controls
124 lines (120 loc) · 6.35 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
# https://getrector.com/documentation
declare(strict_types=1);
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector;
use Rector\Config\RectorConfig;
use Rector\Php52\Rector\Property\VarToPublicPropertyRector;
use Rector\Php53\Rector\FuncCall\DirNameFileConstantToDirConstantRector;
use Rector\Php53\Rector\Ternary\TernaryToElvisRector;
use Rector\Php53\Rector\Variable\ReplaceHttpServerVarsByServerRector;
use Rector\Php54\Rector\Array_\LongArrayToShortArrayRector;
use Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector;
use Rector\Php56\Rector\FuncCall\PowToExpRector;
use Rector\Php70\Rector\FuncCall\EregToPregMatchRector;
use Rector\Php70\Rector\FuncCall\MultiDirnameRector;
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
use Rector\Php70\Rector\If_\IfToSpaceshipRector;
use Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector;
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;
use Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector;
use Rector\Php70\Rector\Variable\WrapVariableVariableNameInCurlyBracesRector;
use Rector\Php71\Rector\Assign\AssignArrayToStringRector;
use Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector;
use Rector\Php71\Rector\List_\ListToArrayDestructRector;
use Rector\Php71\Rector\TryCatch\MultiExceptionCatchRector;
use Rector\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector;
use Rector\Php72\Rector\While_\WhileEachToForeachRector;
use Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector;
use Rector\Php73\Rector\FuncCall\SetCookieRector;
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
use Rector\Php80\Rector\Identical\StrEndsWithRector;
use Rector\Php80\Rector\Identical\StrStartsWithRector;
use Rector\Php80\Rector\NotIdentical\StrContainsRector;
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php82\Rector\FuncCall\Utf8DecodeEncodeToMbConvertEncodingRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
use Rector\ValueObject\PhpVersion;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/Documentation',
__DIR__ . '/apis',
__DIR__ . '/ccdaservice',
__DIR__ . '/ccr',
__DIR__ . '/contrib',
__DIR__ . '/controllers',
__DIR__ . '/custom',
__DIR__ . '/gacl',
__DIR__ . '/interface',
__DIR__ . '/library',
__DIR__ . '/modules',
__DIR__ . '/oauth2',
__DIR__ . '/portal',
__DIR__ . '/sites',
__DIR__ . '/sphere',
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withCache(
// ensure file system caching is used instead of in-memory
cacheClass: FileCacheStorage::class,
// specify a path that works locally as well as on CI job runners
cacheDirectory: '/tmp/rector'
)
->withCodeQualityLevel(5)
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
'allow_model_based_classes' => true,
'inline_public' => false,
'rename_property' => true,
])
->withDeadCodeLevel(5)
// FIXME rector should pick the php version from composer.json
// but that doesn't seem to be working, so hard-coding for now.
->withPhpVersion(PhpVersion::PHP_82)
->withRules([
// add rules one at a time until we can replace them with a named ruleset
ArrayKeyExistsOnPropertyRector::class, // one of the withPhpSets rules
ArrayKeyFirstLastRector::class, // one of the withPhpSets rules
AssignArrayToStringRector::class, // one of the withPhpSets rules
BinaryOpBetweenNumberAndStringRector::class, // one of the withPhpSets rules
ChangeSwitchToMatchRector::class, // one of the withPhpSets rules
ClassConstantToSelfClassRector::class, // one of the withPhpSets rules
ClassOnObjectRector::class, // one of the withPhpSets rules
ClosureToArrowFunctionRector::class, // one of the withPhpSets rules
ConsistentImplodeRector::class, // one of the withPhpSets rules
CreateFunctionToAnonymousFunctionRector::class, // one of the withPhpSets rules
DirNameFileConstantToDirConstantRector::class, // one of the withPhpSets rules
EregToPregMatchRector::class, // one of the withPhpSets rules
IfIssetToCoalescingRector::class, // one of the withPhpSets rules
IfToSpaceshipRector::class, // one of the withPhpSets rules
ListToArrayDestructRector::class, // one of the withPhpSets rules
LongArrayToShortArrayRector::class, // one of the withPhpSets rules
MultiDirnameRector::class, // one of the withPhpSets rules
MultiExceptionCatchRector::class, // one of the withPhpSets rules
PowToExpRector::class, // one of the withPhpSets rules
RandomFunctionRector::class, // one of the withPhpSets rules
ReadOnlyPropertyRector::class, // one of the withPhpSets rules
ReplaceHttpServerVarsByServerRector::class, // one of the withPhpSets rules
ReturnNeverTypeRector::class, // one of the withPhpSets rules
SetCookieRector::class, // one of the withPhpSets rules
StrContainsRector::class, // one of the withPhpSets rules
StrEndsWithRector::class, // one of the withPhpSets rules
StrStartsWithRector::class, // one of the withPhpSets rules
StringifyStrNeedlesRector::class, // one of the withPhpSets rules
TernaryToElvisRector::class, // one of the withPhpSets rules
TernaryToNullCoalescingRector::class, // one of the withPhpSets rules
ThisCallOnStaticMethodToStaticCallRector::class, // one of the withPhpSets rules
Utf8DecodeEncodeToMbConvertEncodingRector::class, // one of the withPhpSets rules
VarToPublicPropertyRector::class, // one of the withPhpSets rules
WhileEachToForeachRector::class, // one of the withPhpSets rules
WrapVariableVariableNameInCurlyBracesRector::class, // one of the withPhpSets rules
])
->withSkip([
__DIR__ . '/sites/default/documents/smarty'
])
->withTypeCoverageLevel(5);