mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Updated Rector to commit 0972dedb01bbc4ff1fa83965ffd8b26ab172f1eb
0972dedb01
Extend dead-code set (#2687)
This commit is contained in:
parent
9b6234b1bc
commit
3d514a7b40
@ -57,6 +57,7 @@ use Rector\CodeQuality\Rector\If_\ConsecutiveNullCompareReturnsToNullCoalesceQue
|
||||
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
|
||||
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
|
||||
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
|
||||
use Rector\CodeQuality\Rector\If_\SimplifyIfExactValueReturnValueRector;
|
||||
use Rector\CodeQuality\Rector\If_\SimplifyIfIssetToNullCoalescingRector;
|
||||
use Rector\CodeQuality\Rector\If_\SimplifyIfNotNullReturnRector;
|
||||
use Rector\CodeQuality\Rector\If_\SimplifyIfNullableReturnRector;
|
||||
@ -106,5 +107,5 @@ return static function (RectorConfig $rectorConfig) : void {
|
||||
'mbstrrpos' => 'mb_strrpos',
|
||||
'mbsubstr' => 'mb_substr',
|
||||
]);
|
||||
$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, SimplifyIfIssetToNullCoalescingRector::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]);
|
||||
$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, SimplifyIfIssetToNullCoalescingRector::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]);
|
||||
};
|
||||
|
@ -10,6 +10,7 @@ use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
|
||||
use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector;
|
||||
use Rector\CodingStyle\Rector\ClassConst\SplitGroupedConstantsAndPropertiesRector;
|
||||
use Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector;
|
||||
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
|
||||
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
|
||||
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
|
||||
use Rector\CodingStyle\Rector\ClassMethod\RemoveDoubleUnderscoreInMethodNameRector;
|
||||
@ -22,6 +23,7 @@ use Rector\CodingStyle\Rector\FuncCall\CallUserFuncToMethodCallRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\StrictArraySearchRector;
|
||||
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
|
||||
use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector;
|
||||
use Rector\CodingStyle\Rector\Plus\UseIncrementAssignRector;
|
||||
@ -37,5 +39,5 @@ use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
||||
use Rector\Transform\Rector\FuncCall\FuncCallToConstFetchRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->ruleWithConfiguration(FuncCallToConstFetchRector::class, ['php_sapi_name' => 'PHP_SAPI', 'pi' => 'M_PI']);
|
||||
$rectorConfig->rules([SeparateMultiUseImportsRector::class, RemoveDoubleUnderscoreInMethodNameRector::class, PostIncDecToPreIncDecRector::class, UnSpreadOperatorRector::class, NewlineAfterStatementRector::class, RemoveFinalFromConstRector::class, NullableCompareToNullRector::class, BinarySwitchToIfElseRector::class, ConsistentImplodeRector::class, TernaryConditionVariableAssignmentRector::class, SymplifyQuoteEscapeRector::class, SplitGroupedConstantsAndPropertiesRector::class, StringClassNameToClassConstantRector::class, ConsistentPregDelimiterRector::class, CatchExceptionNameMatchingTypeRector::class, UseIncrementAssignRector::class, SplitDoubleAssignRector::class, VarConstantCommentRector::class, EncapsedStringsToSprintfRector::class, WrapEncapsedVariableInCurlyBracesRector::class, NewlineBeforeNewAssignSetRector::class, AddArrayDefaultToArrayPropertyRector::class, AddFalseDefaultToBoolPropertyRector::class, MakeInheritedMethodVisibilitySameAsParentRector::class, CallUserFuncArrayToVariadicRector::class, VersionCompareFuncCallToConstantRector::class, StaticArrowFunctionRector::class, StaticClosureRector::class, CountArrayToEmptyArrayComparisonRector::class, CallUserFuncToMethodCallRector::class]);
|
||||
$rectorConfig->rules([SeparateMultiUseImportsRector::class, RemoveDoubleUnderscoreInMethodNameRector::class, PostIncDecToPreIncDecRector::class, UnSpreadOperatorRector::class, NewlineAfterStatementRector::class, RemoveFinalFromConstRector::class, NullableCompareToNullRector::class, BinarySwitchToIfElseRector::class, ConsistentImplodeRector::class, TernaryConditionVariableAssignmentRector::class, SymplifyQuoteEscapeRector::class, SplitGroupedConstantsAndPropertiesRector::class, StringClassNameToClassConstantRector::class, ConsistentPregDelimiterRector::class, CatchExceptionNameMatchingTypeRector::class, UseIncrementAssignRector::class, SplitDoubleAssignRector::class, VarConstantCommentRector::class, EncapsedStringsToSprintfRector::class, WrapEncapsedVariableInCurlyBracesRector::class, NewlineBeforeNewAssignSetRector::class, AddArrayDefaultToArrayPropertyRector::class, AddFalseDefaultToBoolPropertyRector::class, MakeInheritedMethodVisibilitySameAsParentRector::class, CallUserFuncArrayToVariadicRector::class, VersionCompareFuncCallToConstantRector::class, StaticArrowFunctionRector::class, StaticClosureRector::class, CountArrayToEmptyArrayComparisonRector::class, CallUserFuncToMethodCallRector::class, FuncGetArgsToVariadicParamRector::class, StrictArraySearchRector::class]);
|
||||
};
|
||||
|
@ -32,6 +32,7 @@ use Rector\DeadCode\Rector\For_\RemoveDeadLoopRector;
|
||||
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
|
||||
use Rector\DeadCode\Rector\FunctionLike\RemoveDeadReturnRector;
|
||||
use Rector\DeadCode\Rector\FunctionLike\RemoveDuplicatedIfReturnRector;
|
||||
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;
|
||||
use Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector;
|
||||
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
|
||||
use Rector\DeadCode\Rector\If_\SimplifyIfElseWithSameContentRector;
|
||||
@ -39,7 +40,9 @@ use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfFunctionExistsRector;
|
||||
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
|
||||
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
|
||||
use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector;
|
||||
use Rector\DeadCode\Rector\Plus\RemoveDeadZeroAndOneOperationRector;
|
||||
use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector;
|
||||
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
|
||||
use Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector;
|
||||
use Rector\DeadCode\Rector\Return_\RemoveDeadConditionAboveReturnRector;
|
||||
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
|
||||
@ -95,9 +98,12 @@ return static function (RectorConfig $rectorConfig) : void {
|
||||
RemoveUselessParamTagRector::class,
|
||||
RemoveUselessReturnTagRector::class,
|
||||
RemoveNonExistingVarAnnotationRector::class,
|
||||
RemoveUselessVarTagRector::class,
|
||||
RemoveUnusedPromotedPropertyRector::class,
|
||||
RemoveLastReturnRector::class,
|
||||
RemoveJustPropertyFetchForAssignRector::class,
|
||||
RemoveJustVariableAssignRector::class,
|
||||
RemoveAlwaysTrueIfConditionRector::class,
|
||||
RemoveDeadZeroAndOneOperationRector::class,
|
||||
]);
|
||||
};
|
||||
|
@ -54,11 +54,7 @@ final class StrictNativeFunctionReturnTypeAnalyzer
|
||||
if (!$this->hasClassMethodRootReturn($functionLike)) {
|
||||
return null;
|
||||
}
|
||||
$nativeCalls = $this->exclusiveNativeCallLikeReturnMatcher->match($returns);
|
||||
if ($nativeCalls === null) {
|
||||
return null;
|
||||
}
|
||||
return $nativeCalls;
|
||||
return $this->exclusiveNativeCallLikeReturnMatcher->match($returns);
|
||||
}
|
||||
/**
|
||||
* @param Return_[] $returns
|
||||
|
@ -17,12 +17,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'b492d2077dfb0ee9c08664747c0c3e8ed73dbc97';
|
||||
public const PACKAGE_VERSION = '0972dedb01bbc4ff1fa83965ffd8b26ab172f1eb';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-07-19 21:10:08';
|
||||
public const RELEASE_DATE = '2022-07-19 22:16:53';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit60114bd7ab6bf17371ef2d2be4cad5bd::getLoader();
|
||||
return ComposerAutoloaderInit465d20bff5269b973aad54552691f5f6::getLoader();
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit60114bd7ab6bf17371ef2d2be4cad5bd
|
||||
class ComposerAutoloaderInit465d20bff5269b973aad54552691f5f6
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,19 +22,19 @@ class ComposerAutoloaderInit60114bd7ab6bf17371ef2d2be4cad5bd
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit60114bd7ab6bf17371ef2d2be4cad5bd', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit465d20bff5269b973aad54552691f5f6', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit60114bd7ab6bf17371ef2d2be4cad5bd', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit465d20bff5269b973aad54552691f5f6', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit60114bd7ab6bf17371ef2d2be4cad5bd::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit465d20bff5269b973aad54552691f5f6::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit60114bd7ab6bf17371ef2d2be4cad5bd::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit465d20bff5269b973aad54552691f5f6::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire60114bd7ab6bf17371ef2d2be4cad5bd($fileIdentifier, $file);
|
||||
composerRequire465d20bff5269b973aad54552691f5f6($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -46,7 +46,7 @@ class ComposerAutoloaderInit60114bd7ab6bf17371ef2d2be4cad5bd
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire60114bd7ab6bf17371ef2d2be4cad5bd($fileIdentifier, $file)
|
||||
function composerRequire465d20bff5269b973aad54552691f5f6($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit60114bd7ab6bf17371ef2d2be4cad5bd
|
||||
class ComposerStaticInit465d20bff5269b973aad54552691f5f6
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
@ -3406,9 +3406,9 @@ class ComposerStaticInit60114bd7ab6bf17371ef2d2be4cad5bd
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit60114bd7ab6bf17371ef2d2be4cad5bd::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit60114bd7ab6bf17371ef2d2be4cad5bd::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit60114bd7ab6bf17371ef2d2be4cad5bd::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit465d20bff5269b973aad54552691f5f6::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit465d20bff5269b973aad54552691f5f6::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit465d20bff5269b973aad54552691f5f6::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user