|
41 | 41 | use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
42 | 42 | use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
|
43 | 43 | 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; |
44 | 53 | use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
|
45 | 54 | use Rector\PHPUnit\Set\PHPUnitSetList;
|
46 | 55 | use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
|
47 | 56 | use Rector\Set\ValueObject\LevelSetList;
|
48 | 57 | use Rector\Set\ValueObject\SetList;
|
49 | 58 | use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
|
50 | 59 | use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
|
| 60 | +use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector; |
51 | 61 | use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
|
52 | 62 | use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
|
53 | 63 | use Utils\Rector\PassStrictParameterToFunctionParameterRector;
|
|
57 | 67 | return static function (RectorConfig $rectorConfig): void {
|
58 | 68 | $rectorConfig->sets([
|
59 | 69 | SetList::DEAD_CODE,
|
60 |
| - LevelSetList::UP_TO_PHP_74, |
| 70 | + LevelSetList::UP_TO_PHP_81, |
61 | 71 | PHPUnitSetList::PHPUNIT_CODE_QUALITY,
|
62 | 72 | PHPUnitSetList::PHPUNIT_100,
|
63 | 73 | ]);
|
|
133 | 143 | RandomFunctionRector::class,
|
134 | 144 |
|
135 | 145 | 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, |
136 | 194 | ]);
|
137 | 195 |
|
138 | 196 | // auto import fully qualified class names
|
|
0 commit comments