/** * Visit a node with kind `\ast\AST_CLASS_CONST_DECL` * * @param Node $node * A node to parse * * @return Context * A new or an unchanged context resulting from * parsing the node */ public function visitClassConstDecl(Node $node) : Context { $clazz = $this->getContextClass(); foreach ($node->children ?? [] as $child_node) { $constant = new Constant($this->context->withLineNumberStart($child_node->lineno ?? 0)->withLineNumberEnd($child_node->endLineno ?? 0), $child_node->children['name'], new UnionType(), $child_node->flags ?? 0); $constant->setFutureUnionType(new FutureUnionType($this->code_base, $this->context, $child_node->children['value'])); $clazz->addConstant($this->code_base, $constant); } return $this->context; }