@@ -46,7 +46,7 @@ |
||
| 46 | 46 | public function generate(Readable $file, iterable $records): Document |
| 47 | 47 | { |
| 48 | 48 | foreach ($records as $record) { |
| 49 | - echo __FILE__ . ':' . __LINE__ . "\n"; |
|
| 49 | + echo __FILE__.':'.__LINE__."\n"; |
|
| 50 | 50 | echo \json_encode($record, \JSON_PRETTY_PRINT); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @param Readable $file |
| 49 | - * @return iterable |
|
| 49 | + * @return \Generator |
|
| 50 | 50 | * @throws SyntaxException |
| 51 | 51 | * @throws \Railt\Io\Exception\ExternalFileException |
| 52 | 52 | */ |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param Readable $readable |
| 60 | - * @return iterable |
|
| 60 | + * @return \Generator |
|
| 61 | 61 | * @throws SyntaxException |
| 62 | 62 | * @throws \Railt\Io\Exception\ExternalFileException |
| 63 | 63 | */ |
@@ -13,16 +13,9 @@ |
||
| 13 | 13 | use Psr\Log\LoggerAwareTrait; |
| 14 | 14 | use Psr\Log\LoggerInterface; |
| 15 | 15 | use Railt\Io\Readable; |
| 16 | -use Railt\Parser\Ast\RuleInterface; |
|
| 17 | -use Railt\Parser\Exception\UnexpectedTokenException; |
|
| 18 | -use Railt\Parser\Exception\UnrecognizedTokenException; |
|
| 19 | 16 | use Railt\SDL\Exception\SyntaxException; |
| 20 | 17 | use Railt\SDL\Frontend\Builder; |
| 21 | 18 | use Railt\SDL\Frontend\Context\ContextInterface; |
| 22 | -use Railt\SDL\Frontend\Context\GlobalContext; |
|
| 23 | -use Railt\SDL\Frontend\Parser; |
|
| 24 | -use Railt\SDL\IR\DefinitionValueObject; |
|
| 25 | -use Railt\SDL\IR\SymbolTable; |
|
| 26 | 19 | |
| 27 | 20 | /** |
| 28 | 21 | * Class Frontend |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * @param Readable $readable |
| 120 | - * @return array[]|iterable |
|
| 120 | + * @return \Generator |
|
| 121 | 121 | * @throws SyntaxException |
| 122 | 122 | * @throws \Railt\Io\Exception\ExternalFileException |
| 123 | 123 | */ |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * @param Readable $readable |
| 153 | - * @param iterable $ast |
|
| 154 | - * @return iterable|array[] |
|
| 153 | + * @param RuleInterface $ast |
|
| 154 | + * @return \Generator |
|
| 155 | 155 | * @throws \Railt\Io\Exception\ExternalFileException |
| 156 | 156 | */ |
| 157 | 157 | public function buildAst(Readable $readable, iterable $ast): iterable |
@@ -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\CompilerException; |
| 17 | 16 | use Railt\SDL\Exception\InternalException; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | /** @noinspection SuspiciousAssignmentsInspection */ |
| 244 | 244 | $value = $this->store->add($value); |
| 245 | 245 | |
| 246 | - if (! $value->getOffset()) { |
|
| 246 | + if (!$value->getOffset()) { |
|
| 247 | 247 | $value->definedIn($offset); |
| 248 | 248 | } |
| 249 | 249 | |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | private function after(ContextInterface $context): \Generator |
| 270 | 270 | { |
| 271 | - $after = $this->store->extract(function (DeferredInterface $deferred): bool { |
|
| 272 | - return ! $deferred instanceof Identifiable || ! $deferred->getDefinition()->isGeneric(); |
|
| 271 | + $after = $this->store->extract(function(DeferredInterface $deferred): bool { |
|
| 272 | + return !$deferred instanceof Identifiable || !$deferred->getDefinition()->isGeneric(); |
|
| 273 | 273 | }); |
| 274 | 274 | |
| 275 | 275 | foreach ($after as $deferred) { |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | /** |
| 38 | 38 | * @param ContextInterface $ctx |
| 39 | 39 | * @param RuleInterface $rule |
| 40 | - * @return \Generator|mixed |
|
| 40 | + * @return \Generator |
|
| 41 | 41 | */ |
| 42 | 42 | public function reduce(ContextInterface $ctx, RuleInterface $rule) |
| 43 | 43 | { |
@@ -15,9 +15,7 @@ |
||
| 15 | 15 | use Railt\SDL\Frontend\Deferred\Deferred; |
| 16 | 16 | use Railt\SDL\Frontend\Deferred\DeferredInterface; |
| 17 | 17 | use Railt\SDL\Frontend\Deferred\NamedDeferred; |
| 18 | -use Railt\SDL\IR\SymbolTable\Value; |
|
| 19 | 18 | use Railt\SDL\IR\SymbolTable\VarSymbolInterface; |
| 20 | -use Railt\SDL\IR\Type; |
|
| 21 | 19 | use Railt\SDL\IR\Type\TypeNameInterface; |
| 22 | 20 | |
| 23 | 21 | /** |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | /** |
| 40 | 40 | * @param ContextInterface $ctx |
| 41 | 41 | * @param RuleInterface $rule |
| 42 | - * @return \Generator|\Closure |
|
| 42 | + * @return \Generator |
|
| 43 | 43 | */ |
| 44 | 44 | public function reduce(ContextInterface $ctx, RuleInterface $rule): \Generator |
| 45 | 45 | { |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * @param ContextInterface $ctx |
| 33 | 33 | * @param RuleInterface $rule |
| 34 | - * @return \Generator|\Closure |
|
| 34 | + * @return \Generator |
|
| 35 | 35 | */ |
| 36 | 36 | public function reduce(ContextInterface $ctx, RuleInterface $rule) |
| 37 | 37 | { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * @param ContextInterface $ctx |
| 39 | 39 | * @param RuleInterface $rule |
| 40 | - * @return \Generator|ValueInterface |
|
| 40 | + * @return \Generator |
|
| 41 | 41 | * @throws TypeConflictException |
| 42 | 42 | */ |
| 43 | 43 | public function reduce(ContextInterface $ctx, RuleInterface $rule): \Generator |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | /** |
| 67 | 67 | * @param ContextInterface $ctx |
| 68 | 68 | * @param RuleInterface $rule |
| 69 | - * @return \Generator|TypeNameInterface |
|
| 69 | + * @return \Generator |
|
| 70 | 70 | * @throws TypeConflictException |
| 71 | 71 | */ |
| 72 | 72 | private function fetchArgumentName(ContextInterface $ctx, RuleInterface $rule): \Generator |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | * @param ContextInterface $ctx |
| 96 | 96 | * @param RuleInterface $rule |
| 97 | - * @return \Generator|ValueInterface |
|
| 97 | + * @return \Generator |
|
| 98 | 98 | */ |
| 99 | 99 | private function fetchArgumentValue(ContextInterface $ctx, RuleInterface $rule): \Generator |
| 100 | 100 | { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * @param TypeNameInterface|ValueInterface $name |
|
| 116 | + * @param ValueInterface $name |
|
| 117 | 117 | * @return InvocationPrimitive |
| 118 | 118 | * @throws TypeConflictException |
| 119 | 119 | */ |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $isConst = $name->getType()->typeOf(Type::const()); |
| 82 | 82 | |
| 83 | - if (! $isConst) { |
|
| 83 | + if (!$isConst) { |
|
| 84 | 84 | $error = 'Generic argument name must be a const but %s given'; |
| 85 | 85 | $exception = new TypeConflictException(\sprintf($error, $name)); |
| 86 | 86 | $exception->throwsIn($ctx->getFile(), $rule->getOffset()); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | throw $exception; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - return Name::fromString((string)$name->getValue()); |
|
| 91 | + return Name::fromString((string) $name->getValue()); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $isType = $value->getType()->typeOf(Type::type()); |
| 105 | 105 | |
| 106 | - if (! $isType) { |
|
| 106 | + if (!$isType) { |
|
| 107 | 107 | $error = 'Generic argument value must be a valid type, but %s given'; |
| 108 | 108 | $exception = new TypeConflictException(\sprintf($error, $value)); |
| 109 | 109 | $exception->throwsIn($ctx->getFile(), $rule->getOffset()); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | switch (true) { |
| 130 | 130 | case $isConst: |
| 131 | - return new InvocationPrimitive(Name::fromString((string)$name->getValue())); |
|
| 131 | + return new InvocationPrimitive(Name::fromString((string) $name->getValue())); |
|
| 132 | 132 | |
| 133 | 133 | case $isType: |
| 134 | 134 | /** @var InvocationPrimitive $value */ |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | * @param TypeInterface|null $type |
| 129 | 129 | * @return VarSymbolInterface |
| 130 | 130 | */ |
| 131 | - public function declare(string $var, TypeInterface $type = null): VarSymbolInterface |
|
| 131 | + public function declare(string$var,TypeInterface$type=null): VarSymbolInterface |
|
| 132 | 132 | { |
| 133 | 133 | if ($this->has($var)) { |
| 134 | 134 | $error = 'Can not define var $%s, because %s already has been defined'; |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | $arguments = []; |
| 82 | 82 | |
| 83 | 83 | foreach ($this->arguments as $name => $value) { |
| 84 | - $arguments[] = $name . ': ' . $value; |
|
| 84 | + $arguments[] = $name.': '.$value; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | return \sprintf('%s<%s>', $this->name->getFullyQualifiedName(), \implode(', ', $arguments)); |