diff --git a/src/Dependency/DependencyResolver.php b/src/Dependency/DependencyResolver.php index deba626f86..e7a07dc1f1 100644 --- a/src/Dependency/DependencyResolver.php +++ b/src/Dependency/DependencyResolver.php @@ -16,6 +16,7 @@ use PHPStan\Node\InClassMethodNode; use PHPStan\Node\InClassNode; use PHPStan\Node\InFunctionNode; +use PHPStan\Node\InTraitNode; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\ParameterReflectionWithPhpDocs; @@ -45,7 +46,7 @@ public function resolveDependencies(Node $node, Scope $scope): NodeDependencies { $dependenciesReflections = []; - if ($node instanceof InClassNode) { + if ($node instanceof InClassNode || $node instanceof InTraitNode) { $docComment = $node->getDocComment(); if ($docComment !== null) { $phpDoc = $this->fileTypeMapper->getResolvedPhpDoc(