FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CodeIgniter4/rector.php at develop · codeigniter4/CodeIgniter4 · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
codeigniter4
/
CodeIgniter4
Public
Notifications
You must be signed in to change notification settings
Fork
2k
Star
6k
Code
Issues
26
Pull requests
15
Actions
Security and quality
17
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
CodeIgniter4
/
rector.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
193 lines (173 loc) · 8.54 KB
Breadcrumbs
CodeIgniter4
/
rector.php
Copy path
File metadata and controls
193 lines (173 loc) · 8.54 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
declare
(strict_types=
1
);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
use
Rector
\
Caching
\
ValueObject
\
Storage
\
FileCacheStorage
;
use
Rector
\
CodeQuality
\
Rector
\
BooleanNot
\
NegatedAndsToPositiveOrsRector
;
use
Rector
\
CodeQuality
\
Rector
\
ClassMethod
\
LocallyCalledStaticMethodToNonStaticRector
;
use
Rector
\
CodeQuality
\
Rector
\
FuncCall
\
CompactToVariablesRector
;
use
Rector
\
CodeQuality
\
Rector
\
FunctionLike
\
SimplifyUselessVariableRector
;
use
Rector
\
CodeQuality
\
Rector
\
Isset_
\
IssetOnPropertyObjectToPropertyExistsRector
;
use
Rector
\
CodingStyle
\
Rector
\
ClassMethod
\
FuncGetArgsToVariadicParamRector
;
use
Rector
\
CodingStyle
\
Rector
\
ClassMethod
\
MakeInheritedMethodVisibilitySameAsParentRector
;
use
Rector
\
CodingStyle
\
Rector
\
FuncCall
\
VersionCompareFuncCallToConstantRector
;
use
Rector
\
Config
\
RectorConfig
;
use
Rector
\
DeadCode
\
Rector
\
ClassMethod
\
RemoveUnusedConstructorParamRector
;
use
Rector
\
DeadCode
\
Rector
\
ClassMethod
\
RemoveUnusedPrivateMethodRector
;
use
Rector
\
DeadCode
\
Rector
\
MethodCall
\
RemoveNullArgOnNullDefaultParamRector
;
use
Rector
\
DeadCode
\
Rector
\
Property
\
RemoveDefaultValueFromAssignedPropertyRector
;
use
Rector
\
Php70
\
Rector
\
FuncCall
\
RandomFunctionRector
;
use
Rector
\
Php71
\
Rector
\
FuncCall
\
RemoveExtraParametersRector
;
use
Rector
\
Php80
\
Rector
\
Class_
\
ClassPropertyAssignToConstructorPromotionRector
;
use
Rector
\
PHPUnit
\
CodeQuality
\
Rector
\
Class_
\
YieldDataProviderRector
;
use
Rector
\
PHPUnit
\
CodeQuality
\
Rector
\
StmtsAwareInterface
\
DeclareStrictTypesTestsRector
;
use
Rector
\
Privatization
\
Rector
\
Class_
\
FinalizeTestCaseClassRector
;
use
Rector
\
Privatization
\
Rector
\
Property
\
PrivatizeFinalClassPropertyRector
;
use
Rector
\
Renaming
\
Rector
\
ConstFetch
\
RenameConstantRector
;
use
Rector
\
TypeDeclaration
\
Rector
\
ArrowFunction
\
AddArrowFunctionReturnTypeRector
;
use
Rector
\
TypeDeclaration
\
Rector
\
ClassMethod
\
AddMethodCallBasedStrictParamTypeRector
;
use
Rector
\
TypeDeclaration
\
Rector
\
ClassMethod
\
ReturnNeverTypeRector
;
use
Rector
\
TypeDeclaration
\
Rector
\
Closure
\
AddClosureVoidReturnTypeWhereNoReturnRector
;
use
Rector
\
TypeDeclaration
\
Rector
\
Closure
\
ClosureReturnTypeRector
;
use
Rector
\
TypeDeclaration
\
Rector
\
Function_
\
AddFunctionVoidReturnTypeWhereNoReturnRector
;
use
Rector
\
TypeDeclaration
\
Rector
\
Property
\
TypedPropertyFromAssignsRector
;
use
Rector
\
TypeDeclaration
\
Rector
\
StmtsAwareInterface
\
DeclareStrictTypesRector
;
use
Rector
\
TypeDeclaration
\
Rector
\
StmtsAwareInterface
\
SafeDeclareStrictTypesRector
;
use
Utils
\
Rector
\
PassStrictParameterToFunctionParameterRector
;
use
Utils
\
Rector
\
RemoveErrorSuppressInTryCatchStmtsRector
;
use
Utils
\
Rector
\
UnderscoreToCamelCaseVariableNameRector
;
return
RectorConfig::
configure
()
->
withPhpSets
(php82:
true
)
->
withPreparedSets
(deadCode:
true
, codeQuality:
true
, instanceOf:
true
, phpunitCodeQuality:
true
)
->
withComposerBased
(phpunit:
true
)
->
withParallel
(
120
,
8
,
10
)
->
withCache
(
// Github action cache or local
is_dir
(
'
/tmp
'
) ?
'
/tmp/rector
'
:
null
,
FileCacheStorage::class,
)
// paths to refactor; solid alternative to CLI arguments
->
withPaths
([
__DIR__
.
'
/app
'
,
__DIR__
.
'
/system
'
,
__DIR__
.
'
/tests
'
,
__DIR__
.
'
/utils/src
'
,
])
->
withRootFiles
()
// do you need to include constants, class aliases or custom autoloader? files listed will be executed
->
withBootstrapFiles
([
__DIR__
.
'
/phpstan-bootstrap.php
'
,
])
->
withPHPStanConfigs
([
__DIR__
.
'
/phpstan.dist.neon
'
,
__DIR__
.
'
/vendor/codeigniter/phpstan-codeigniter/extension.neon
'
,
__DIR__
.
'
/vendor/phpstan/phpstan-strict-rules/rules.neon
'
,
__DIR__
.
'
/vendor/shipmonk/phpstan-baseline-per-identifier/extension.neon
'
,
])
// is there a file you need to skip?
->
withSkip
([
__DIR__
.
'
/system/Debug/Toolbar/Views/toolbar.tpl.php
'
,
__DIR__
.
'
/system/ThirdParty
'
,
__DIR__
.
'
/tests/system/Config/fixtures
'
,
__DIR__
.
'
/tests/system/Filters/fixtures
'
,
__DIR__
.
'
/tests/_support/Commands/Foobar.php
'
,
__DIR__
.
'
/tests/_support/View
'
,
__DIR__
.
'
/tests/system/View/Views
'
,
YieldDataProviderRector::class,
RemoveUnusedPrivateMethodRector::class => [
// private method called via getPrivateMethodInvoker
__DIR__
.
'
/tests/_support/Test/TestForReflectionHelper.php
'
,
],
RemoveUnusedConstructorParamRector::class => [
__DIR__
.
'
/system/HTTP/Response.php
'
,
],
// Keep property defaults for backward compatibility.
RemoveDefaultValueFromAssignedPropertyRector::class,
// Exclude test file because `is_cli()` is mocked and Rector might remove needed parameters.
RemoveExtraParametersRector::class => [
__DIR__
.
'
/tests/system/Debug/ToolbarTest.php
'
,
],
UnderscoreToCamelCaseVariableNameRector::class => [
// session handlers have the gc() method with underscored parameter `$max_lifetime`
__DIR__
.
'
/system/Session/Handlers
'
,
__DIR__
.
'
/tests/_support/Entity/CustomUser.php
'
,
],
DeclareStrictTypesRector::class => [
__DIR__
.
'
/app
'
,
__DIR__
.
'
/system/CodeIgniter.php
'
,
__DIR__
.
'
/system/Config/BaseConfig.php
'
,
__DIR__
.
'
/system/Test/ControllerTestTrait.php
'
,
__DIR__
.
'
/system/View/Parser.php
'
,
__DIR__
.
'
/tests/system/Debug/ExceptionsTest.php
'
,
],
// use mt_rand instead of random_int on purpose on non-cryptographically random
RandomFunctionRector::class,
// PHP 8.0 features but cause breaking changes
ClassPropertyAssignToConstructorPromotionRector::class => [
__DIR__
.
'
/system/Database/BaseResult.php
'
,
__DIR__
.
'
/system/Database/RawSql.php
'
,
__DIR__
.
'
/system/Debug/BaseExceptionHandler.php
'
,
__DIR__
.
'
/system/Filters/Filters.php
'
,
__DIR__
.
'
/system/HTTP/CURLRequest.php
'
,
__DIR__
.
'
/system/HTTP/DownloadResponse.php
'
,
__DIR__
.
'
/system/Security/Security.php
'
,
__DIR__
.
'
/system/Session/Session.php
'
,
],
ReturnNeverTypeRector::class => [
__DIR__
.
'
/system/CodeIgniter.php
'
,
__DIR__
.
'
/system/Database/MySQLi/Utils.php
'
,
__DIR__
.
'
/system/Database/OCI8/Utils.php
'
,
__DIR__
.
'
/system/Database/Postgre/Utils.php
'
,
__DIR__
.
'
/system/Database/SQLSRV/Utils.php
'
,
__DIR__
.
'
/system/Database/SQLite3/Utils.php
'
,
__DIR__
.
'
/system/HTTP/DownloadResponse.php
'
,
__DIR__
.
'
/system/HTTP/SiteURI.php
'
,
],
CompactToVariablesRector::class,
// possibly isset() on purpose, on updated Config classes property across versions
IssetOnPropertyObjectToPropertyExistsRector::class,
// some tests extended by other tests
FinalizeTestCaseClassRector::class,
DeclareStrictTypesTestsRector::class => [
__DIR__
.
'
/tests/system/Debug/ExceptionsTest.php
'
,
],
RemoveNullArgOnNullDefaultParamRector::class => [
// skip form query usage, easier to read
__DIR__
.
'
/system/Model.php
'
,
__DIR__
.
'
/tests/system/Database
'
,
__DIR__
.
'
/tests/system/Models
'
,
],
// to be applied in separate PRs to ease review
NegatedAndsToPositiveOrsRector::class,
SafeDeclareStrictTypesRector::class,
LocallyCalledStaticMethodToNonStaticRector::class,
])
// auto import fully qualified class names
->
withImportNames
()
->
withRules
([
DeclareStrictTypesRector::class,
UnderscoreToCamelCaseVariableNameRector::class,
SimplifyUselessVariableRector::class,
PassStrictParameterToFunctionParameterRector::class,
RemoveErrorSuppressInTryCatchStmtsRector::class,
FuncGetArgsToVariadicParamRector::class,
MakeInheritedMethodVisibilitySameAsParentRector::class,
PrivatizeFinalClassPropertyRector::class,
VersionCompareFuncCallToConstantRector::class,
AddClosureVoidReturnTypeWhereNoReturnRector::class,
AddFunctionVoidReturnTypeWhereNoReturnRector::class,
AddMethodCallBasedStrictParamTypeRector::class,
TypedPropertyFromAssignsRector::class,
ClosureReturnTypeRector::class,
AddArrowFunctionReturnTypeRector::class,
])
->
withConfiguredRule
(RenameConstantRector::class, [
'
FILTER_DEFAULT
'
=>
'
FILTER_UNSAFE_RAW
'
,
])
->
reportUnusedSkips
();
Back
|
FazBrowse Home
|
New Git URL