From 27ea23cdb551464efd6b14a9518320b3a4c9a695 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 25 Dec 2024 19:11:42 +0700 Subject: [PATCH] [CodeQuality] Skip compare NeverType on AssertEqualsToSameRector --- .../Rector/MethodCall/AssertEqualsToSameRector.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php b/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php index d998c47a..a353eff6 100644 --- a/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php +++ b/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php @@ -16,6 +16,7 @@ use PHPStan\Type\FloatType; use PHPStan\Type\IntegerType; use PHPStan\Type\MixedType; +use PHPStan\Type\NeverType; use PHPStan\Type\ObjectType; use PHPStan\Type\StringType; use PHPStan\Type\Type; @@ -126,6 +127,11 @@ public function refactor(Node $node): ?Node if ($secondArgType instanceof MixedType) { return null; } + + // can happen with magic process + if ($secondArgType instanceof NeverType) { + return null; + } } $hasChanged = $this->identifierManipulator->renameNodeWithMap($node, self::RENAME_METHODS_MAP);