Skip to content

Commit f962917

Browse files
committed
chore: change for upgrade to PHP 8.1
1 parent b451206 commit f962917

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
@@ -41,13 +41,23 @@
4141
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
4242
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
4343
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
44+
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
45+
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
46+
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
47+
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
48+
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
49+
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
50+
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector;
51+
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
52+
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DependsAnnotationWithValueToAttributeRector;
4453
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
4554
use Rector\PHPUnit\Set\PHPUnitSetList;
4655
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
4756
use Rector\Set\ValueObject\LevelSetList;
4857
use Rector\Set\ValueObject\SetList;
4958
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
5059
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
60+
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
5161
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
5262
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
5363
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
@@ -57,7 +67,7 @@
5767
return static function (RectorConfig $rectorConfig): void {
5868
$rectorConfig->sets([
5969
SetList::DEAD_CODE,
60-
LevelSetList::UP_TO_PHP_74,
70+
LevelSetList::UP_TO_PHP_81,
6171
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
6272
PHPUnitSetList::PHPUNIT_100,
6373
]);
@@ -133,6 +143,54 @@
133143
RandomFunctionRector::class,
134144

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

138196
// auto import fully qualified class names

0 commit comments

Comments
 (0)