| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\PhpDocParser\Ast\Type; |
| 4: | |
| 5: | use PHPStan\PhpDocParser\Ast\NodeAttributes; |
| 6: | use function implode; |
| 7: | |
| 8: | class ArrayShapeNode implements TypeNode |
| 9: | { |
| 10: | |
| 11: | use NodeAttributes; |
| 12: | |
| 13: | |
| 14: | public $items; |
| 15: | |
| 16: | |
| 17: | public $sealed; |
| 18: | |
| 19: | public function __construct(array $items, bool $sealed = true) |
| 20: | { |
| 21: | $this->items = $items; |
| 22: | $this->sealed = $sealed; |
| 23: | } |
| 24: | |
| 25: | |
| 26: | public function __toString(): string |
| 27: | { |
| 28: | $items = $this->items; |
| 29: | |
| 30: | if (! $this->sealed) { |
| 31: | $items[] = '...'; |
| 32: | } |
| 33: | |
| 34: | return 'array{' . implode(', ', $items) . '}'; |
| 35: | } |
| 36: | |
| 37: | } |
| 38: | |