@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | private function addLoggerListener(): void |
| 46 | 46 | { |
| 47 | - parent::onTypeNotFound(function (string $type, ?Definition $from): void { |
|
| 47 | + parent::onTypeNotFound(function(string $type, ?Definition $from): void { |
|
| 48 | 48 | if ($this->logger) { |
| 49 | 49 | $direct = 'Try to load type %s from direct method executing'; |
| 50 | 50 | $context = 'Try to load type %s from %s (%s:%d)'; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function onTypeNotFound(\Closure $then): void |
| 65 | 65 | { |
| 66 | - parent::onTypeNotFound(function (string $type, ?Definition $from) use ($then): void { |
|
| 66 | + parent::onTypeNotFound(function(string $type, ?Definition $from) use ($then) : void { |
|
| 67 | 67 | if (($file = $then($type, $from)) instanceof Readable) { |
| 68 | 68 | $this->compiler->compile($file); |
| 69 | 69 | } |
@@ -52,11 +52,11 @@ |
||
| 52 | 52 | |
| 53 | 53 | $output = $this->option('out') ?: \dirname($schema->getPathname()); |
| 54 | 54 | |
| 55 | - if (! \is_dir($output)) { |
|
| 56 | - throw new NotReadableException('Output directory "' . $output . '" not exists'); |
|
| 55 | + if (!\is_dir($output)) { |
|
| 56 | + throw new NotReadableException('Output directory "'.$output.'" not exists'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $outputPathname = $output . '/' . \basename($schema->getPathname()) . '.json'; |
|
| 59 | + $outputPathname = $output.'/'.\basename($schema->getPathname()).'.json'; |
|
| 60 | 60 | |
| 61 | 61 | \file_put_contents($outputPathname, \json_encode($result)); |
| 62 | 62 | } |
@@ -65,11 +65,11 @@ |
||
| 65 | 65 | continue; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $position = $def->getFile()->getPathname() . ':' . $def->getLine(); |
|
| 68 | + $position = $def->getFile()->getPathname().':'.$def->getLine(); |
|
| 69 | 69 | |
| 70 | - $this->writeln('<fg=white;bg=green> ' . \str_repeat(' ', \strlen($position)) . ' </>'); |
|
| 71 | - $this->writeln('<fg=white;bg=green> ' . $position . ' </>'); |
|
| 72 | - $this->writeln('<fg=white;bg=green> ' . \str_repeat(' ', \strlen($position)) . ' </>'); |
|
| 70 | + $this->writeln('<fg=white;bg=green> '.\str_repeat(' ', \strlen($position)).' </>'); |
|
| 71 | + $this->writeln('<fg=white;bg=green> '.$position.' </>'); |
|
| 72 | + $this->writeln('<fg=white;bg=green> '.\str_repeat(' ', \strlen($position)).' </>'); |
|
| 73 | 73 | |
| 74 | 74 | $this->render($def); |
| 75 | 75 | $this->writeln("\n\n"); |
@@ -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\\Frontend') |
| 46 | - ->saveTo(__DIR__ . '/../Frontend'); |
|
| 46 | + ->saveTo(__DIR__.'/../Frontend'); |
|
| 47 | 47 | |
| 48 | 48 | $this->info('OK'); |
| 49 | 49 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | private function trim(string $content): string |
| 42 | 42 | { |
| 43 | - $lines = \array_map(function (string $line): string { |
|
| 43 | + $lines = \array_map(function(string $line): string { |
|
| 44 | 44 | return \ltrim($line, '#'); |
| 45 | 45 | }, \explode("\n", $content)); |
| 46 | 46 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function isList(): bool |
| 72 | 72 | { |
| 73 | - return (bool)($this->modifiers & Hint::IS_LIST); |
|
| 73 | + return (bool) ($this->modifiers & Hint::IS_LIST); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function isNonNull(): bool |
| 80 | 80 | { |
| 81 | - return (bool)($this->modifiers & Hint::IS_NOT_NULL); |
|
| 81 | + return (bool) ($this->modifiers & Hint::IS_NOT_NULL); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function isListOfNonNulls(): bool |
| 88 | 88 | { |
| 89 | - return (bool)($this->modifiers & Hint::IS_LIST_OF_NOT_NULL); |
|
| 89 | + return (bool) ($this->modifiers & Hint::IS_LIST_OF_NOT_NULL); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function compile(Readable $file): DocumentInterface |
| 101 | 101 | { |
| 102 | - return $this->store->memoize($file, function (Readable $file): DocumentInterface { |
|
| 102 | + return $this->store->memoize($file, function(Readable $file): DocumentInterface { |
|
| 103 | 103 | return $this->generate($file, $this->ir($file)); |
| 104 | 104 | }); |
| 105 | 105 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function generate(Readable $file, iterable $opcodes): DocumentInterface |
| 116 | 116 | { |
| 117 | - return $this->wrap(function () use ($file, $opcodes) { |
|
| 117 | + return $this->wrap(function() use ($file, $opcodes) { |
|
| 118 | 118 | return $this->back->run($file, $opcodes); |
| 119 | 119 | }); |
| 120 | 120 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function ir(Readable $readable): iterable |
| 151 | 151 | { |
| 152 | - return $this->wrap(function () use ($readable) { |
|
| 152 | + return $this->wrap(function() use ($readable) { |
|
| 153 | 153 | return $this->front->load($readable); |
| 154 | 154 | }); |
| 155 | 155 | } |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | /** @var LeafInterface $token */ |
| 28 | 28 | $token = $this->getChild(0); |
| 29 | 29 | |
| 30 | - return new ConstantValue((string)$token->getValue(), $this->getOffset()); |
|
| 30 | + return new ConstantValue((string) $token->getValue(), $this->getOffset()); |
|
| 31 | 31 | } |
| 32 | 32 | } |
@@ -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) { |