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