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 ObjectShapeNode implements TypeNode
9: {
10:
11: use NodeAttributes;
12:
13: /** @var ObjectShapeItemNode[] */
14: public array $items;
15:
16: /**
17: * @param ObjectShapeItemNode[] $items
18: */
19: public function __construct(array $items)
20: {
21: $this->items = $items;
22: }
23:
24: public function __toString(): string
25: {
26: $items = $this->items;
27:
28: return 'object{' . implode(', ', $items) . '}';
29: }
30:
31: /**
32: * @param array<string, mixed> $properties
33: */
34: public static function __set_state(array $properties): self
35: {
36: $instance = new self($properties['items']);
37: if (isset($properties['attributes'])) {
38: foreach ($properties['attributes'] as $key => $value) {
39: $instance->setAttribute($key, $value);
40: }
41: }
42: return $instance;
43: }
44:
45: }
46: