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