|
7 | 7 | use PHPStan\PhpDoc\Tag\ParamTag;
|
8 | 8 | use PHPStan\PhpDoc\Tag\ReturnTag;
|
9 | 9 | use PHPStan\PhpDoc\Tag\ThrowsTag;
|
| 10 | +use PHPStan\PhpDoc\Tag\TypeAliasImportTag; |
| 11 | +use PHPStan\PhpDoc\Tag\TypeAliasTag; |
10 | 12 | use PHPStan\PhpDoc\Tag\TypedTag;
|
11 | 13 | use PHPStan\PhpDoc\Tag\VarTag;
|
12 | 14 | use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
@@ -64,6 +66,12 @@ class ResolvedPhpDocBlock
|
64 | 66 | /** @var array<MixinTag>|false */
|
65 | 67 | private $mixinTags = false;
|
66 | 68 |
|
| 69 | + /** @var array<TypeAliasTag>|false */ |
| 70 | + private $typeAliasTags = false; |
| 71 | + |
| 72 | + /** @var array<TypeAliasImportTag>|false */ |
| 73 | + private $typeAliasImportTags = false; |
| 74 | + |
67 | 75 | /** @var \PHPStan\PhpDoc\Tag\DeprecatedTag|false|null */
|
68 | 76 | private $deprecatedTag = false;
|
69 | 77 |
|
@@ -133,6 +141,8 @@ public static function createEmpty(): self
|
133 | 141 | $self->returnTag = null;
|
134 | 142 | $self->throwsTag = null;
|
135 | 143 | $self->mixinTags = [];
|
| 144 | + $self->typeAliasTags = []; |
| 145 | + $self->typeAliasImportTags = []; |
136 | 146 | $self->deprecatedTag = null;
|
137 | 147 | $self->isDeprecated = false;
|
138 | 148 | $self->isInternal = false;
|
@@ -176,6 +186,8 @@ public function merge(array $parents, array $parentPhpDocBlocks): self
|
176 | 186 | $result->returnTag = self::mergeReturnTags($this->getReturnTag(), $parents, $parentPhpDocBlocks);
|
177 | 187 | $result->throwsTag = self::mergeThrowsTags($this->getThrowsTag(), $parents);
|
178 | 188 | $result->mixinTags = $this->getMixinTags();
|
| 189 | + $result->typeAliasTags = $this->getTypeAliasTags(); |
| 190 | + $result->typeAliasImportTags = $this->getTypeAliasImportTags(); |
179 | 191 | $result->deprecatedTag = $this->getDeprecatedTag();
|
180 | 192 | $result->isDeprecated = $result->deprecatedTag !== null;
|
181 | 193 | $result->isInternal = $this->isInternal();
|
@@ -219,6 +231,9 @@ public function changeParameterNamesByMapping(array $parameterNameMapping): self
|
219 | 231 | $self->paramTags = $newParamTags;
|
220 | 232 | $self->returnTag = $this->returnTag;
|
221 | 233 | $self->throwsTag = $this->throwsTag;
|
| 234 | + $self->mixinTags = $this->mixinTags; |
| 235 | + $self->typeAliasTags = $this->typeAliasTags; |
| 236 | + $self->typeAliasImportTags = $this->typeAliasImportTags; |
222 | 237 | $self->deprecatedTag = $this->deprecatedTag;
|
223 | 238 | $self->isDeprecated = $this->isDeprecated;
|
224 | 239 | $self->isInternal = $this->isInternal;
|
@@ -399,6 +414,36 @@ public function getMixinTags(): array
|
399 | 414 | return $this->mixinTags;
|
400 | 415 | }
|
401 | 416 |
|
| 417 | + /** |
| 418 | + * @return array<TypeAliasTag> |
| 419 | + */ |
| 420 | + public function getTypeAliasTags(): array |
| 421 | + { |
| 422 | + if ($this->typeAliasTags === false) { |
| 423 | + $this->typeAliasTags = $this->phpDocNodeResolver->resolveTypeAliasTags( |
| 424 | + $this->phpDocNode, |
| 425 | + $this->getNameScope() |
| 426 | + ); |
| 427 | + } |
| 428 | + |
| 429 | + return $this->typeAliasTags; |
| 430 | + } |
| 431 | + |
| 432 | + /** |
| 433 | + * @return array<TypeAliasImportTag> |
| 434 | + */ |
| 435 | + public function getTypeAliasImportTags(): array |
| 436 | + { |
| 437 | + if ($this->typeAliasImportTags === false) { |
| 438 | + $this->typeAliasImportTags = $this->phpDocNodeResolver->resolveTypeAliasImportTags( |
| 439 | + $this->phpDocNode, |
| 440 | + $this->getNameScope() |
| 441 | + ); |
| 442 | + } |
| 443 | + |
| 444 | + return $this->typeAliasImportTags; |
| 445 | + } |
| 446 | + |
402 | 447 | public function getDeprecatedTag(): ?\PHPStan\PhpDoc\Tag\DeprecatedTag
|
403 | 448 | {
|
404 | 449 | if ($this->deprecatedTag === false) {
|
|
0 commit comments