diff --git a/config/set/instanceof.php b/config/set/instanceof.php index 9305d1c8240..bdd7eb6f575 100644 --- a/config/set/instanceof.php +++ b/config/set/instanceof.php @@ -2,23 +2,9 @@ declare(strict_types=1); -use Rector\CodeQuality\Rector\FuncCall\InlineIsAInstanceOfRector; -use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector; use Rector\Config\RectorConfig; -use Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector; -use Rector\Instanceof_\Rector\Ternary\FlipNegatedTernaryInstanceofRector; -use Rector\TypeDeclaration\Rector\BooleanAnd\BinaryOpNullableToInstanceofRector; -use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector; -use Rector\TypeDeclaration\Rector\While_\WhileNullableToInstanceofRector; +// note: all instanceof rules were moved to code quality and type declaration sets return static function (RectorConfig $rectorConfig): void { - $rectorConfig->rules([ - EmptyOnNullableObjectToInstanceOfRector::class, - InlineIsAInstanceOfRector::class, - FlipTypeControlToUseExclusiveTypeRector::class, - RemoveDeadInstanceOfRector::class, - FlipNegatedTernaryInstanceofRector::class, - BinaryOpNullableToInstanceofRector::class, - WhileNullableToInstanceofRector::class, - ]); + $rectorConfig->rules([]); }; diff --git a/src/Config/Level/TypeDeclarationLevel.php b/src/Config/Level/TypeDeclarationLevel.php index f76e8b39fa2..1deb2643fcc 100644 --- a/src/Config/Level/TypeDeclarationLevel.php +++ b/src/Config/Level/TypeDeclarationLevel.php @@ -8,6 +8,7 @@ use Rector\Contract\Rector\RectorInterface; use Rector\Symfony\CodeQuality\Rector\ClassMethod\ResponseReturnTypeControllerActionRector; use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector; +use Rector\TypeDeclaration\Rector\BooleanAnd\BinaryOpNullableToInstanceofRector; use Rector\TypeDeclaration\Rector\Class_\AddTestsVoidReturnTypeWhereNoReturnRector; use Rector\TypeDeclaration\Rector\Class_\ChildDoctrineRepositoryClassTypeRector; use Rector\TypeDeclaration\Rector\Class_\MergeDateTimePropertyTypeDeclarationRector; @@ -78,6 +79,7 @@ use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector; +use Rector\TypeDeclaration\Rector\While_\WhileNullableToInstanceofRector; final class TypeDeclarationLevel { @@ -126,6 +128,8 @@ final class TypeDeclarationLevel // php 7.4 EmptyOnNullableObjectToInstanceOfRector::class, + WhileNullableToInstanceofRector::class, + BinaryOpNullableToInstanceofRector::class, // php 7.4 TypedPropertyFromStrictConstructorRector::class, diff --git a/src/Set/ValueObject/SetList.php b/src/Set/ValueObject/SetList.php index 5683b300cda..69edadc1645 100644 --- a/src/Set/ValueObject/SetList.php +++ b/src/Set/ValueObject/SetList.php @@ -131,6 +131,9 @@ final class SetList */ public const string EARLY_RETURN = __DIR__ . '/../../../config/set/early-return.php'; + /** + * @deprecated Use code-quality set instead, as most instanceof rules were moved there + */ public const string INSTANCEOF = __DIR__ . '/../../../config/set/instanceof.php'; public const string IF = __DIR__ . '/../../../config/set/if.php';