From 325b0f70e50e4113bc5af4e98aa404db5c569a06 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 14 Oct 2026 23:54:52 +0200 Subject: [PATCH] [TypeDeclaration] Speed up AddReturnTypeDeclarationRector by resolving class reflection only for static return type --- .../Rector/ClassMethod/AddReturnTypeDeclarationRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php index 3f3960ae553..df82301c892 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php @@ -154,8 +154,8 @@ private function processClassMethodNodeWithTypehints( return; } - $classReflection = $this->reflectionResolver->resolveClassReflection($classMethod); if ($classMethod->returnType instanceof Node && $newType instanceof SimpleStaticType) { + $classReflection = $this->reflectionResolver->resolveClassReflection($classMethod); if (! $classReflection instanceof ClassReflection) { return; }