@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public static function null(): TypeInterface |
| 71 | 71 | { |
| 72 | - return static::new(static::NULL); |
|
| 72 | + return static::new(static::null); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public static function const(): TypeInterface |
| 79 | 79 | { |
| 80 | - return static::new(static::CONST); |
|
| 80 | + return static::new(static::const); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | case $value instanceof \JsonSerializable: |
| 132 | 132 | break; |
| 133 | 133 | case \is_object($value) && \method_exists($value, '__toString'): |
| 134 | - $value = (string)$value; |
|
| 134 | + $value = (string) $value; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $result[$key] = $value; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function offsetExists($offset): bool |
| 166 | 166 | { |
| 167 | - return $this->has((string)$offset); |
|
| 167 | + return $this->has((string) $offset); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function offsetGet($offset) |
| 175 | 175 | { |
| 176 | - return $this->get((string)$offset); |
|
| 176 | + return $this->get((string) $offset); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $offset = \count($this->attributes); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - $this->set((string)$offset, $value); |
|
| 189 | + $this->set((string) $offset, $value); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -194,6 +194,6 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function offsetUnset($offset): void |
| 196 | 196 | { |
| 197 | - $this->delete((string)$offset); |
|
| 197 | + $this->delete((string) $offset); |
|
| 198 | 198 | } |
| 199 | 199 | } |
@@ -243,7 +243,7 @@ |
||
| 243 | 243 | |
| 244 | 244 | /** |
| 245 | 245 | * @param Readable $readable |
| 246 | - * @param iterable|RuleInterface[] $rules |
|
| 246 | + * @param RuleInterface $rules |
|
| 247 | 247 | * @return iterable|array[] |
| 248 | 248 | * @throws \Railt\Io\Exception\ExternalFileException |
| 249 | 249 | */ |
@@ -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\SDL\Exception\InternalException; |
| 17 | 16 | use Railt\SDL\Exception\SyntaxException; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | private function bootInterceptors(DeferredStorage $deferred, TypesStorage $types): Factory |
| 142 | 142 | { |
| 143 | - $wantsBuild = function (ContextInterface $ctx, RuleInterface $ast) { |
|
| 143 | + $wantsBuild = function(ContextInterface $ctx, RuleInterface $ast) { |
|
| 144 | 144 | return $this->buildNode($ctx, $ast); |
| 145 | 145 | }; |
| 146 | 146 | |
@@ -278,10 +278,10 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | private function deferred(ContextInterface $context): ContextInterface |
| 280 | 280 | { |
| 281 | - $this->deferred->attach($this->types->export(function (DefinitionInterface $definition): bool { |
|
| 281 | + $this->deferred->attach($this->types->export(function(DefinitionInterface $definition): bool { |
|
| 282 | 282 | $invocation = new Invocation($definition->getName(), $definition->getContext()); |
| 283 | 283 | |
| 284 | - return ! $definition->isGeneric() && ! $this->types->resolved($invocation); |
|
| 284 | + return !$definition->isGeneric() && !$this->types->resolved($invocation); |
|
| 285 | 285 | })); |
| 286 | 286 | |
| 287 | 287 | [$context] = $this->process->run($context, $this->deferred->getIterator()); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | /** |
| 38 | 38 | * @param ContextInterface $ctx |
| 39 | 39 | * @param RuleInterface $rule |
| 40 | - * @return mixed|\Generator|void |
|
| 40 | + * @return \Generator |
|
| 41 | 41 | */ |
| 42 | 42 | public function reduce(ContextInterface $ctx, RuleInterface $rule) |
| 43 | 43 | { |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | /** @var DeferredInterface $definition */ |
| 45 | 45 | $definition = yield $rule->first('> #TypeDefinition'); |
| 46 | 46 | |
| 47 | - $definition->then(function (DefinitionInterface $definition, InvocationInterface $from) { |
|
| 47 | + $definition->then(function(DefinitionInterface $definition, InvocationInterface $from) { |
|
| 48 | 48 | /** @var ContextInterface $local */ |
| 49 | 49 | $local = yield $definition->getLocalContext(); // Open local context |
| 50 | 50 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * @param ContextInterface $ctx |
| 42 | 42 | * @param RuleInterface $rule |
| 43 | - * @return \Generator|\Closure |
|
| 43 | + * @return \Generator |
|
| 44 | 44 | */ |
| 45 | 45 | public function reduce(ContextInterface $ctx, RuleInterface $rule): \Generator |
| 46 | 46 | { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @param RuleInterface $rule |
| 69 | - * @return iterable|string[] |
|
| 69 | + * @return \Generator |
|
| 70 | 70 | */ |
| 71 | 71 | private function getVariableNames(RuleInterface $rule): iterable |
| 72 | 72 | { |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $isConstant ? $record->lock() : $record->unlock(); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - yield function () use ($rule, $variables) { |
|
| 56 | + yield function() use ($rule, $variables) { |
|
| 57 | 57 | /** @var ValueInterface $value */ |
| 58 | 58 | $value = yield $this->getValueNode($rule); |
| 59 | 59 | |
@@ -32,8 +32,8 @@ |
||
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @param ContextInterface $ctx |
| 35 | - * @param RuleInterface|AstValueInterface $rule |
|
| 36 | - * @return mixed|Value |
|
| 35 | + * @param RuleInterface $rule |
|
| 36 | + * @return Value |
|
| 37 | 37 | */ |
| 38 | 38 | public function reduce(ContextInterface $ctx, RuleInterface $rule) |
| 39 | 39 | { |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | /** |
| 44 | 44 | * @param ContextInterface $ctx |
| 45 | 45 | * @param RuleInterface $rule |
| 46 | - * @return mixed|Value |
|
| 46 | + * @return ValueInterface |
|
| 47 | 47 | */ |
| 48 | 48 | public function reduce(ContextInterface $ctx, RuleInterface $rule): ValueInterface |
| 49 | 49 | { |
@@ -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) { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * @param ContextInterface $ctx |
| 39 | 39 | * @param RuleInterface $rule |
| 40 | - * @return \Generator|InvocationInterface |
|
| 40 | + * @return \Generator |
|
| 41 | 41 | * @throws TypeConflictException |
| 42 | 42 | */ |
| 43 | 43 | public function reduce(ContextInterface $ctx, RuleInterface $rule): \Generator |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * @param ContextInterface $ctx |
| 70 | - * @param TypeNameInterface|ValueInterface $name |
|
| 70 | + * @param ValueInterface $name |
|
| 71 | 71 | * @return InvocationInterface |
| 72 | 72 | */ |
| 73 | 73 | private function resolveName(ContextInterface $ctx, $name): InvocationInterface |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | /** |
| 96 | 96 | * @param ContextInterface $ctx |
| 97 | 97 | * @param RuleInterface $rule |
| 98 | - * @return \Generator|TypeNameInterface |
|
| 98 | + * @return \Generator |
|
| 99 | 99 | * @throws TypeConflictException |
| 100 | 100 | */ |
| 101 | 101 | private function fetchArgumentName(ContextInterface $ctx, RuleInterface $rule): \Generator |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | /** |
| 124 | 124 | * @param ContextInterface $ctx |
| 125 | 125 | * @param RuleInterface $rule |
| 126 | - * @return \Generator|ValueInterface |
|
| 126 | + * @return \Generator |
|
| 127 | 127 | */ |
| 128 | 128 | private function fetchArgumentValue(ContextInterface $ctx, RuleInterface $rule): \Generator |
| 129 | 129 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | switch (true) { |
| 83 | 83 | case $isConst: |
| 84 | - return new Invocation(Name::fromString((string)$name->getValue()), $ctx); |
|
| 84 | + return new Invocation(Name::fromString((string) $name->getValue()), $ctx); |
|
| 85 | 85 | |
| 86 | 86 | case $isType: |
| 87 | 87 | /** @var Invocation $value */ |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $isConst = $name->getType()->typeOf(Type::const()); |
| 111 | 111 | |
| 112 | - if (! $isConst) { |
|
| 112 | + if (!$isConst) { |
|
| 113 | 113 | $error = 'Generic argument name must be a const but %s given'; |
| 114 | 114 | $exception = new TypeConflictException(\sprintf($error, $name)); |
| 115 | 115 | $exception->throwsIn($ctx->getFile(), $rule->getOffset()); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | throw $exception; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - return Name::fromString((string)$name->getValue()); |
|
| 120 | + return Name::fromString((string) $name->getValue()); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $isType = $value->getType()->typeOf(Type::type()); |
| 134 | 134 | |
| 135 | - if (! $isType) { |
|
| 135 | + if (!$isType) { |
|
| 136 | 136 | $error = 'Generic argument value must be a valid type, but %s given'; |
| 137 | 137 | $exception = new TypeConflictException(\sprintf($error, $value)); |
| 138 | 138 | $exception->throwsIn($ctx->getFile(), $rule->getOffset()); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * @param mixed ...$args |
| 48 | - * @return \Generator|mixed |
|
| 48 | + * @return \Generator |
|
| 49 | 49 | */ |
| 50 | 50 | public function __invoke(...$args) |
| 51 | 51 | { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @param array $args |
| 57 | - * @return \Generator|mixed |
|
| 57 | + * @return \Generator |
|
| 58 | 58 | */ |
| 59 | 59 | public function invoke(...$args): \Generator |
| 60 | 60 | { |
@@ -9,8 +9,6 @@ |
||
| 9 | 9 | |
| 10 | 10 | namespace Railt\SDL\Frontend\Deferred; |
| 11 | 11 | |
| 12 | -use Railt\SDL\Frontend\Context\ContextInterface; |
|
| 13 | - |
|
| 14 | 12 | /** |
| 15 | 13 | * Class Deferred |
| 16 | 14 | */ |