@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | use Railt\Reflection\Contracts\Document; |
15 | 15 | use Railt\SDL\Exception\CompilerException; |
16 | 16 | |
17 | -if (! \function_exists('sdl')) { |
|
17 | +if (!\function_exists('sdl')) { |
|
18 | 18 | /** |
19 | 19 | * @param string $fileOrSources |
20 | 20 | * @param bool $filename |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | -if (! \function_exists('object_to_string')) { |
|
33 | +if (!\function_exists('object_to_string')) { |
|
34 | 34 | /** |
35 | 35 | * @param object $object |
36 | 36 | * @return string |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | : \spl_object_hash($object); |
45 | 45 | |
46 | 46 | if (is_renderable($object)) { |
47 | - return \sprintf('%s(%s)#%s', \get_class($object), (string)$object, $hash); |
|
47 | + return \sprintf('%s(%s)#%s', \get_class($object), (string) $object, $hash); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return \sprintf('%s#%s', \get_class($object), $hash); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | -if (! \function_exists('is_renderable')) { |
|
55 | +if (!\function_exists('is_renderable')) { |
|
56 | 56 | /** |
57 | 57 | * @param mixed $value |
58 | 58 | * @return bool |
@@ -56,20 +56,20 @@ |
||
56 | 56 | public static function new($name, bool $global = null): TypeNameInterface |
57 | 57 | { |
58 | 58 | switch (true) { |
59 | - case $name === null || ! $name: |
|
60 | - return static::empty((bool)$global); |
|
59 | + case $name === null || !$name: |
|
60 | + return static::empty((bool) $global); |
|
61 | 61 | |
62 | 62 | case $name instanceof TypeNameInterface: |
63 | 63 | return $name; |
64 | 64 | |
65 | 65 | case \is_array($name): |
66 | - return static::fromArray($name, (bool)$global); |
|
66 | + return static::fromArray($name, (bool) $global); |
|
67 | 67 | |
68 | 68 | case \is_iterable($name): |
69 | - return static::fromArray(\iterator_to_array($name, false), (bool)$global); |
|
69 | + return static::fromArray(\iterator_to_array($name, false), (bool) $global); |
|
70 | 70 | |
71 | 71 | case \is_scalar($name): |
72 | - return static::fromString((string)$name, $global); |
|
72 | + return static::fromString((string) $name, $global); |
|
73 | 73 | |
74 | 74 | default: |
75 | 75 | $error = 'Unsupported argument type of %s(self|array|iterable|scalar $name = %s)'; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected function format(TypeNameInterface $name, iterable $arguments): string |
35 | 35 | { |
36 | - return $this->formatName($name) . $this->formatArguments($arguments); |
|
36 | + return $this->formatName($name).$this->formatArguments($arguments); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | if (\count($result)) { |
52 | - return 'Of' . \implode('And', $result); |
|
52 | + return 'Of'.\implode('And', $result); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | return ''; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $value = $argument->getValue(); |
65 | 65 | $suffix = $value instanceof TypeInvocation ? $this->formatType($value) : $this->formatArgument($value); |
66 | 66 | |
67 | - return \ucfirst($argument->getName()) . $suffix; |
|
67 | + return \ucfirst($argument->getName()).$suffix; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected function formatType(TypeInvocation $type): string |
75 | 75 | { |
76 | - return $this->formatName($type->getTypeName()) . $this->formatArguments($type->getArguments()); |
|
76 | + return $this->formatName($type->getTypeName()).$this->formatArguments($type->getArguments()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -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) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * @param ContextInterface $ctx |
40 | 40 | * @param RuleInterface $rule |
41 | - * @return \Generator|Definition |
|
41 | + * @return \Generator |
|
42 | 42 | * @throws InvalidArgumentException |
43 | 43 | */ |
44 | 44 | public function reduce(ContextInterface $ctx, RuleInterface $rule): \Generator |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param RuleInterface $argument |
63 | - * @return \Generator|TypeNameInterface |
|
63 | + * @return \Generator |
|
64 | 64 | */ |
65 | 65 | private function getArgumentName(RuleInterface $argument): \Generator |
66 | 66 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @param RuleInterface $argument |
73 | - * @return \Generator|TypeNameInterface |
|
73 | + * @return \Generator |
|
74 | 74 | */ |
75 | 75 | private function getArgumentValue(RuleInterface $argument): \Generator |
76 | 76 | { |
@@ -47,7 +47,7 @@ |
||
47 | 47 | yield from $name = $this->getArgumentName($argument); |
48 | 48 | yield from $value = $this->getArgumentValue($argument); |
49 | 49 | |
50 | - $definition->addArgument((string)$name->getReturn(), $value->getReturn()); |
|
50 | + $definition->addArgument((string) $name->getReturn(), $value->getReturn()); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return $definition; |
@@ -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 | { |