@@ -9,7 +9,6 @@ |
||
9 | 9 | |
10 | 10 | namespace Railt\Compiler\Grammar\PP2\Delegate; |
11 | 11 | |
12 | -use Railt\Parser\Ast\Rule; |
|
13 | 12 | use Railt\Parser\Rule\Symbol; |
14 | 13 | |
15 | 14 | /** |
@@ -26,7 +26,7 @@ |
||
26 | 26 | return $this->getRule(); |
27 | 27 | } |
28 | 28 | |
29 | - dd((string)$first); |
|
29 | + dd((string) $first); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | private function getRule(): Symbol |
@@ -31,7 +31,7 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | - * @param RuleInterface|NodeInterface $repetition |
|
34 | + * @param null|NodeInterface $repetition |
|
35 | 35 | * @return array |
36 | 36 | */ |
37 | 37 | private function getInterval(RuleInterface $repetition): array |
@@ -10,7 +10,6 @@ |
||
10 | 10 | namespace Railt\Compiler\Grammar\PP2\Delegate; |
11 | 11 | |
12 | 12 | use Railt\Parser\Ast\NodeInterface; |
13 | -use Railt\Parser\Ast\Rule; |
|
14 | 13 | use Railt\Parser\Ast\RuleInterface; |
15 | 14 | use Railt\Parser\Rule\Repetition; |
16 | 15 | use Railt\Parser\Rule\Symbol; |
@@ -37,17 +37,17 @@ discard block |
||
37 | 37 | private function getInterval(RuleInterface $repetition): array |
38 | 38 | { |
39 | 39 | switch (true) { |
40 | - case (bool)$repetition->first('T_ZERO_OR_MORE'): |
|
40 | + case (bool) $repetition->first('T_ZERO_OR_MORE'): |
|
41 | 41 | return [0, Repetition::INF_MAX_VALUE]; |
42 | 42 | |
43 | - case (bool)$repetition->first('T_ONE_OR_MORE'): |
|
43 | + case (bool) $repetition->first('T_ONE_OR_MORE'): |
|
44 | 44 | return [1, Repetition::INF_MAX_VALUE]; |
45 | 45 | |
46 | - case (bool)$repetition->first('T_ZERO_OR_ONE'): |
|
46 | + case (bool) $repetition->first('T_ZERO_OR_ONE'): |
|
47 | 47 | return [0, 1]; |
48 | 48 | |
49 | - case (bool)($repeat = $repetition->first('Repeat')): |
|
50 | - $value = (int)$repeat->first('T_NUMBER')->getValue(); |
|
49 | + case (bool) ($repeat = $repetition->first('Repeat')): |
|
50 | + $value = (int) $repeat->first('T_NUMBER')->getValue(); |
|
51 | 51 | |
52 | 52 | return [$value, $value]; |
53 | 53 | break; |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | $from = $to = Repetition::INF_MAX_VALUE; |
57 | 57 | |
58 | 58 | if ($nodeFrom = $repetition->first('From')) { |
59 | - $from = (int)$nodeFrom->first('T_NUMBER')->getValue(); |
|
59 | + $from = (int) $nodeFrom->first('T_NUMBER')->getValue(); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | if ($nodeTo = $repetition->first('To')) { |
63 | - $to = (int)$nodeTo->first('T_NUMBER')->getValue(); |
|
63 | + $to = (int) $nodeTo->first('T_NUMBER')->getValue(); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return [$from, $to]; |
@@ -38,26 +38,26 @@ |
||
38 | 38 | |
39 | 39 | public function all(): array |
40 | 40 | { |
41 | - throw new \LogicException(__METHOD__ . ' not implemented yet'); |
|
41 | + throw new \LogicException(__METHOD__.' not implemented yet'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function getDelegates(): iterable |
45 | 45 | { |
46 | - throw new \LogicException(__METHOD__ . ' not implemented yet'); |
|
46 | + throw new \LogicException(__METHOD__.' not implemented yet'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | public function getFile(string $rule): Readable |
50 | 50 | { |
51 | - throw new \LogicException(__METHOD__ . ' not implemented yet'); |
|
51 | + throw new \LogicException(__METHOD__.' not implemented yet'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function has(string $rule): bool |
55 | 55 | { |
56 | - throw new \LogicException(__METHOD__ . ' not implemented yet'); |
|
56 | + throw new \LogicException(__METHOD__.' not implemented yet'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public function isKeep(string $rule): bool |
60 | 60 | { |
61 | - throw new \LogicException(__METHOD__ . ' not implemented yet'); |
|
61 | + throw new \LogicException(__METHOD__.' not implemented yet'); |
|
62 | 62 | } |
63 | 63 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function add(Readable $grammar): GrammarInterface |
189 | 189 | { |
190 | - if (! $this->isLoaded($grammar)) { |
|
190 | + if (!$this->isLoaded($grammar)) { |
|
191 | 191 | $this->env->share(static::ENV_FILE, $grammar); |
192 | 192 | $this->load($grammar); |
193 | 193 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | $loaded = \in_array($grammar->getHash(), $this->loaded, true); |
205 | 205 | |
206 | - if (! $loaded) { |
|
206 | + if (!$loaded) { |
|
207 | 207 | $this->loaded[] = $grammar->getHash(); |
208 | 208 | } |
209 | 209 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | if ($resolver->match($name)) { |
36 | 36 | $resolved = $resolver->resolve($name); |
37 | 37 | |
38 | - if (! $resolved) { |
|
38 | + if (!$resolved) { |
|
39 | 39 | throw $this->badPragma($name, $value)->throwsIn($readable, $rule->getOffset()); |
40 | 40 | } |
41 | 41 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $this->setToken($rule->getDefinitionName(), $rule->getDefinitionValue()); |
30 | 30 | |
31 | - if (! $rule->isKept()) { |
|
31 | + if (!$rule->isKept()) { |
|
32 | 32 | $this->makeSkipped($rule->getDefinitionName()); |
33 | 33 | } |
34 | 34 | } |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | |
56 | 56 | try { |
57 | 57 | foreach (self::FILE_EXTENSIONS as $ext) { |
58 | - if (\is_file($path . $ext)) { |
|
59 | - return File::fromPathname($path . $ext); |
|
58 | + if (\is_file($path.$ext)) { |
|
59 | + return File::fromPathname($path.$ext); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private function getIncludePathname(): string |
76 | 76 | { |
77 | - $path = \dirname($this->file->getPathname()) . '/' . $this->getIncludeValue(); |
|
77 | + $path = \dirname($this->file->getPathname()).'/'.$this->getIncludeValue(); |
|
78 | 78 | |
79 | 79 | return \str_replace(['\\\\', '\\'], '/', $path); |
80 | 80 | } |