Skip to content

Commit 1a0ccc6

Browse files
committed
chore: change for upgrade to PHP 8.1
1 parent b50cfbd commit 1a0ccc6

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
@@ -44,6 +44,10 @@
4444
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
4545
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
4646
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
47+
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
48+
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
49+
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
50+
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
4751
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
4852
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector;
4953
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
@@ -55,6 +59,7 @@
5559
use Rector\Set\ValueObject\SetList;
5660
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
5761
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
62+
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
5863
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
5964
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
6065
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
@@ -64,7 +69,7 @@
6469
return static function (RectorConfig $rectorConfig): void {
6570
$rectorConfig->sets([
6671
SetList::DEAD_CODE,
67-
LevelSetList::UP_TO_PHP_74,
72+
LevelSetList::UP_TO_PHP_81,
6873
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
6974
PHPUnitSetList::PHPUNIT_100,
7075
]);
@@ -147,6 +152,48 @@
147152

148153
SimplifyRegexPatternRector::class,
149154

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

0 commit comments

Comments
 (0)