| 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: | public string $importedAlias; |
| 15: | |
| 16: | public IdentifierTypeNode $importedFrom; |
| 17: | |
| 18: | public ?string $importedAs = null; |
| 19: | |
| 20: | public function __construct(string $importedAlias, IdentifierTypeNode $importedFrom, ?string $importedAs) |
| 21: | { |
| 22: | $this->importedAlias = $importedAlias; |
| 23: | $this->importedFrom = $importedFrom; |
| 24: | $this->importedAs = $importedAs; |
| 25: | } |
| 26: | |
| 27: | public function __toString(): string |
| 28: | { |
| 29: | return trim( |
| 30: | "{$this->importedAlias} from {$this->importedFrom}" |
| 31: | . ($this->importedAs !== null ? " as {$this->importedAs}" : ''), |
| 32: | ); |
| 33: | } |
| 34: | |
| 35: | } |
| 36: | |