|
12 | 12 | use PHPStan\PhpDoc\Tag\ParamOutTag; |
13 | 13 | use PHPStan\PhpDoc\Tag\ParamTag; |
14 | 14 | use PHPStan\PhpDoc\Tag\PropertyTag; |
| 15 | +use PHPStan\PhpDoc\Tag\RequireExtendsTag; |
| 16 | +use PHPStan\PhpDoc\Tag\RequireImplementsTag; |
15 | 17 | use PHPStan\PhpDoc\Tag\ReturnTag; |
16 | 18 | use PHPStan\PhpDoc\Tag\SelfOutTypeTag; |
17 | 19 | use PHPStan\PhpDoc\Tag\TemplateTag; |
@@ -94,6 +96,12 @@ class ResolvedPhpDocBlock |
94 | 96 | /** @var array<MixinTag>|false */ |
95 | 97 | private array|false $mixinTags = false; |
96 | 98 |
|
| 99 | + /** @var array<RequireExtendsTag>|false */ |
| 100 | + private array|false $requireExtendsTags = false; |
| 101 | + |
| 102 | + /** @var array<RequireImplementsTag>|false */ |
| 103 | + private array|false $requireImplementsTags = false; |
| 104 | + |
97 | 105 | /** @var array<TypeAliasTag>|false */ |
98 | 106 | private array|false $typeAliasTags = false; |
99 | 107 |
|
@@ -181,6 +189,8 @@ public static function createEmpty(): self |
181 | 189 | $self->returnTag = null; |
182 | 190 | $self->throwsTag = null; |
183 | 191 | $self->mixinTags = []; |
| 192 | + $self->requireExtendsTags = []; |
| 193 | + $self->requireImplementsTags = []; |
184 | 194 | $self->typeAliasTags = []; |
185 | 195 | $self->typeAliasImportTags = []; |
186 | 196 | $self->assertTags = []; |
@@ -241,6 +251,8 @@ public function merge(array $parents, array $parentPhpDocBlocks): self |
241 | 251 | $result->returnTag = self::mergeReturnTags($this->getReturnTag(), $classReflection, $parents, $parentPhpDocBlocks); |
242 | 252 | $result->throwsTag = self::mergeThrowsTags($this->getThrowsTag(), $parents); |
243 | 253 | $result->mixinTags = $this->getMixinTags(); |
| 254 | + $result->requireExtendsTags = $this->getRequireExtendsTags(); |
| 255 | + $result->requireImplementsTags = $this->getRequireImplementsTags(); |
244 | 256 | $result->typeAliasTags = $this->getTypeAliasTags(); |
245 | 257 | $result->typeAliasImportTags = $this->getTypeAliasImportTags(); |
246 | 258 | $result->assertTags = self::mergeAssertTags($this->getAssertTags(), $parents, $parentPhpDocBlocks); |
@@ -336,6 +348,8 @@ public function changeParameterNamesByMapping(array $parameterNameMapping): self |
336 | 348 | $self->returnTag = $returnTag; |
337 | 349 | $self->throwsTag = $this->throwsTag; |
338 | 350 | $self->mixinTags = $this->mixinTags; |
| 351 | + $self->requireImplementsTags = $this->requireImplementsTags; |
| 352 | + $self->requireExtendsTags = $this->requireExtendsTags; |
339 | 353 | $self->typeAliasTags = $this->typeAliasTags; |
340 | 354 | $self->typeAliasImportTags = $this->typeAliasImportTags; |
341 | 355 | $self->assertTags = $assertTags; |
@@ -540,6 +554,36 @@ public function getMixinTags(): array |
540 | 554 | return $this->mixinTags; |
541 | 555 | } |
542 | 556 |
|
| 557 | + /** |
| 558 | + * @return array<RequireExtendsTag> |
| 559 | + */ |
| 560 | + public function getRequireExtendsTags(): array |
| 561 | + { |
| 562 | + if ($this->requireExtendsTags === false) { |
| 563 | + $this->requireExtendsTags = $this->phpDocNodeResolver->resolveRequireExtendsTags( |
| 564 | + $this->phpDocNode, |
| 565 | + $this->getNameScope(), |
| 566 | + ); |
| 567 | + } |
| 568 | + |
| 569 | + return $this->requireExtendsTags; |
| 570 | + } |
| 571 | + |
| 572 | + /** |
| 573 | + * @return array<RequireImplementsTag> |
| 574 | + */ |
| 575 | + public function getRequireImplementsTags(): array |
| 576 | + { |
| 577 | + if ($this->requireImplementsTags === false) { |
| 578 | + $this->requireImplementsTags = $this->phpDocNodeResolver->resolveRequireImplementsTags( |
| 579 | + $this->phpDocNode, |
| 580 | + $this->getNameScope(), |
| 581 | + ); |
| 582 | + } |
| 583 | + |
| 584 | + return $this->requireImplementsTags; |
| 585 | + } |
| 586 | + |
543 | 587 | /** |
544 | 588 | * @return array<TypeAliasTag> |
545 | 589 | */ |
|
0 commit comments