| Conditions | 3 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function build(LexerInterface $lexer, array $params): ?array |
||
| 24 | { |
||
| 25 | $start = $lexer->getToken(); |
||
| 26 | |||
| 27 | $this->expectKeyword($lexer, KeywordEnum::EXTEND); |
||
| 28 | $this->expectKeyword($lexer, KeywordEnum::UNION); |
||
| 29 | |||
| 30 | $name = $this->buildAST(ASTKindEnum::NAME, $lexer); |
||
| 31 | $directives = $this->buildAST(ASTKindEnum::DIRECTIVES, $lexer); |
||
| 32 | $types = $this->buildAST(ASTKindEnum::UNION_MEMBER_TYPES, $lexer); |
||
| 33 | |||
| 34 | if (count($directives) === 0 && count($types) === 0) { |
||
| 35 | throw $this->unexpected($lexer); |
||
| 36 | } |
||
| 37 | |||
| 38 | return [ |
||
| 39 | 'kind' => NodeKindEnum::UNION_TYPE_EXTENSION, |
||
| 40 | 'name' => $name, |
||
| 41 | 'directives' => $directives, |
||
| 42 | 'types' => $types, |
||
| 43 | 'loc' => $this->buildLocation($lexer, $start), |
||
| 44 | ]; |
||
| 47 |