@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | private function addLoggerListener(): void |
| 46 | 46 | { |
| 47 | - parent::onTypeNotFound(function (string $type, ?Definition $from): void { |
|
| 47 | + parent::onTypeNotFound(function(string $type, ?Definition $from): void { |
|
| 48 | 48 | if ($this->logger) { |
| 49 | 49 | $direct = 'Try to load type %s from direct method executing'; |
| 50 | 50 | $context = 'Try to load type %s from %s (%s:%d)'; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function onTypeNotFound(\Closure $then): void |
| 65 | 65 | { |
| 66 | - parent::onTypeNotFound(function (string $type, ?Definition $from) use ($then): void { |
|
| 66 | + parent::onTypeNotFound(function(string $type, ?Definition $from) use ($then) : void { |
|
| 67 | 67 | if (($file = $then($type, $from)) instanceof Readable) { |
| 68 | 68 | $this->compiler->compile($file); |
| 69 | 69 | } |
@@ -52,11 +52,11 @@ |
||
| 52 | 52 | |
| 53 | 53 | $output = $this->option('out') ?: \dirname($schema->getPathname()); |
| 54 | 54 | |
| 55 | - if (! \is_dir($output)) { |
|
| 56 | - throw new NotReadableException('Output directory "' . $output . '" not exists'); |
|
| 55 | + if (!\is_dir($output)) { |
|
| 56 | + throw new NotReadableException('Output directory "'.$output.'" not exists'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $outputPathname = $output . '/' . \basename($schema->getPathname()) . '.json'; |
|
| 59 | + $outputPathname = $output.'/'.\basename($schema->getPathname()).'.json'; |
|
| 60 | 60 | |
| 61 | 61 | \file_put_contents($outputPathname, \json_encode($result)); |
| 62 | 62 | } |
@@ -65,11 +65,11 @@ |
||
| 65 | 65 | continue; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $position = $def->getFile()->getPathname() . ':' . $def->getLine(); |
|
| 68 | + $position = $def->getFile()->getPathname().':'.$def->getLine(); |
|
| 69 | 69 | |
| 70 | - $this->writeln('<fg=white;bg=green> ' . \str_repeat(' ', \strlen($position)) . ' </>'); |
|
| 71 | - $this->writeln('<fg=white;bg=green> ' . $position . ' </>'); |
|
| 72 | - $this->writeln('<fg=white;bg=green> ' . \str_repeat(' ', \strlen($position)) . ' </>'); |
|
| 70 | + $this->writeln('<fg=white;bg=green> '.\str_repeat(' ', \strlen($position)).' </>'); |
|
| 71 | + $this->writeln('<fg=white;bg=green> '.$position.' </>'); |
|
| 72 | + $this->writeln('<fg=white;bg=green> '.\str_repeat(' ', \strlen($position)).' </>'); |
|
| 73 | 73 | |
| 74 | 74 | $this->render($def); |
| 75 | 75 | $this->writeln("\n\n"); |
@@ -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 | } |
@@ -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 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function compile(Readable $file): DocumentInterface |
| 102 | 102 | { |
| 103 | - return $this->store->memoize($file, function (Readable $file): DocumentInterface { |
|
| 103 | + return $this->store->memoize($file, function(Readable $file): DocumentInterface { |
|
| 104 | 104 | return $this->generate($file, $this->ir($file)); |
| 105 | 105 | }); |
| 106 | 106 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | private function generate(Readable $readable, iterable $records): Document |
| 115 | 115 | { |
| 116 | - return $this->wrap(function () use ($readable, $records) { |
|
| 116 | + return $this->wrap(function() use ($readable, $records) { |
|
| 117 | 117 | return $this->back->run($readable, $records); |
| 118 | 118 | }); |
| 119 | 119 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function ir(Readable $readable): iterable |
| 127 | 127 | { |
| 128 | - return $this->wrap(function () use ($readable) { |
|
| 128 | + return $this->wrap(function() use ($readable) { |
|
| 129 | 129 | return $this->front->load($readable); |
| 130 | 130 | }); |
| 131 | 131 | } |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Psr\Log\LoggerInterface; |
| 15 | 15 | use Railt\Io\File; |
| 16 | 16 | use Railt\Io\Readable; |
| 17 | -use Railt\Reflection\Contracts\Document; |
|
| 18 | 17 | use Railt\Reflection\Contracts\Document as DocumentInterface; |
| 19 | 18 | use Railt\Reflection\Reflection; |
| 20 | 19 | use Railt\SDL\Compiler\Dictionary; |
@@ -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 | { |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | /** @var ValueInterface $value */ |
| 45 | 45 | $value = yield $rule->getChild(0); |
| 46 | 46 | |
| 47 | - if (! $value->getType()->typeOf(Type::string())) { |
|
| 47 | + if (!$value->getType()->typeOf(Type::string())) { |
|
| 48 | 48 | $error = 'Argument of include should be a string, but %s given'; |
| 49 | 49 | throw new InvalidArgumentException(\sprintf($error, $value->getType())); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - yield from $this->loadFile($this->include($ctx, (string)$value->getValue())); |
|
| 52 | + yield from $this->loadFile($this->include($ctx, (string) $value->getValue())); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -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; |
@@ -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; |
@@ -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 | } |