@@ -92,7 +92,7 @@ |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
95 | - * @return mixed|null |
|
95 | + * @return \Railt\Lexer\TokenInterface |
|
96 | 96 | */ |
97 | 97 | public function current() |
98 | 98 | { |
@@ -15,7 +15,6 @@ |
||
15 | 15 | use Railt\Lexer\LexerInterface; |
16 | 16 | use Railt\Parser\Parser; |
17 | 17 | use Railt\Parser\ParserInterface; |
18 | -use Railt\Parser\Rule\Token; |
|
19 | 18 | |
20 | 19 | /** |
21 | 20 | * Class Runtime |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $this->tokens[$name] = $value; |
44 | 44 | |
45 | 45 | if ($group !== null) { |
46 | - $this->groups[$name] = (int)$group; |
|
46 | + $this->groups[$name] = (int) $group; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | if ($token->name() === 'T_SKIP') { |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - if (! \array_key_exists($this->current, $this->rules)) { |
|
58 | + if (!\array_key_exists($this->current, $this->rules)) { |
|
59 | 59 | $this->rules[$this->current] = []; |
60 | 60 | } |
61 | 61 | |
62 | - if (! \array_key_exists($this->current, $this->files)) { |
|
62 | + if (!\array_key_exists($this->current, $this->files)) { |
|
63 | 63 | $this->files[$this->current] = $readable; |
64 | 64 | } |
65 | 65 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function resolveDelegate(string $delegate, Readable $readable, TokenInterface $token): void |
117 | 117 | { |
118 | - if (! \class_exists($delegate)) { |
|
118 | + if (!\class_exists($delegate)) { |
|
119 | 119 | $error = 'Could not found delegate class "%s"'; |
120 | 120 | throw (new GrammarException(\sprintf($error, $delegate))) |
121 | 121 | ->throwsIn($readable, $token->offset()); |
122 | 122 | } |
123 | 123 | |
124 | - if (! \is_subclass_of($delegate, Delegate::class)) { |
|
124 | + if (!\is_subclass_of($delegate, Delegate::class)) { |
|
125 | 125 | $error = 'Delegate should be an instance of %s, but %s given'; |
126 | 126 | throw (new GrammarException(\sprintf($error, Delegate::class, $delegate))) |
127 | 127 | ->throwsIn($readable, $token->offset()); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $this->stack->push($current = $this->root($rule)); |
92 | 92 | |
93 | 93 | while ($iterator->valid()) { |
94 | - $this->text .= $iterator->current()->value() . ' '; |
|
94 | + $this->text .= $iterator->current()->value().' '; |
|
95 | 95 | |
96 | 96 | $this->reduce($iterator->current(), $iterator); |
97 | 97 | $iterator->next(); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | private function reduceToken(TokenInterface $token, bool $keep): int |
190 | 190 | { |
191 | - $key = $token->value(1) . ':' . $token->name(); |
|
191 | + $key = $token->value(1).':'.$token->name(); |
|
192 | 192 | |
193 | 193 | $builder = new TokenBuilder($this->getId($key), $token->value(1), $keep); |
194 | 194 |