Skip to content

Commit 4a389b8

Browse files
committed
chore: change for upgrade to PHP 8.1
1 parent b7bced6 commit 4a389b8

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

rector.php

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,22 @@
4040
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
4141
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
4242
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
43+
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
44+
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
45+
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
46+
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
47+
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
48+
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
49+
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector;
50+
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
51+
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DependsAnnotationWithValueToAttributeRector;
4352
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
4453
use Rector\PHPUnit\Set\PHPUnitSetList;
4554
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
4655
use Rector\Set\ValueObject\LevelSetList;
4756
use Rector\Set\ValueObject\SetList;
4857
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
58+
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
4959
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
5060
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
5161
use Utils\Rector\RemoveErrorSuppressInTryCatchStmtsRector;
@@ -54,7 +64,7 @@
5464
return static function (RectorConfig $rectorConfig): void {
5565
$rectorConfig->sets([
5666
SetList::DEAD_CODE,
57-
LevelSetList::UP_TO_PHP_74,
67+
LevelSetList::UP_TO_PHP_81,
5868
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
5969
PHPUnitSetList::PHPUNIT_100,
6070
]);
@@ -130,6 +140,54 @@
130140
RandomFunctionRector::class,
131141

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

135193
// auto import fully qualified class names

0 commit comments

Comments
 (0)