2020-07-18 18:57:24 +02:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2022-09-01 09:30:44 +00:00
|
|
|
namespace RectorPrefix202209;
|
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\Assign\SplitListAssignToSeparateLineRector;
|
|
|
|
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;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
|
|
|
|
use Rector\CodeQuality\Rector\ClassMethod\NarrowUnionTypeDocRector;
|
|
|
|
use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector;
|
|
|
|
use Rector\CodeQuality\Rector\Do_\DoWhileBreakFalseToIfElseRector;
|
|
|
|
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\For_\ForToForeachRector;
|
|
|
|
use Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector;
|
|
|
|
use Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector;
|
|
|
|
use Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToArrayFilterRector;
|
|
|
|
use Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToCoalescingRector;
|
|
|
|
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\AddPregQuoteDelimiterRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\ArrayMergeOfNonArraysToSimpleArrayRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\CallUserFuncWithArrowFunctionToInlineRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
|
|
|
|
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;
|
|
|
|
use Rector\CodeQuality\Rector\FuncCall\UnwrapSprintfOneArgumentRector;
|
|
|
|
use Rector\CodeQuality\Rector\FunctionLike\RemoveAlwaysTrueConditionSetInConstructorRector;
|
|
|
|
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;
|
|
|
|
use Rector\CodeQuality\Rector\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
|
|
|
|
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
|
2022-07-19 22:22:01 +00:00
|
|
|
use Rector\CodeQuality\Rector\If_\SimplifyIfExactValueReturnValueRector;
|
2022-06-06 17:12:56 +00:00
|
|
|
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;
|
|
|
|
use Rector\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector;
|
|
|
|
use Rector\CodeQuality\Rector\Switch_\SingularSwitchToIfRector;
|
|
|
|
use Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector;
|
|
|
|
use Rector\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector;
|
|
|
|
use Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector;
|
|
|
|
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;
|
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
|
|
|
]);
|
2022-08-24 08:28:31 +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, SimplifyForeachToArrayFilterRector::class, SingleInArrayToCompareRector::class, SimplifyIfElseToTernaryRector::class, JoinStringConcatRector::class, ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class, ExplicitBoolCompareRector::class, CombineIfRector::class, UseIdenticalOverEqualWithSameTypeRector::class, SimplifyBoolIdenticalTrueRector::class, SimplifyRegexPatternRector::class, BooleanNotIdenticalToNotIdenticalRector::class, CallableThisArrayToAnonymousFunctionRector::class, AndAssignsToSeparateLinesRector::class, ForToForeachRector::class, CompactToVariablesRector::class, CompleteDynamicPropertiesRector::class, IsAWithStringWithThirdArgumentRector::class, StrlenZeroToIdenticalEmptyStringRector::class, RemoveAlwaysTrueConditionSetInConstructorRector::class, ThrowWithPreviousExceptionRector::class, RemoveSoleValueSprintfRector::class, ShortenElseIfRector::class, AddPregQuoteDelimiterRector::class, ArrayMergeOfNonArraysToSimpleArrayRector::class, IntvalToTypeCastRector::class, ArrayKeyExistsTernaryThenValueToCoalescingRector::class, AbsolutizeRequireAndIncludePathRector::class, ChangeArrayPushToArrayAssignRector::class, ForRepeatedCountToOwnVariableRector::class, ForeachItemsAssignToEmptyArrayToAssignRector::class, InlineIfToExplicitIfRector::class, ArrayKeysAndInArrayToArrayKeyExistsRector::class, SplitListAssignToSeparateLineRector::class, UnusedForeachValueToArrayKeysRector::class, CommonNotEqualRector::class, SetTypeToCastRector::class, LogicalToBooleanRector::class, VarToPublicPropertyRector::class, IssetOnPropertyObjectToPropertyExistsRector::class, NewStaticToNewSelfRector::class, UnwrapSprintfOneArgumentRector::class, SwitchNegatedTernaryRector::class, SingularSwitchToIfRector::class, SimplifyIfNullableReturnRector::class, NarrowUnionTypeDocRector::class, FuncGetArgsToVariadicParamRector::class, CallUserFuncToMethodCallRector::class, CallUserFuncWithArrowFunctionToInlineRector::class, CountArrayToEmptyArrayComparisonRector::class, FlipTypeControlToUseExclusiveTypeRector::class, ExplicitMethodCallOverMagicGetSetRector::class, DoWhileBreakFalseToIfElseRector::class, InlineArrayReturnAssignRector::class, InlineIsAInstanceOfRector::class, TernaryFalseExpressionToIfRector::class, InlineConstructorDefaultToPropertyRector::class, SimplifyIfExactValueReturnValueRector::class]);
|
2020-07-18 18:57:24 +02:00
|
|
|
};
|