diff --git a/rules-tests/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector/Fixture/static_call_next_exception.php.inc b/rules-tests/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector/Fixture/static_call_next_exception.php.inc new file mode 100644 index 000000000000..a1340cbad0a6 --- /dev/null +++ b/rules-tests/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector/Fixture/static_call_next_exception.php.inc @@ -0,0 +1,39 @@ + +----- + diff --git a/rules-tests/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector/Source/MyException.php b/rules-tests/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector/Source/MyException.php new file mode 100644 index 000000000000..cc1cb179f589 --- /dev/null +++ b/rules-tests/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector/Source/MyException.php @@ -0,0 +1,11 @@ +class; + if (! $class instanceof Name) { + return false; + } + + $throwableType = new ObjectType('Throwable'); + $type = new ObjectType($class->toString()); + + return $throwableType->isSuperTypeOf($type)->yes(); + } + private function hasCall(Node $node): bool { return (bool) $this->betterNodeFinder->findFirst($node, function (Node $n): bool { - if ($n instanceof StaticCall) { + if ($n instanceof StaticCall && ! $this->isClassCallerThrowable($n)) { return true; }