diff --git a/rector.php b/rector.php index 6ee2738f2618..5e19e8e01413 100644 --- a/rector.php +++ b/rector.php @@ -28,6 +28,7 @@ use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector; use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector; use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; +use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector; use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector; @@ -149,6 +150,7 @@ $rectorConfig->rule(CompleteDynamicPropertiesRector::class); $rectorConfig->rule(BooleanInIfConditionRuleFixerRector::class); $rectorConfig->rule(SingleInArrayToCompareRector::class); + $rectorConfig->rule(VersionCompareFuncCallToConstantRector::class); $rectorConfig ->ruleWithConfiguration(StringClassNameToClassConstantRector::class, [ diff --git a/system/Autoloader/Autoloader.php b/system/Autoloader/Autoloader.php index 2f9b13c0b818..088c850efa58 100644 --- a/system/Autoloader/Autoloader.php +++ b/system/Autoloader/Autoloader.php @@ -346,11 +346,7 @@ public function sanitizeFilename(string $filename): string ); } if ($result === false) { - if (version_compare(PHP_VERSION, '8.0.0', '>=')) { - $message = preg_last_error_msg(); - } else { - $message = 'Regex error. error code: ' . preg_last_error(); - } + $message = PHP_VERSION_ID >= 80000 ? preg_last_error_msg() : 'Regex error. error code: ' . preg_last_error(); throw new RuntimeException($message . '. filename: "' . $filename . '"'); }