Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function matchNext(...$args): Token |
||
27 | { |
||
28 | $token = $this->nextToken(); |
||
29 | |||
30 | if ($token === null) { |
||
31 | throw new TokenizerException('Unexpected end of string.'); |
||
32 | } elseif ($this->isCurrent(...$args) === false) { |
||
33 | [$line, $col] = Tokenizer::getCoordinates($token->value, $token->offset); |
||
34 | |||
35 | throw new TokenizerException( |
||
36 | sprintf( |
||
37 | 'Unexpected "%s" on line %d, column %d.', |
||
38 | trim($token->value), |
||
39 | $line, |
||
40 | $col |
||
41 | ) |
||
42 | ); |
||
43 | } |
||
44 | |||
45 | return $token; |
||
46 | } |
||
58 |