1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\PhpDocParser\Ast\Type;
4:
5: use PHPStan\PhpDocParser\Ast\NodeAttributes;
6:
7: class ArrayTypeNode implements TypeNode
8: {
9:
10: use NodeAttributes;
11:
12: public TypeNode $type;
13:
14: public function __construct(TypeNode $type)
15: {
16: $this->type = $type;
17: }
18:
19:
20: public function __toString(): string
21: {
22: if (
23: $this->type instanceof CallableTypeNode
24: || $this->type instanceof ConstTypeNode
25: || $this->type instanceof NullableTypeNode
26: ) {
27: return '(' . $this->type . ')[]';
28: }
29:
30: return $this->type . '[]';
31: }
32:
33: }
34: