From 3cc1a545641b172b2cb1e89030cde9baa6b0c527 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Wed, 13 Mar 2024 09:46:40 +0100 Subject: [PATCH] MethodReturnStatementsNode - use ExtendedMethodReflection --- src/Analyser/NodeScopeResolver.php | 2 +- src/Node/MethodReturnStatementsNode.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index 30fca50479..22ce258111 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -634,7 +634,7 @@ private function processStmtNode( $classReflection = $scope->getClassReflection(); $methodReflection = $methodScope->getFunction(); - if (!$methodReflection instanceof MethodReflection) { + if (!$methodReflection instanceof ExtendedMethodReflection) { throw new ShouldNotHappenException(); } diff --git a/src/Node/MethodReturnStatementsNode.php b/src/Node/MethodReturnStatementsNode.php index fe7aa691fb..edf8e216bc 100644 --- a/src/Node/MethodReturnStatementsNode.php +++ b/src/Node/MethodReturnStatementsNode.php @@ -8,7 +8,7 @@ use PhpParser\NodeAbstract; use PHPStan\Analyser\StatementResult; use PHPStan\Reflection\ClassReflection; -use PHPStan\Reflection\MethodReflection; +use PHPStan\Reflection\ExtendedMethodReflection; use function count; /** @api */ @@ -29,7 +29,7 @@ public function __construct( private StatementResult $statementResult, private array $executionEnds, private ClassReflection $classReflection, - private MethodReflection $methodReflection, + private ExtendedMethodReflection $methodReflection, ) { parent::__construct($method->getAttributes()); @@ -76,7 +76,7 @@ public function getClassReflection(): ClassReflection return $this->classReflection; } - public function getMethodReflection(): MethodReflection + public function getMethodReflection(): ExtendedMethodReflection { return $this->methodReflection; }