1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\PhpDocParser\Ast\PhpDoc; |
4: | |
5: | use PHPStan\PhpDocParser\Ast\NodeAttributes; |
6: | use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; |
7: | use function trim; |
8: | |
9: | class TypeAliasImportTagValueNode implements PhpDocTagValueNode |
10: | { |
11: | |
12: | use NodeAttributes; |
13: | |
14: | |
15: | public $importedAlias; |
16: | |
17: | |
18: | public $importedFrom; |
19: | |
20: | |
21: | public $importedAs; |
22: | |
23: | public function __construct(string $importedAlias, IdentifierTypeNode $importedFrom, ?string $importedAs) |
24: | { |
25: | $this->importedAlias = $importedAlias; |
26: | $this->importedFrom = $importedFrom; |
27: | $this->importedAs = $importedAs; |
28: | } |
29: | |
30: | public function __toString(): string |
31: | { |
32: | return trim( |
33: | "{$this->importedAlias} from {$this->importedFrom}" |
34: | . ($this->importedAs !== null ? " as {$this->importedAs}" : '') |
35: | ); |
36: | } |
37: | |
38: | } |
39: | |