From cb12687e79da80cef35c5dfbb60df6fc97b00672 Mon Sep 17 00:00:00 2001 From: Caleb White Date: Tue, 9 Dec 2025 13:26:42 -0600 Subject: [PATCH] fix: skip non-native methods --- .../ArrowFunctionAndClosureFirstClassCallableGuard.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/CodingStyle/Guard/ArrowFunctionAndClosureFirstClassCallableGuard.php b/rules/CodingStyle/Guard/ArrowFunctionAndClosureFirstClassCallableGuard.php index 7b709d5e3f7..7dd566ed90f 100644 --- a/rules/CodingStyle/Guard/ArrowFunctionAndClosureFirstClassCallableGuard.php +++ b/rules/CodingStyle/Guard/ArrowFunctionAndClosureFirstClassCallableGuard.php @@ -18,7 +18,7 @@ use PhpParser\Node\Param; use PhpParser\NodeVisitor; use PHPStan\Analyser\Scope; -use PHPStan\Reflection\Annotations\AnnotationMethodReflection; +use PHPStan\Reflection\MethodReflection; use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; @@ -95,8 +95,8 @@ public function shouldSkip( return true; } - // exists, but by @method annotation - if ($reflection instanceof AnnotationMethodReflection && ! $reflection->getDeclaringClass()->hasNativeMethod( + // phpstan reports first class callables that are not native methods + if ($reflection instanceof MethodReflection && ! $reflection->getDeclaringClass()->hasNativeMethod( $reflection->getName() )) { return true;