1: | <?php declare(strict_types=1); |
2: | |
3: | namespace PhpParser\Node; |
4: | |
5: | class NullableType extends ComplexType |
6: | { |
7: | /** @var Identifier|Name Type */ |
8: | public $type; |
9: | |
10: | /** |
11: | * Constructs a nullable type (wrapping another type). |
12: | * |
13: | * @param string|Identifier|Name $type Type |
14: | * @param array $attributes Additional attributes |
15: | */ |
16: | public function __construct($type, array $attributes = []) { |
17: | $this->attributes = $attributes; |
18: | $this->type = \is_string($type) ? new Identifier($type) : $type; |
19: | } |
20: | |
21: | public function getSubNodeNames() : array { |
22: | return ['type']; |
23: | } |
24: | |
25: | public function getType() : string { |
26: | return 'NullableType'; |
27: | } |
28: | } |
29: |