@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Railt\Io\Readable; |
| 13 | 13 | use Railt\Parser\Ast\RuleInterface; |
| 14 | 14 | use Railt\Parser\Environment; |
| 15 | -use Railt\Parser\Exception\UnexpectedTokenException; |
|
| 16 | 15 | use Railt\Parser\Exception\UnrecognizedTokenException; |
| 17 | 16 | use Railt\Reflection\Contracts\Definition; |
| 18 | 17 | use Railt\Reflection\Contracts\Dictionary; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function autoload(\Closure $then): void |
| 86 | 86 | { |
| 87 | - $this->dictionary->onTypeNotFound(function (string $type, ?Definition $from) use ($then): void { |
|
| 87 | + $this->dictionary->onTypeNotFound(function(string $type, ?Definition $from) use ($then) : void { |
|
| 88 | 88 | if (($file = $then($type, $from)) instanceof Readable) { |
| 89 | 89 | $this->compile($file); |
| 90 | 90 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | $key = $document->getFile()->getHash(); |
| 118 | 118 | |
| 119 | - if (! isset($this->documents[$key])) { |
|
| 119 | + if (!isset($this->documents[$key])) { |
|
| 120 | 120 | $otherwise && $otherwise($document); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function compile(Readable $file): DocumentInterface |
| 131 | 131 | { |
| 132 | - return $this->memomize(new Document($this->reflection, $file), function (Document $document) use ($file): void { |
|
| 132 | + return $this->memomize(new Document($this->reflection, $file), function(Document $document) use ($file): void { |
|
| 133 | 133 | $ast = $this->parse($document, $file); |
| 134 | 134 | |
| 135 | 135 | foreach ($ast as $type) { |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * @param DirectiveDefinition $definition |
| 58 | - * @return iterable|DirectiveLocation[] |
|
| 58 | + * @return \Generator |
|
| 59 | 59 | */ |
| 60 | 60 | private function getLocations(DirectiveDefinition $definition): iterable |
| 61 | 61 | { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | private function bootLocations(DirectiveDefinition $directive): void |
| 46 | 46 | { |
| 47 | 47 | foreach ($this->getLocations($directive) as $offset => $location) { |
| 48 | - $this->transaction($location, function (DirectiveLocation $location) use ($directive): void { |
|
| 48 | + $this->transaction($location, function(DirectiveLocation $location) use ($directive): void { |
|
| 49 | 49 | // TODO Add duplication verification |
| 50 | 50 | $directive->withLocation($location); |
| 51 | 51 | $this->verifyLocation($location); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $isValid = $location->isExecutable() || $location->isPrivate(); |
| 75 | 75 | |
| 76 | - if (! $isValid) { |
|
| 76 | + if (!$isValid) { |
|
| 77 | 77 | $error = \sprintf('Invalid directive location %s', $location); |
| 78 | 78 | |
| 79 | 79 | throw $this->error(new TypeConflictException($error))->in($location); |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @param EnumDefinition $enum |
| 59 | - * @return iterable |
|
| 59 | + * @return \Generator |
|
| 60 | 60 | */ |
| 61 | 61 | private function getEnumValues(EnumDefinition $enum): iterable |
| 62 | 62 | { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | private function bootValues(EnumDefinition $enum): void |
| 48 | 48 | { |
| 49 | 49 | foreach ($this->getEnumValues($enum) as $value) { |
| 50 | - $this->transaction($value, function (EnumValueDefinition $value) use ($enum): void { |
|
| 50 | + $this->transaction($value, function(EnumValueDefinition $value) use ($enum): void { |
|
| 51 | 51 | $this->verifyDuplication($enum, $value); |
| 52 | 52 | $enum->withValue($value); |
| 53 | 53 | }); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | foreach ($this->first('EnumValues', 1) as $ast) { |
| 65 | 65 | $enumValue = $this->createEnumValue($enum, $ast->first('T_NAME', 1)); |
| 66 | 66 | |
| 67 | - $this->transaction($enumValue, function (EnumValueDefinition $def) use ($ast): void { |
|
| 67 | + $this->transaction($enumValue, function(EnumValueDefinition $def) use ($ast): void { |
|
| 68 | 68 | $this->withDescription($def, $ast); |
| 69 | 69 | |
| 70 | 70 | /** @var RuleInterface $defValue */ |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @param NodeInterface|RuleInterface $rule |
| 41 | - * @return mixed|string |
|
| 41 | + * @return string |
|
| 42 | 42 | */ |
| 43 | 43 | protected function parse(NodeInterface $rule): string |
| 44 | 44 | { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | private function renderSpecialCharacters(string $body): string |
| 97 | 97 | { |
| 98 | - $callee = function (array $matches): string { |
|
| 98 | + $callee = function(array $matches): string { |
|
| 99 | 99 | [$char, $code] = [$matches[0], $matches[1]]; |
| 100 | 100 | |
| 101 | 101 | switch ($code) { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | private function renderUtfSequences(string $body): string |
| 129 | 129 | { |
| 130 | - $callee = function (array $matches): string { |
|
| 130 | + $callee = function(array $matches): string { |
|
| 131 | 131 | [$char, $code] = [$matches[0], $matches[1]]; |
| 132 | 132 | |
| 133 | 133 | try { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | { |
| 158 | 158 | try { |
| 159 | 159 | if (\function_exists('\\json_decode')) { |
| 160 | - $result = @\json_decode('{"char": "' . $body . '"}')->char; |
|
| 160 | + $result = @\json_decode('{"char": "'.$body.'"}')->char; |
|
| 161 | 161 | |
| 162 | 162 | if (\json_last_error() === \JSON_ERROR_NONE) { |
| 163 | 163 | $body = $result; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | protected static function getAstName(): string |
| 34 | 34 | { |
| 35 | - throw new \LogicException(__METHOD__ . ' is non-allowed'); |
|
| 35 | + throw new \LogicException(__METHOD__.' is non-allowed'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -41,6 +41,6 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | protected function parse(NodeInterface $rule): string |
| 43 | 43 | { |
| 44 | - return (string)$rule->getValue(); |
|
| 44 | + return (string) $rule->getValue(); |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -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 | /** |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | $this->definition = $this->bootDefinition($this->document); |
| 62 | 62 | |
| 63 | - $this->stack->transaction($this->definition, function (AbstractDefinition $record): void { |
|
| 63 | + $this->stack->transaction($this->definition, function(AbstractDefinition $record): void { |
|
| 64 | 64 | $record->withOffset($this->getOffset()); |
| 65 | 65 | |
| 66 | 66 | if ($record instanceof TypeDefinition) { |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | use Railt\Reflection\Contracts\Document; |
| 12 | 12 | use Railt\SDL\Compiler; |
| 13 | 13 | |
| 14 | -if (! \function_exists('\\sdl')) { |
|
| 14 | +if (!\function_exists('\\sdl')) { |
|
| 15 | 15 | /** |
| 16 | 16 | * @param string $fileOrSources |
| 17 | 17 | * @param bool $filename |
@@ -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; |