| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\PhpDocParser\Ast\Type; |
| 4: | |
| 5: | use PHPStan\PhpDocParser\Ast\NodeAttributes; |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | class TemplateDeclarationTypeNode implements TypeNode |
| 17: | { |
| 18: | |
| 19: | use NodeAttributes; |
| 20: | |
| 21: | public string $name; |
| 22: | |
| 23: | public TypeNode $bound; |
| 24: | |
| 25: | public function __construct(string $name, TypeNode $bound) |
| 26: | { |
| 27: | $this->name = $name; |
| 28: | $this->bound = $bound; |
| 29: | } |
| 30: | |
| 31: | public function __toString(): string |
| 32: | { |
| 33: | return "{$this->name} of {$this->bound}"; |
| 34: | } |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public static function __set_state(array $properties): self |
| 40: | { |
| 41: | $instance = new self($properties['name'], $properties['bound']); |
| 42: | if (isset($properties['attributes'])) { |
| 43: | foreach ($properties['attributes'] as $key => $value) { |
| 44: | $instance->setAttribute($key, $value); |
| 45: | } |
| 46: | } |
| 47: | return $instance; |
| 48: | } |
| 49: | |
| 50: | } |
| 51: | |