@@ -9,7 +9,6 @@ |
||
| 9 | 9 | |
| 10 | 10 | namespace Railt\SDL\IR; |
| 11 | 11 | |
| 12 | -use Railt\SDL\Exception\CompilerException; |
|
| 13 | 12 | use Railt\SDL\Exception\NotFoundException; |
| 14 | 13 | use Railt\SDL\IR\SymbolTable\VarSymbol; |
| 15 | 14 | use Railt\SDL\IR\SymbolTable\VarSymbolInterface; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param VarSymbolInterface $record |
| 34 | 34 | * @return int |
| 35 | 35 | */ |
| 36 | - public function declare(VarSymbolInterface $record): int |
|
| 36 | + public function declare(VarSymbolInterface$record): int |
|
| 37 | 37 | { |
| 38 | 38 | $id = $this->id++; |
| 39 | 39 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function fetch(int $addr): VarSymbolInterface |
| 51 | 51 | { |
| 52 | - if (! isset($this->variables[$addr])) { |
|
| 52 | + if (!isset($this->variables[$addr])) { |
|
| 53 | 53 | $error = \sprintf('Mismatched variable address 0x%08x', $addr); |
| 54 | 54 | throw new NotFoundException($error); |
| 55 | 55 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $variables = []; |
| 76 | 76 | foreach ($this->variables as $id => $var) { |
| 77 | - $variables[$id] = (string)$var; |
|
| 77 | + $variables[$id] = (string) $var; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return [ |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * @param string|iterable|TypeNameInterface $name |
|
| 96 | + * @param TypeNameInterface $name |
|
| 97 | 97 | * @param TypeInterface|null $of |
| 98 | 98 | * @return TypeInterface|static |
| 99 | 99 | */ |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * @param TypeInterface $type |
| 146 | - * @return \Generator|TypeInterface[] |
|
| 146 | + * @return \Generator |
|
| 147 | 147 | */ |
| 148 | 148 | private function getInheritanceSequence(TypeInterface $type): \Generator |
| 149 | 149 | { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $fqn = Name::new($name)->getFullyQualifiedName(); |
| 105 | 105 | |
| 106 | - return self::getInternalType($fqn, $of, function () use ($name, $of): TypeInterface { |
|
| 106 | + return self::getInternalType($fqn, $of, function() use ($name, $of): TypeInterface { |
|
| 107 | 107 | return new static($name, $of); |
| 108 | 108 | }); |
| 109 | 109 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function of(TypeInterface $of): TypeInterface |
| 116 | 116 | { |
| 117 | - \assert(! $this->isInternal(), 'Can not change inheritance logic of internal types'); |
|
| 117 | + \assert(!$this->isInternal(), 'Can not change inheritance logic of internal types'); |
|
| 118 | 118 | |
| 119 | 119 | return static::new($this->type, $of); |
| 120 | 120 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | yield $type; |
| 151 | 151 | |
| 152 | - if (! $type->getName()->is(static::ROOT_TYPE)) { |
|
| 152 | + if (!$type->getName()->is(static::ROOT_TYPE)) { |
|
| 153 | 153 | yield from $this->getInheritanceSequence($type->getParent()); |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | public function isInputable(): bool |
| 161 | 161 | { |
| 162 | 162 | if ($this->inputable === null) { |
| 163 | - if ($this->isBuiltin() && ! \in_array($this->fqn(), static::ALLOWS_TO_INPUT, true)) { |
|
| 163 | + if ($this->isBuiltin() && !\in_array($this->fqn(), static::ALLOWS_TO_INPUT, true)) { |
|
| 164 | 164 | return $this->inputable = false; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | public function isReturnable(): bool |
| 218 | 218 | { |
| 219 | 219 | if ($this->returnable === null) { |
| 220 | - if ($this->isBuiltin() && ! \in_array($this->fqn(), static::ALLOWS_TO_OUTPUT, true)) { |
|
| 220 | + if ($this->isBuiltin() && !\in_array($this->fqn(), static::ALLOWS_TO_OUTPUT, true)) { |
|
| 221 | 221 | return $this->returnable = false; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | if ($this->hash === null) { |
| 271 | 271 | $this->hash = $this->fqn() === self::ROOT_TYPE |
| 272 | 272 | ? \sha1($this->fqn()) |
| 273 | - : \sha1($this->fqn() . ':' . $this->of->getHash()); |
|
| 273 | + : \sha1($this->fqn().':'.$this->of->getHash()); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | return $this->hash; |
@@ -58,6 +58,6 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function __toString(): string |
| 60 | 60 | { |
| 61 | - return $this->getName() . ': ' . $this->getHint()->getFullyQualifiedName(); |
|
| 61 | + return $this->getName().': '.$this->getHint()->getFullyQualifiedName(); |
|
| 62 | 62 | } |
| 63 | 63 | } |
@@ -30,6 +30,6 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public static function match(string $lexeme, string $value): bool |
| 32 | 32 | { |
| 33 | - return (bool)\preg_match(self::pattern($lexeme), $value); |
|
| 33 | + return (bool) \preg_match(self::pattern($lexeme), $value); |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -28,5 +28,5 @@ |
||
| 28 | 28 | * @param TypeInterface|null $type |
| 29 | 29 | * @return VarSymbolInterface |
| 30 | 30 | */ |
| 31 | - public function declare(string $var, TypeInterface $type = null): VarSymbolInterface; |
|
| 31 | + public function declare(string$var,TypeInterface$type=null): VarSymbolInterface; |
|
| 32 | 32 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | use Railt\SDL\Exception\CompilerException; |
| 16 | 16 | |
| 17 | 17 | |
| 18 | -if (! \function_exists('sdl')) { |
|
| 18 | +if (!\function_exists('sdl')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * @param string $fileOrSources |
| 21 | 21 | * @param bool $filename |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -if (! \function_exists('object_to_string')) { |
|
| 34 | +if (!\function_exists('object_to_string')) { |
|
| 35 | 35 | /** |
| 36 | 36 | * @param object $object |
| 37 | 37 | * @return string |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | : \spl_object_hash($object); |
| 46 | 46 | |
| 47 | 47 | if (is_renderable($object)) { |
| 48 | - return \sprintf('%s(%s)#%s', \get_class($object), (string)$object, $hash); |
|
| 48 | + return \sprintf('%s(%s)#%s', \get_class($object), (string) $object, $hash); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | return \sprintf('%s#%s', \get_class($object), $hash); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | -if (! \function_exists('is_renderable')) { |
|
| 56 | +if (!\function_exists('is_renderable')) { |
|
| 57 | 57 | /** |
| 58 | 58 | * @param mixed $value |
| 59 | 59 | * @return bool |
@@ -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 | /** |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | protected function verified(string $name): string |
| 50 | 50 | { |
| 51 | - if (! \preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
| 51 | + if (!\preg_match('/^[_a-zA-Z][_a-zA-Z0-9]*$/', $name)) { |
|
| 52 | 52 | $error = \sprintf('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "%s" does not.', $name); |
| 53 | 53 | throw new SemanticException($error); |
| 54 | 54 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function offsetExists($offset): bool |
| 151 | 151 | { |
| 152 | - return $this->has((string)$offset); |
|
| 152 | + return $this->has((string) $offset); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function offsetGet($offset) |
| 160 | 160 | { |
| 161 | - return $this->get((string)$offset); |
|
| 161 | + return $this->get((string) $offset); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function offsetSet($offset, $value): void |
| 169 | 169 | { |
| 170 | - $this->set((string)$offset, $value); |
|
| 170 | + $this->set((string) $offset, $value); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -175,6 +175,6 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function offsetUnset($offset): void |
| 177 | 177 | { |
| 178 | - $this->delete((string)$offset); |
|
| 178 | + $this->delete((string) $offset); |
|
| 179 | 179 | } |
| 180 | 180 | } |