Skip to content

Commit 9561166

Browse files
committed
chore: change for upgrade to PHP 8.1
1 parent f40b371 commit 9561166

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

rector.php

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
4444
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
4545
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
46+
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
47+
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
48+
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
49+
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
4650
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
4751
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector;
4852
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
@@ -54,6 +58,7 @@
5458
use Rector\Set\ValueObject\SetList;
5559
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
5660
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
61+
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
5762
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
5863
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
5964
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
@@ -63,7 +68,7 @@
6368
return static function (RectorConfig $rectorConfig): void {
6469
$rectorConfig->sets([
6570
SetList::DEAD_CODE,
66-
LevelSetList::UP_TO_PHP_74,
71+
LevelSetList::UP_TO_PHP_81,
6772
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
6873
PHPUnitSetList::PHPUNIT_100,
6974
]);
@@ -146,6 +151,47 @@
146151

147152
SimplifyRegexPatternRector::class,
148153

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

0 commit comments

Comments
 (0)