|
137 | 137 | use PHPStan\Php\PhpVersion; |
138 | 138 | use PHPStan\PhpDoc\PhpDocInheritanceResolver; |
139 | 139 | use PHPStan\PhpDoc\ResolvedPhpDocBlock; |
| 140 | +use PHPStan\PhpDoc\StubPhpDocProvider; |
140 | 141 | use PHPStan\PhpDoc\Tag\VarTag; |
141 | 142 | use PHPStan\Reflection\Assertions; |
142 | 143 | use PHPStan\Reflection\Callables\CallableParametersAcceptor; |
@@ -267,6 +268,7 @@ public function __construct( |
267 | 268 | #[AutowiredParameter(ref: '@defaultAnalysisParser')] |
268 | 269 | private readonly Parser $parser, |
269 | 270 | private readonly FileTypeMapper $fileTypeMapper, |
| 271 | + private readonly StubPhpDocProvider $stubPhpDocProvider, |
270 | 272 | private readonly PhpVersion $phpVersion, |
271 | 273 | private readonly PhpDocInheritanceResolver $phpDocInheritanceResolver, |
272 | 274 | private readonly FileHelper $fileHelper, |
@@ -7446,12 +7448,20 @@ public function getPhpDocs(Scope $scope, Node\FunctionLike|Node\Stmt\Property $n |
7446 | 7448 | return $param->var->name; |
7447 | 7449 | }, $node->getParams()); |
7448 | 7450 | $currentResolvedPhpDoc = null; |
7449 | | - if ($docComment !== null) { |
| 7451 | + if ($class !== null) { |
| 7452 | + $currentResolvedPhpDoc = $this->stubPhpDocProvider->findMethodPhpDoc( |
| 7453 | + $class, |
| 7454 | + $class, |
| 7455 | + $functionName, |
| 7456 | + $positionalParameterNames, |
| 7457 | + ); |
| 7458 | + } |
| 7459 | + if ($currentResolvedPhpDoc === null && $docComment !== null) { |
7450 | 7460 | $currentResolvedPhpDoc = $this->fileTypeMapper->getResolvedPhpDoc( |
7451 | 7461 | $file, |
7452 | 7462 | $class, |
7453 | 7463 | $trait, |
7454 | | - $node->name->name, |
| 7464 | + $functionName, |
7455 | 7465 | $docComment, |
7456 | 7466 | ); |
7457 | 7467 | } |
|
0 commit comments