Skip to content

Commit b5a05a0

Browse files
committed
chore: change for upgrade to PHP 8.1
1 parent 2f3cc3d commit b5a05a0

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

rector.php

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
4747
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
4848
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
49+
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
50+
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
51+
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
52+
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
4953
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
5054
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector;
5155
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
@@ -57,6 +61,7 @@
5761
use Rector\Set\ValueObject\SetList;
5862
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
5963
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
64+
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
6065
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
6166
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
6267
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
@@ -66,7 +71,7 @@
6671
return static function (RectorConfig $rectorConfig): void {
6772
$rectorConfig->sets([
6873
SetList::DEAD_CODE,
69-
LevelSetList::UP_TO_PHP_74,
74+
LevelSetList::UP_TO_PHP_81,
7075
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
7176
PHPUnitSetList::PHPUNIT_100,
7277
]);
@@ -155,6 +160,48 @@
155160

156161
SimplifyRegexPatternRector::class,
157162

163+
// PHP 8.0 features but cause breaking changes
164+
ClassPropertyAssignToConstructorPromotionRector::class => [
165+
__DIR__ . '/system/Database/BaseResult.php',
166+
__DIR__ . '/system/Database/RawSql.php',
167+
__DIR__ . '/system/Debug/BaseExceptionHandler.php',
168+
__DIR__ . '/system/Filters/Filters.php',
169+
__DIR__ . '/system/HTTP/CURLRequest.php',
170+
__DIR__ . '/system/HTTP/DownloadResponse.php',
171+
__DIR__ . '/system/HTTP/IncomingRequest.php',
172+
__DIR__ . '/system/Security/Security.php',
173+
__DIR__ . '/system/Session/Session.php',
174+
],
175+
MixedTypeRector::class,
176+
177+
// PHP 8.1 features but cause breaking changes
178+
FinalizePublicClassConstantRector::class => [
179+
__DIR__ . '/system/Cache/Handlers/BaseHandler.php',
180+
__DIR__ . '/system/Cache/Handlers/FileHandler.php',
181+
__DIR__ . '/system/CodeIgniter.php',
182+
__DIR__ . '/system/Events/Events.php',
183+
__DIR__ . '/system/Log/Handlers/ChromeLoggerHandler.php',
184+
__DIR__ . '/system/Log/Handlers/ErrorlogHandler.php',
185+
__DIR__ . '/system/Security/Security.php',
186+
],
187+
ReturnNeverTypeRector::class => [
188+
__DIR__ . '/system/Cache/Handlers/BaseHandler.php',
189+
__DIR__ . '/system/Cache/Handlers/MemcachedHandler.php',
190+
__DIR__ . '/system/Cache/Handlers/WincacheHandler.php',
191+
__DIR__ . '/system/CodeIgniter.php',
192+
__DIR__ . '/system/Database/MySQLi/Utils.php',
193+
__DIR__ . '/system/Database/OCI8/Utils.php',
194+
__DIR__ . '/system/Database/Postgre/Utils.php',
195+
__DIR__ . '/system/Database/SQLSRV/Utils.php',
196+
__DIR__ . '/system/Database/SQLite3/Utils.php',
197+
__DIR__ . '/system/HTTP/DownloadResponse.php',
198+
__DIR__ . '/system/HTTP/SiteURI.php',
199+
__DIR__ . '/system/Helpers/kint_helper.php',
200+
],
201+
202+
// Unnecessary (string) is inserted
203+
NullToStrictStringFuncCallArgRector::class,
204+
158205
// PHPUnit 10 (requires PHP 8.1) features
159206
DataProviderAnnotationToAttributeRector::class,
160207
DependsAnnotationWithValueToAttributeRector::class,

0 commit comments

Comments
 (0)