| Total Complexity | 5 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class VariableDefinitionNode extends AbstractNode implements DefinitionNodeInterface |
||
| 8 | { |
||
| 9 | use DefaultValueTrait; |
||
| 10 | use TypeTrait; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var VariableNode |
||
| 14 | */ |
||
| 15 | protected $variable; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * VariableDefinitionNode constructor. |
||
| 19 | * |
||
| 20 | * @param VariableNode $variable |
||
| 21 | * @param TypeNodeInterface $type |
||
| 22 | * @param ValueNodeInterface|null $defaultValue |
||
| 23 | * @param Location|null $location |
||
| 24 | */ |
||
| 25 | public function __construct( |
||
| 26 | VariableNode $variable, |
||
| 27 | TypeNodeInterface $type, |
||
| 28 | ?ValueNodeInterface $defaultValue, |
||
| 29 | ?Location $location |
||
| 30 | ) { |
||
| 31 | parent::__construct(NodeKindEnum::VARIABLE_DEFINITION, $location); |
||
| 32 | |||
| 33 | $this->variable = $variable; |
||
| 34 | $this->type = $type; |
||
| 35 | $this->defaultValue = $defaultValue; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return VariableNode |
||
| 40 | */ |
||
| 41 | public function getVariable(): VariableNode |
||
| 42 | { |
||
| 43 | return $this->variable; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return array |
||
| 48 | */ |
||
| 49 | public function getVariableAST(): array |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @inheritdoc |
||
| 56 | */ |
||
| 57 | public function __toString(): string |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @inheritdoc |
||
| 64 | */ |
||
| 65 | public function toAST(): array |
||
| 72 | ]; |
||
| 73 | } |
||
| 74 | } |
||
| 75 |