2020-07-18 18:57:24 +02:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2023-12-01 09:49:11 +00:00
|
|
|
namespace RectorPrefix202312;
|
2020-07-18 18:57:24 +02:00
|
|
|
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
|
|
|
|
use Rector\CodeQuality\Rector\Assign\CombinedAssignRector;
|
|
|
|
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
|
|
|
|
use Rector\CodeQuality\Rector\BooleanNot\ReplaceMultipleBooleanNotRector;
|
|
|
|
use Rector\CodeQuality\Rector\BooleanNot\SimplifyDeMorganBinaryRector;
|
|
|
|
use Rector\CodeQuality\Rector\Catch_\ThrowWithPreviousExceptionRector;
|
|
|
|
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
|
2022-07-19 21:15:00 +00:00
|
|
|
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
|
2023-06-08 14:55:39 +00:00
|
|
|
use Rector\CodeQuality\Rector\ClassConstFetch\ConvertStaticPrivateConstantToSelfRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
|
2023-06-16 14:09:13 +00:00
|
|
|
use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector;
|
2022-12-02 14:15:07 +00:00
|
|
|
use Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector;
|
2022-12-02 14:15:07 +00:00
|
|
|
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\Equal\UseIdenticalOverEqualWithSameTypeRector;
|
|
|
|
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
|
2022-06-29 16:03:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\Expression\TernaryFalseExpressionToIfRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector;
|
|
|
|
use Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector;
|
|
|
|
use Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector;
|
|
|
|
use Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToCoalescingRector;
|
|
|
|
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\ArrayMergeOfNonArraysToSimpleArrayRector;
|
2022-09-20 13:34:09 +00:00
|
|
|
use Rector\CodeQuality\Rector\FuncCall\BoolvalToTypeCastRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\FuncCall\CallUserFuncWithArrowFunctionToInlineRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
|
2022-09-20 13:34:09 +00:00
|
|
|
use Rector\CodeQuality\Rector\FuncCall\FloatvalToTypeCastRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\FuncCall\InlineIsAInstanceOfRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\IsAWithStringWithThirdArgumentRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\RemoveSoleValueSprintfRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\SetTypeToCastRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\SimplifyFuncGetArgsCountRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\SimplifyInArrayValuesRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector;
|
2022-09-20 13:34:09 +00:00
|
|
|
use Rector\CodeQuality\Rector\FuncCall\StrvalToTypeCastRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\FuncCall\UnwrapSprintfOneArgumentRector;
|
|
|
|
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
|
|
|
|
use Rector\CodeQuality\Rector\Identical\BooleanNotIdenticalToNotIdenticalRector;
|
|
|
|
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
|
|
|
|
use Rector\CodeQuality\Rector\Identical\GetClassToInstanceOfRector;
|
|
|
|
use Rector\CodeQuality\Rector\Identical\SimplifyArraySearchRector;
|
|
|
|
use Rector\CodeQuality\Rector\Identical\SimplifyBoolIdenticalTrueRector;
|
|
|
|
use Rector\CodeQuality\Rector\Identical\SimplifyConditionsRector;
|
|
|
|
use Rector\CodeQuality\Rector\Identical\StrlenZeroToIdenticalEmptyStringRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\CombineIfRector;
|
2023-10-05 14:38:05 +00:00
|
|
|
use Rector\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\SimplifyIfNotNullReturnRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\SimplifyIfNullableReturnRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
|
|
|
|
use Rector\CodeQuality\Rector\Include_\AbsolutizeRequireAndIncludePathRector;
|
|
|
|
use Rector\CodeQuality\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector;
|
|
|
|
use Rector\CodeQuality\Rector\LogicalAnd\AndAssignsToSeparateLinesRector;
|
|
|
|
use Rector\CodeQuality\Rector\LogicalAnd\LogicalToBooleanRector;
|
|
|
|
use Rector\CodeQuality\Rector\New_\NewStaticToNewSelfRector;
|
|
|
|
use Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector;
|
2023-05-08 14:07:26 +00:00
|
|
|
use Rector\CodeQuality\Rector\NullsafeMethodCall\CleanupUnneededNullsafeOperatorRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\Switch_\SingularSwitchToIfRector;
|
2023-03-29 07:34:40 +00:00
|
|
|
use Rector\CodeQuality\Rector\Switch_\SwitchTrueToIfRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector;
|
2023-09-05 13:21:31 +00:00
|
|
|
use Rector\CodeQuality\Rector\Ternary\NumberCompareToMaxFuncCallRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector;
|
|
|
|
use Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector;
|
2022-11-01 19:57:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector;
|
|
|
|
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
|
|
|
|
use Rector\CodingStyle\Rector\FuncCall\CallUserFuncToMethodCallRector;
|
|
|
|
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
|
|
|
|
use Rector\Config\RectorConfig;
|
|
|
|
use Rector\Php52\Rector\Property\VarToPublicPropertyRector;
|
|
|
|
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
|
|
|
|
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
2023-05-08 20:28:23 +00:00
|
|
|
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
|
2022-06-07 08:22:29 +00:00
|
|
|
return static function (RectorConfig $rectorConfig) : void {
|
|
|
|
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
|
2021-05-09 20:15:43 +00:00
|
|
|
'split' => 'explode',
|
|
|
|
'join' => 'implode',
|
|
|
|
'sizeof' => 'count',
|
|
|
|
# https://www.php.net/manual/en/aliases.php
|
|
|
|
'chop' => 'rtrim',
|
|
|
|
'doubleval' => 'floatval',
|
|
|
|
'gzputs' => 'gzwrites',
|
|
|
|
'fputs' => 'fwrite',
|
|
|
|
'ini_alter' => 'ini_set',
|
|
|
|
'is_double' => 'is_float',
|
|
|
|
'is_integer' => 'is_int',
|
|
|
|
'is_long' => 'is_int',
|
|
|
|
'is_real' => 'is_float',
|
|
|
|
'is_writeable' => 'is_writable',
|
|
|
|
'key_exists' => 'array_key_exists',
|
|
|
|
'pos' => 'current',
|
|
|
|
'strchr' => 'strstr',
|
|
|
|
# mb
|
|
|
|
'mbstrcut' => 'mb_strcut',
|
|
|
|
'mbstrlen' => 'mb_strlen',
|
|
|
|
'mbstrpos' => 'mb_strpos',
|
|
|
|
'mbstrrpos' => 'mb_strrpos',
|
|
|
|
'mbsubstr' => 'mb_substr',
|
2021-11-30 13:55:08 +00:00
|
|
|
]);
|
2023-10-05 14:38:05 +00:00
|
|
|
$rectorConfig->rules([CombinedAssignRector::class, SimplifyEmptyArrayCheckRector::class, ReplaceMultipleBooleanNotRector::class, ForeachToInArrayRector::class, SimplifyForeachToCoalescingRector::class, SimplifyFuncGetArgsCountRector::class, SimplifyInArrayValuesRector::class, SimplifyStrposLowerRector::class, GetClassToInstanceOfRector::class, SimplifyArraySearchRector::class, SimplifyConditionsRector::class, SimplifyIfNotNullReturnRector::class, SimplifyIfReturnBoolRector::class, SimplifyUselessVariableRector::class, UnnecessaryTernaryExpressionRector::class, RemoveExtraParametersRector::class, SimplifyDeMorganBinaryRector::class, SimplifyTautologyTernaryRector::class, SingleInArrayToCompareRector::class, SimplifyIfElseToTernaryRector::class, JoinStringConcatRector::class, ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class, ExplicitBoolCompareRector::class, CombineIfRector::class, UseIdenticalOverEqualWithSameTypeRector::class, SimplifyBoolIdenticalTrueRector::class, SimplifyRegexPatternRector::class, BooleanNotIdenticalToNotIdenticalRector::class, StrvalToTypeCastRector::class, FloatvalToTypeCastRector::class, CallableThisArrayToAnonymousFunctionRector::class, AndAssignsToSeparateLinesRector::class, CompactToVariablesRector::class, CompleteDynamicPropertiesRector::class, IsAWithStringWithThirdArgumentRector::class, StrlenZeroToIdenticalEmptyStringRector::class, ThrowWithPreviousExceptionRector::class, RemoveSoleValueSprintfRector::class, ShortenElseIfRector::class, ArrayMergeOfNonArraysToSimpleArrayRector::class, IntvalToTypeCastRector::class, BoolvalToTypeCastRector::class, ArrayKeyExistsTernaryThenValueToCoalescingRector::class, AbsolutizeRequireAndIncludePathRector::class, ChangeArrayPushToArrayAssignRector::class, ForRepeatedCountToOwnVariableRector::class, ForeachItemsAssignToEmptyArrayToAssignRector::class, InlineIfToExplicitIfRector::class, UnusedForeachValueToArrayKeysRector::class, CommonNotEqualRector::class, SetTypeToCastRector::class, LogicalToBooleanRector::class, VarToPublicPropertyRector::class, IssetOnPropertyObjectToPropertyExistsRector::class, NewStaticToNewSelfRector::class, UnwrapSprintfOneArgumentRector::class, SwitchNegatedTernaryRector::class, SingularSwitchToIfRector::class, SimplifyIfNullableReturnRector::class, FuncGetArgsToVariadicParamRector::class, CallUserFuncToMethodCallRector::class, CallUserFuncWithArrowFunctionToInlineRector::class, CountArrayToEmptyArrayComparisonRector::class, FlipTypeControlToUseExclusiveTypeRector::class, InlineArrayReturnAssignRector::class, InlineIsAInstanceOfRector::class, TernaryFalseExpressionToIfRector::class, InlineConstructorDefaultToPropertyRector::class, TernaryEmptyArrayArrayDimFetchToCoalesceRector::class, OptionalParametersAfterRequiredRector::class, SimplifyEmptyCheckOnEmptyArrayRector::class, SwitchTrueToIfRector::class, CleanupUnneededNullsafeOperatorRector::class, DisallowedEmptyRuleFixerRector::class, ConvertStaticPrivateConstantToSelfRector::class, LocallyCalledStaticMethodToNonStaticRector::class, NumberCompareToMaxFuncCallRector::class, CompleteMissingIfElseBracketRector::class]);
|
2020-07-18 18:57:24 +02:00
|
|
|
};
|