@@ -16,7 +16,6 @@ |
||
| 16 | 16 | use Railt\Reflection\Contracts\Reflection; |
| 17 | 17 | use Railt\Reflection\Document; |
| 18 | 18 | use Railt\SDL\Exception\VmException; |
| 19 | -use Railt\SDL\Frontend\IR\Opcode; |
|
| 20 | 19 | use Railt\SDL\Frontend\IR\OpcodeInterface; |
| 21 | 20 | |
| 22 | 21 | /** |
@@ -70,14 +70,14 @@ |
||
| 70 | 70 | $value = \gettype($result); |
| 71 | 71 | |
| 72 | 72 | if (\is_object($result)) { |
| 73 | - $value = \get_class($result) . '#' . \spl_object_hash($result); |
|
| 73 | + $value = \get_class($result).'#'.\spl_object_hash($result); |
|
| 74 | 74 | |
| 75 | 75 | if (\method_exists($result, '__toString')) { |
| 76 | - $value = (string)$result; |
|
| 76 | + $value = (string) $result; |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - $message = \sprintf('%4s = %s', '#' . $opcode->getId(), $value); |
|
| 80 | + $message = \sprintf('%4s = %s', '#'.$opcode->getId(), $value); |
|
| 81 | 81 | |
| 82 | 82 | $this->logger->debug($message); |
| 83 | 83 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * @param Context $context |
| 47 | - * @return iterable|OpcodeInterface[] |
|
| 47 | + * @return \Generator |
|
| 48 | 48 | */ |
| 49 | 49 | public function getOpcodes(Context $context): iterable |
| 50 | 50 | { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @param NodeInterface|RuleInterface $node |
| 120 | 120 | * @param Context $context |
| 121 | - * @return iterable|OpcodeInterface[]|\Generator |
|
| 121 | + * @return \Generator |
|
| 122 | 122 | */ |
| 123 | 123 | private function bypass(NodeInterface $node, Context $context): \Generator |
| 124 | 124 | { |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @param RuleInterface $key |
| 167 | 167 | * @param \Generator $iterator |
| 168 | - * @return \Generator|OpcodeInterface[] |
|
| 168 | + * @return \Generator |
|
| 169 | 169 | */ |
| 170 | 170 | private function extract(RuleInterface $key, \Generator $iterator): \Generator |
| 171 | 171 | { |
@@ -15,7 +15,6 @@ discard block |
||
| 15 | 15 | use Railt\Io\Readable; |
| 16 | 16 | use Railt\Parser\Ast\NodeInterface; |
| 17 | 17 | use Railt\Parser\Ast\RuleInterface; |
| 18 | -use Railt\Parser\Exception\UnexpectedTokenException; |
|
| 19 | 18 | use Railt\Parser\Exception\UnrecognizedTokenException; |
| 20 | 19 | use Railt\SDL\Exception\SyntaxException; |
| 21 | 20 | use Railt\SDL\Frontend\AST\ProvidesOpcode; |
@@ -23,8 +22,6 @@ discard block |
||
| 23 | 22 | use Railt\SDL\Frontend\IR\Deferred; |
| 24 | 23 | use Railt\SDL\Frontend\IR\Opcode\OpenOpcode; |
| 25 | 24 | use Railt\SDL\Frontend\IR\OpcodeInterface; |
| 26 | -use Railt\SDL\Frontend\IR\Prototype; |
|
| 27 | -use Railt\SDL\Frontend\IR\UnmountedOpcodeInterface; |
|
| 28 | 25 | |
| 29 | 26 | /** |
| 30 | 27 | * Class Frontend |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | private function log($value): void |
| 107 | 107 | { |
| 108 | 108 | if ($value instanceof OpcodeInterface) { |
| 109 | - $this->logger->debug((string)$value); |
|
| 109 | + $this->logger->debug((string) $value); |
|
| 110 | 110 | } else { |
| 111 | 111 | $this->logger->info(\gettype($value)); |
| 112 | 112 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | if (! \function_exists('\\iterator_each')) { |
| 75 | 75 | /** |
| 76 | - * @param iterable $iterator |
|
| 76 | + * @param Generator $iterator |
|
| 77 | 77 | * @param Closure $each |
| 78 | 78 | * @return Generator |
| 79 | 79 | */ |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | if (! \function_exists('\\iterator_reverse_each')) { |
| 94 | 94 | /** |
| 95 | - * @param iterable $iterator |
|
| 95 | + * @param Generator $iterator |
|
| 96 | 96 | * @param Closure $each |
| 97 | 97 | * @return Generator |
| 98 | 98 | */ |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | declare(strict_types=1); |
| 9 | 9 | |
| 10 | -if (! \function_exists('\\sdl')) { |
|
| 10 | +if (!\function_exists('\\sdl')) { |
|
| 11 | 11 | /** |
| 12 | 12 | * @param string $fileOrSources |
| 13 | 13 | * @param bool $filename |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | -if (! \function_exists('\\iterator_to_generator')) { |
|
| 28 | +if (!\function_exists('\\iterator_to_generator')) { |
|
| 29 | 29 | /** |
| 30 | 30 | * @param iterable $iterator |
| 31 | 31 | * @return Generator |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | -if (! \function_exists('\\iterator_map')) { |
|
| 40 | +if (!\function_exists('\\iterator_map')) { |
|
| 41 | 41 | /** |
| 42 | 42 | * @param iterable $iterator |
| 43 | 43 | * @param Closure $map |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | -if (! \function_exists('\\iterator_reverse_map')) { |
|
| 57 | +if (!\function_exists('\\iterator_reverse_map')) { |
|
| 58 | 58 | /** |
| 59 | 59 | * @param iterable $iterator |
| 60 | 60 | * @param Closure $map |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
| 74 | -if (! \function_exists('\\iterator_each')) { |
|
| 74 | +if (!\function_exists('\\iterator_each')) { |
|
| 75 | 75 | /** |
| 76 | 76 | * @param iterable $iterator |
| 77 | 77 | * @param Closure $each |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | -if (! \function_exists('\\iterator_reverse_each')) { |
|
| 93 | +if (!\function_exists('\\iterator_reverse_each')) { |
|
| 94 | 94 | /** |
| 95 | 95 | * @param iterable $iterator |
| 96 | 96 | * @param Closure $each |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
| 112 | -if (! \function_exists('\\iterator_filter')) { |
|
| 112 | +if (!\function_exists('\\iterator_filter')) { |
|
| 113 | 113 | /** |
| 114 | 114 | * @param iterable $iterator |
| 115 | 115 | * @param Closure $filter |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
| 131 | -if (! \function_exists('\\iterator_reverse_filter')) { |
|
| 131 | +if (!\function_exists('\\iterator_reverse_filter')) { |
|
| 132 | 132 | /** |
| 133 | 133 | * @param iterable $iterator |
| 134 | 134 | * @param Closure $filter |
@@ -55,11 +55,11 @@ |
||
| 55 | 55 | $parent = $context->create(); |
| 56 | 56 | $current = yield new DefineOpcode($this->getNameValue(), new TypeValue($this->getType())); |
| 57 | 57 | |
| 58 | - yield function () use ($current, $parent) { |
|
| 58 | + yield function() use ($current, $parent) { |
|
| 59 | 59 | yield new AddDefinitionOpcode($current, $parent); |
| 60 | 60 | }; |
| 61 | 61 | |
| 62 | - if (! ($description = $this->getDescriptionValue()) instanceof NullValue) { |
|
| 62 | + if (!($description = $this->getDescriptionValue()) instanceof NullValue) { |
|
| 63 | 63 | yield new AddDescriptionOpcode($current, $description); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -44,11 +44,11 @@ |
||
| 44 | 44 | $parent = $context->create(); |
| 45 | 45 | $current = yield new DefineOpcode($this->getFullNameValue(), new TypeValue($this->getType())); |
| 46 | 46 | |
| 47 | - yield function () use ($current, $parent) { |
|
| 47 | + yield function() use ($current, $parent) { |
|
| 48 | 48 | yield new AddDefinitionOpcode($current, $parent); |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | - if (! ($description = $this->getDescriptionValue()) instanceof NullValue) { |
|
| 51 | + if (!($description = $this->getDescriptionValue()) instanceof NullValue) { |
|
| 52 | 52 | yield new AddDescriptionOpcode($current, $description); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | private static function node(NodeInterface $ast): string |
| 59 | 59 | { |
| 60 | - return '<' . $ast->getName() . '>'; |
|
| 60 | + return '<'.$ast->getName().'>'; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | private static function opcode(OpcodeInterface $opcode): string |
| 68 | 68 | { |
| 69 | - return '#' . $opcode->getId() . ' ' . $opcode->getName(); |
|
| 69 | + return '#'.$opcode->getId().' '.$opcode->getName(); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | private static function value(ValueInterface $value): string |
| 77 | 77 | { |
| 78 | - return (string)$value; |
|
| 78 | + return (string) $value; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | return $value ? 'true' : 'false'; |
| 93 | 93 | |
| 94 | 94 | case \is_string($value): |
| 95 | - $minified = \preg_replace('/\s+/', ' ', (string)$value); |
|
| 96 | - return '"' . \addcslashes($minified, '"') . '"'; |
|
| 95 | + $minified = \preg_replace('/\s+/', ' ', (string) $value); |
|
| 96 | + return '"'.\addcslashes($minified, '"').'"'; |
|
| 97 | 97 | |
| 98 | 98 | default: |
| 99 | - return (string)$value; |
|
| 99 | + return (string) $value; |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | private static function object($value): string |
| 125 | 125 | { |
| 126 | - return \get_class($value) . '#' . \spl_object_hash($value); |
|
| 126 | + return \get_class($value).'#'.\spl_object_hash($value); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -132,6 +132,6 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | private static function file(Readable $readable): string |
| 134 | 134 | { |
| 135 | - return '(file)' . $readable->getPathname(); |
|
| 135 | + return '(file)'.$readable->getPathname(); |
|
| 136 | 136 | } |
| 137 | 137 | } |