1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\PhpDocParser\Ast\Type; |
4: | |
5: | use PHPStan\PhpDocParser\Ast\Node; |
6: | use PHPStan\PhpDocParser\Ast\NodeAttributes; |
7: | use function sprintf; |
8: | |
9: | class ArrayShapeUnsealedTypeNode implements Node |
10: | { |
11: | |
12: | use NodeAttributes; |
13: | |
14: | public TypeNode $valueType; |
15: | |
16: | public ?TypeNode $keyType = null; |
17: | |
18: | public function __construct(TypeNode $valueType, ?TypeNode $keyType) |
19: | { |
20: | $this->valueType = $valueType; |
21: | $this->keyType = $keyType; |
22: | } |
23: | |
24: | public function __toString(): string |
25: | { |
26: | if ($this->keyType !== null) { |
27: | return sprintf('<%s, %s>', $this->keyType, $this->valueType); |
28: | } |
29: | return sprintf('<%s>', $this->valueType); |
30: | } |
31: | |
32: | } |
33: | |