@@ -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 | { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $value = yield $rule->getChild(0); |
| 46 | 46 | |
| 47 | 47 | if ($value->getType()->typeOf(Type::string())) { |
| 48 | - yield from $this->load($this->include($ctx, (string)$value->getValue())); |
|
| 48 | + yield from $this->load($this->include($ctx, (string) $value->getValue())); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $error = 'Argument of include should be a string, but %s given'; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return $inclusion; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $pathname = \dirname($file->getPathname()) . \DIRECTORY_SEPARATOR . $inclusion; |
|
| 99 | + $pathname = \dirname($file->getPathname()).\DIRECTORY_SEPARATOR.$inclusion; |
|
| 100 | 100 | $pathname = \str_replace('/./', '/', $pathname); |
| 101 | 101 | |
| 102 | 102 | return $pathname; |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | /** |
| 39 | 39 | * @param ContextInterface $ctx |
| 40 | 40 | * @param RuleInterface $rule |
| 41 | - * @return \Generator|mixed|void |
|
| 41 | + * @return \Generator |
|
| 42 | 42 | */ |
| 43 | 43 | public function reduce(ContextInterface $ctx, RuleInterface $rule) |
| 44 | 44 | { |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * @param ContextInterface $ctx |
| 33 | 33 | * @param RuleInterface $rule |
| 34 | - * @return \Generator|mixed|void |
|
| 34 | + * @return \Generator |
|
| 35 | 35 | */ |
| 36 | 36 | public function reduce(ContextInterface $ctx, RuleInterface $rule) |
| 37 | 37 | { |
@@ -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 | { |
@@ -11,14 +11,9 @@ |
||
| 11 | 11 | |
| 12 | 12 | use Railt\Parser\Ast\RuleInterface; |
| 13 | 13 | use Railt\SDL\Exception\InvalidArgumentException; |
| 14 | -use Railt\SDL\Frontend\AST\TypeNameNode; |
|
| 15 | 14 | use Railt\SDL\Frontend\Builder\Definition\Definition; |
| 16 | 15 | use Railt\SDL\Frontend\Context\ContextInterface; |
| 17 | -use Railt\SDL\Frontend\Matcher; |
|
| 18 | -use Railt\SDL\Frontend\Parser; |
|
| 19 | 16 | use Railt\SDL\IR\SymbolTable\ValueInterface; |
| 20 | -use Railt\SDL\IR\Type; |
|
| 21 | -use Railt\SDL\IR\Type\Name; |
|
| 22 | 17 | use Railt\SDL\IR\Type\TypeNameInterface; |
| 23 | 18 | |
| 24 | 19 | /** |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | yield from $name = $this->getArgumentName($argument); |
| 53 | 53 | yield from $value = $this->getArgumentValue($argument); |
| 54 | 54 | |
| 55 | - $definition->addArgument((string)$name->getReturn(), $value->getReturn()); |
|
| 55 | + $definition->addArgument((string) $name->getReturn(), $value->getReturn()); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return $definition; |
@@ -41,8 +41,8 @@ |
||
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @param ContextInterface $ctx |
| 44 | - * @param RuleInterface|AstValueInterface $rule |
|
| 45 | - * @return mixed|Value |
|
| 44 | + * @param RuleInterface $rule |
|
| 45 | + * @return Value|null |
|
| 46 | 46 | */ |
| 47 | 47 | public function reduce(ContextInterface $ctx, RuleInterface $rule) |
| 48 | 48 | { |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * @param ContextInterface $ctx |
| 37 | 37 | * @param RuleInterface $rule |
| 38 | - * @return \Generator|ValueInterface |
|
| 38 | + * @return \Generator |
|
| 39 | 39 | */ |
| 40 | 40 | public function reduce(ContextInterface $ctx, RuleInterface $rule): \Generator |
| 41 | 41 | { |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | /** @var ValueInterface $value */ |
| 43 | 43 | $value = yield $rule->first('> #GenericInvocationName')->getChild(0); |
| 44 | 44 | |
| 45 | - $name = Name::new((string)$value->getValue()); |
|
| 45 | + $name = Name::new((string) $value->getValue()); |
|
| 46 | 46 | |
| 47 | 47 | // TODO Add arguments |
| 48 | 48 | |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Railt\Io\Readable; |
| 13 | 13 | use Railt\SDL\IR\SymbolTable\VarSymbol; |
| 14 | 14 | use Railt\SDL\IR\SymbolTable\VarSymbolInterface; |
| 15 | -use Railt\SDL\IR\SymbolTable\ValueInterface; |
|
| 16 | 15 | use Railt\SDL\IR\SymbolTableInterface; |
| 17 | 16 | use Railt\SDL\IR\Type\TypeInterface; |
| 18 | 17 | use Railt\SDL\IR\Type\TypeNameInterface; |
@@ -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 | $record = new VarSymbol($var, $type); |
| 134 | 134 | |
@@ -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; |