diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index d6c6832f85..666b26e2b7 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -4298,9 +4298,10 @@ public function getPhpDocs(Scope $scope, Node\FunctionLike|Node\Stmt\Property $n $docComment, ); } + $methodNameForInheritance = $node->getAttribute('originalTraitMethodName') ?? $node->name->name; $resolvedPhpDoc = $this->phpDocInheritanceResolver->resolvePhpDocForMethod( $scope->getClassReflection(), - $node->name->name, + $methodNameForInheritance, $currentResolvedPhpDoc, $positionalParameterNames, ); diff --git a/tests/PHPStan/Analyser/nsrt/bug-9733.php b/tests/PHPStan/Analyser/nsrt/bug-9733.php new file mode 100644 index 0000000000..cc496a71e9 --- /dev/null +++ b/tests/PHPStan/Analyser/nsrt/bug-9733.php @@ -0,0 +1,24 @@ +', $array); + } +} + +class Concrete extends Base{ + use MyTrait { + test as test2; + } +}