Completed
Push — master ( fe9d21...06b28a )
by Kirill
04:29
created
src/Compiler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 use Railt\Io\Readable;
13 13
 use Railt\Parser\Ast\RuleInterface;
14 14
 use Railt\Parser\Environment;
15
-use Railt\Parser\Exception\UnexpectedTokenException;
16 15
 use Railt\Parser\Exception\UnrecognizedTokenException;
17 16
 use Railt\Reflection\Contracts\Definition;
18 17
 use Railt\Reflection\Contracts\Dictionary;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function autoload(\Closure $then): void
86 86
     {
87
-        $this->dictionary->onTypeNotFound(function (string $type, ?Definition $from) use ($then): void {
87
+        $this->dictionary->onTypeNotFound(function(string $type, ?Definition $from) use ($then) : void {
88 88
             if (($file = $then($type, $from)) instanceof Readable) {
89 89
                 $this->compile($file);
90 90
             }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     {
117 117
         $key = $document->getFile()->getHash();
118 118
 
119
-        if (! isset($this->documents[$key])) {
119
+        if (!isset($this->documents[$key])) {
120 120
             $otherwise && $otherwise($document);
121 121
         }
122 122
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function compile(Readable $file): DocumentInterface
131 131
     {
132
-        return $this->memomize(new Document($this->reflection, $file), function (Document $document) use ($file): void {
132
+        return $this->memomize(new Document($this->reflection, $file), function(Document $document) use ($file): void {
133 133
             $ast = $this->parse($document, $file);
134 134
 
135 135
             foreach ($ast as $type) {
Please login to merge, or discard this patch.
src/Compiler/Definition/DirectiveDelegate.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 
56 56
     /**
57 57
      * @param DirectiveDefinition $definition
58
-     * @return iterable|DirectiveLocation[]
58
+     * @return \Generator
59 59
      */
60 60
     private function getLocations(DirectiveDefinition $definition): iterable
61 61
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     private function bootLocations(DirectiveDefinition $directive): void
46 46
     {
47 47
         foreach ($this->getLocations($directive) as $offset => $location) {
48
-            $this->transaction($location, function (DirectiveLocation $location) use ($directive): void {
48
+            $this->transaction($location, function(DirectiveLocation $location) use ($directive): void {
49 49
                 $this->verifyLocation($location);
50 50
                 $this->verifyDuplication($directive, $location);
51 51
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $isValid = $location->isExecutable() || $location->isPrivate();
91 91
 
92
-        if (! $isValid) {
92
+        if (!$isValid) {
93 93
             $error = \sprintf('Invalid directive location %s', $location);
94 94
 
95 95
             throw $this->error(new TypeConflictException($error))->in($location);
Please login to merge, or discard this patch.
src/Compiler/Definition/EnumDelegate.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 
57 57
     /**
58 58
      * @param EnumDefinition $enum
59
-     * @return iterable
59
+     * @return \Generator
60 60
      */
61 61
     private function getEnumValues(EnumDefinition $enum): iterable
62 62
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     private function bootValues(EnumDefinition $enum): void
48 48
     {
49 49
         foreach ($this->getEnumValues($enum) as $value) {
50
-            $this->transaction($value, function (EnumValueDefinition $value) use ($enum): void {
50
+            $this->transaction($value, function(EnumValueDefinition $value) use ($enum): void {
51 51
                 $this->verifyDuplication($enum, $value);
52 52
 
53 53
                 $enum->withValue($value);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         foreach ($this->first('EnumValues', 1) as $ast) {
66 66
             $enumValue = $this->createEnumValue($enum, $ast->first('T_NAME', 1));
67 67
 
68
-            $this->transaction($enumValue, function (EnumValueDefinition $def) use ($ast): void {
68
+            $this->transaction($enumValue, function(EnumValueDefinition $def) use ($ast): void {
69 69
                 $this->withDescription($def, $ast);
70 70
 
71 71
                 /** @var RuleInterface $defValue */
Please login to merge, or discard this patch.
src/Compiler/Value/StringValue.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
     /**
40 40
      * @param NodeInterface|RuleInterface $rule
41
-     * @return mixed|string
41
+     * @return string
42 42
      */
43 43
     protected function parse(NodeInterface $rule): string
44 44
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     private function renderSpecialCharacters(string $body): string
97 97
     {
98
-        $callee = function (array $matches): string {
98
+        $callee = function(array $matches): string {
99 99
             [$char, $code] = [$matches[0], $matches[1]];
100 100
 
101 101
             switch ($code) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     private function renderUtfSequences(string $body): string
129 129
     {
130
-        $callee = function (array $matches): string {
130
+        $callee = function(array $matches): string {
131 131
             [$char, $code] = [$matches[0], $matches[1]];
132 132
 
133 133
             try {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     {
158 158
         try {
159 159
             if (\function_exists('\\json_decode')) {
160
-                $result = @\json_decode('{"char": "' . $body . '"}')->char;
160
+                $result = @\json_decode('{"char": "'.$body.'"}')->char;
161 161
 
162 162
                 if (\json_last_error() === \JSON_ERROR_NONE) {
163 163
                     $body = $result;
Please login to merge, or discard this patch.
src/Compiler/Value/ConstantValue.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     protected static function getAstName(): string
34 34
     {
35
-        throw new \LogicException(__METHOD__ . ' is non-allowed');
35
+        throw new \LogicException(__METHOD__.' is non-allowed');
36 36
     }
37 37
 
38 38
     /**
@@ -41,6 +41,6 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function parse(NodeInterface $rule): string
43 43
     {
44
-        return (string)$rule->getValue();
44
+        return (string) $rule->getValue();
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
src/Compiler/Value/NumberValue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 return $this->parseInt($value->getValue());
53 53
         }
54 54
 
55
-        return (float)$value->getValue();
55
+        return (float) $value->getValue();
56 56
     }
57 57
 
58 58
     /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     private function parseExponential(string $value): float
81 81
     {
82
-        return (float)$value;
82
+        return (float) $value;
83 83
     }
84 84
 
85 85
     /**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     private function parseFloat(string $value): float
90 90
     {
91
-        return (float)$value;
91
+        return (float) $value;
92 92
     }
93 93
 
94 94
     /**
Please login to merge, or discard this patch.
src/Compiler/Definition/DefinitionDelegate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 
61 61
         $this->definition = $this->bootDefinition($this->document);
62 62
 
63
-        $this->stack->transaction($this->definition, function (AbstractDefinition $record): void {
63
+        $this->stack->transaction($this->definition, function(AbstractDefinition $record): void {
64 64
             $record->withOffset($this->getOffset());
65 65
 
66 66
             if ($record instanceof TypeDefinition) {
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 use Railt\Reflection\Contracts\Document;
12 12
 use Railt\SDL\Compiler;
13 13
 
14
-if (! \function_exists('\\sdl')) {
14
+if (!\function_exists('\\sdl')) {
15 15
     /**
16 16
      * @param string $fileOrSources
17 17
      * @param bool $filename
Please login to merge, or discard this patch.
src/Exception/CompilerException.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function __toString(): string
69 69
     {
70
-        $result  = $this->getHeader() . \PHP_EOL;
71
-        $result .= 'Stack trace:' . \PHP_EOL;
70
+        $result  = $this->getHeader().\PHP_EOL;
71
+        $result .= 'Stack trace:'.\PHP_EOL;
72 72
         $result .= $this->getFullTraceAsString();
73 73
 
74 74
         return $result;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         if ($this->stack) {
85 85
             foreach ($this->stack as $def) {
86
-                $result .= \sprintf('#%d %s(%d): %s', $i++, $def->getFile(), $def->getLine(), $def) . \PHP_EOL;
86
+                $result .= \sprintf('#%d %s(%d): %s', $i++, $def->getFile(), $def->getLine(), $def).\PHP_EOL;
87 87
             }
88 88
         }
89 89
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 continue;
93 93
             }
94 94
 
95
-            $result .= \preg_replace('/#\d+\h/iu', \sprintf('#%d ', $i++), $line) . "\n";
95
+            $result .= \preg_replace('/#\d+\h/iu', \sprintf('#%d ', $i++), $line)."\n";
96 96
         }
97 97
 
98 98
         return $result;
Please login to merge, or discard this patch.