@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function __toString(): string |
69 | 69 | { |
70 | - $result = $this->getHeader() . \PHP_EOL; |
|
71 | - $result .= 'Stack trace:' . \PHP_EOL; |
|
70 | + $result = $this->getHeader().\PHP_EOL; |
|
71 | + $result .= 'Stack trace:'.\PHP_EOL; |
|
72 | 72 | $result .= $this->getFullTraceAsString(); |
73 | 73 | |
74 | 74 | return $result; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | if ($this->stack) { |
85 | 85 | foreach ($this->stack as $def) { |
86 | - $result .= \sprintf('#%d %s(%d): %s', $i++, $def->getFile(), $def->getLine(), $def) . \PHP_EOL; |
|
86 | + $result .= \sprintf('#%d %s(%d): %s', $i++, $def->getFile(), $def->getLine(), $def).\PHP_EOL; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | |
95 | - $result .= \preg_replace('/#\d+\h/iu', \sprintf('#%d ', $i++), $line) . "\n"; |
|
95 | + $result .= \preg_replace('/#\d+\h/iu', \sprintf('#%d ', $i++), $line)."\n"; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $result; |
@@ -37,11 +37,11 @@ |
||
37 | 37 | $ast = (new Parser())->parse(File::fromPathname($this->argument('schema'))); |
38 | 38 | |
39 | 39 | if ($root = $this->option('find')) { |
40 | - foreach ($ast->find((string)$root) as $child) { |
|
41 | - $this->writeln((string)$child); |
|
40 | + foreach ($ast->find((string) $root) as $child) { |
|
41 | + $this->writeln((string) $child); |
|
42 | 42 | } |
43 | 43 | } else { |
44 | - $this->writeln((string)$ast); |
|
44 | + $this->writeln((string) $ast); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | } |
@@ -82,7 +82,7 @@ |
||
82 | 82 | */ |
83 | 83 | public function autoload(\Closure $then): void |
84 | 84 | { |
85 | - $this->dictionary->onTypeNotFound(function (string $type, ?Definition $from) use ($then): void { |
|
85 | + $this->dictionary->onTypeNotFound(function(string $type, ?Definition $from) use ($then) : void { |
|
86 | 86 | if (($file = $then($type, $from)) instanceof Readable) { |
87 | 87 | $this->compile($file); |
88 | 88 | } |
@@ -11,7 +11,6 @@ |
||
11 | 11 | |
12 | 12 | use Railt\Io\Readable; |
13 | 13 | use Railt\Parser\Ast\RuleInterface; |
14 | -use Railt\Parser\Exception\UnexpectedTokenException; |
|
15 | 14 | use Railt\Parser\Exception\UnrecognizedTokenException; |
16 | 15 | use Railt\Reflection\Contracts\Definition; |
17 | 16 | use Railt\Reflection\Contracts\Dictionary; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function push(int $priority, callable $then): void |
76 | 76 | { |
77 | - if (! \array_key_exists($priority, $this->queue)) { |
|
77 | + if (!\array_key_exists($priority, $this->queue)) { |
|
78 | 78 | $this->queue[$priority] = $this->createList(); |
79 | 79 | } |
80 | 80 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function count(): int |
96 | 96 | { |
97 | - return (int)\array_reduce($this->queue, function (int $result, \SplQueue $queue): int { |
|
97 | + return (int) \array_reduce($this->queue, function(int $result, \SplQueue $queue): int { |
|
98 | 98 | return $result + $queue->count(); |
99 | 99 | }, 0); |
100 | 100 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | class InputValueNode extends Rule implements ValueInterface, CompositeValueInterface |
19 | 19 | { |
20 | 20 | /** |
21 | - * @return iterable |
|
21 | + * @return \Generator |
|
22 | 22 | */ |
23 | 23 | public function toPrimitive(): iterable |
24 | 24 | { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
31 | - * @return iterable|ValueInterface[] |
|
31 | + * @return \Generator |
|
32 | 32 | */ |
33 | 33 | public function getValues(): iterable |
34 | 34 | { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @var string |
23 | 23 | */ |
24 | - private const SCHEMA_SDL_GRAMMAR = __DIR__ . '/../../resources/grammar.pp2'; |
|
24 | + private const SCHEMA_SDL_GRAMMAR = __DIR__.'/../../resources/grammar.pp2'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @var string |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | Compiler::load(File::fromPathname(self::SCHEMA_SDL_GRAMMAR)) |
44 | 44 | ->setClassName('Parser') |
45 | 45 | ->setNamespace('Railt\\SDL\\Compiler') |
46 | - ->saveTo(__DIR__ . '/../Compiler'); |
|
46 | + ->saveTo(__DIR__.'/../Compiler'); |
|
47 | 47 | |
48 | 48 | $this->info('OK'); |
49 | 49 | } |
@@ -21,6 +21,6 @@ |
||
21 | 21 | */ |
22 | 22 | public function toPrimitive(): string |
23 | 23 | { |
24 | - return (string)$this->getChild(0)->getValue(); |
|
24 | + return (string) $this->getChild(0)->getValue(); |
|
25 | 25 | } |
26 | 26 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return $this->parseInt($value->getValue()); |
53 | 53 | } |
54 | 54 | |
55 | - return (float)$value->getValue(); |
|
55 | + return (float) $value->getValue(); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function parseExponential(string $value): float |
81 | 81 | { |
82 | - return (float)$value; |
|
82 | + return (float) $value; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function parseFloat(string $value): float |
90 | 90 | { |
91 | - return (float)$value; |
|
91 | + return (float) $value; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | private function renderUtfSequences(string $body): string |
95 | 95 | { |
96 | - $callee = function (array $matches): string { |
|
96 | + $callee = function(array $matches): string { |
|
97 | 97 | [$char, $code] = [$matches[0], $matches[1]]; |
98 | 98 | |
99 | 99 | try { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | { |
124 | 124 | try { |
125 | 125 | if (\function_exists('\\json_decode')) { |
126 | - $result = @\json_decode('{"char": "' . $body . '"}')->char; |
|
126 | + $result = @\json_decode('{"char": "'.$body.'"}')->char; |
|
127 | 127 | |
128 | 128 | if (\json_last_error() === \JSON_ERROR_NONE) { |
129 | 129 | $body = $result; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | private function renderSpecialCharacters(string $body): string |
145 | 145 | { |
146 | - $callee = function (array $matches): string { |
|
146 | + $callee = function(array $matches): string { |
|
147 | 147 | [$char, $code] = [$matches[0], $matches[1]]; |
148 | 148 | |
149 | 149 | switch ($code) { |