Passed
Push — master ( ab9cf6...0bbf98 )
by Kirill
02:49
created
src/Grammar/Analyzer.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * Build the analyzer of the rules (does not analyze the rules).
76 76
      *
77
-     * @return Rule[]|\Traversable
77
+     * @return \Generator
78 78
      * @throws GrammarException
79 79
      */
80 80
     public function analyze(): iterable
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      * Implementation of “simple”.
310 310
      *
311 311
      * @param LookaheadIterator $tokens
312
-     * @param int|string|null $pNodeId
312
+     * @param string|null $pNodeId
313 313
      * @return string|int|null
314 314
      * @throws GrammarException
315 315
      */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -260,23 +260,23 @@  discard block
 block discarded – undo
260 260
                 break;
261 261
 
262 262
             case Parser::T_REPEAT_N_TO_M:
263
-                $min = (int)$tokens->current()->getValue(1);
264
-                $max = (int)$tokens->current()->getValue(2);
263
+                $min = (int) $tokens->current()->getValue(1);
264
+                $max = (int) $tokens->current()->getValue(2);
265 265
                 $tokens->next();
266 266
                 break;
267 267
 
268 268
             case Parser::T_REPEAT_ZERO_TO_M:
269
-                [$min, $max] = [0, (int)$tokens->current()->getValue(1)];
269
+                [$min, $max] = [0, (int) $tokens->current()->getValue(1)];
270 270
                 $tokens->next();
271 271
                 break;
272 272
 
273 273
             case Parser::T_REPEAT_N_OR_MORE:
274
-                [$min, $max] = [(int)$tokens->current()->getValue(1), -1];
274
+                [$min, $max] = [(int) $tokens->current()->getValue(1), -1];
275 275
                 $tokens->next();
276 276
                 break;
277 277
 
278 278
             case Parser::T_REPEAT_EXACTLY_N:
279
-                $min = $max = (int)$tokens->current()->getValue(1);
279
+                $min = $max = (int) $tokens->current()->getValue(1);
280 280
                 $tokens->next();
281 281
                 break;
282 282
         }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     {
368 368
         $tokenName = $tokens->current()->getValue(1);
369 369
 
370
-        if (! isset($this->tokens[$tokenName])) {
370
+        if (!isset($this->tokens[$tokenName])) {
371 371
             $error = \sprintf('Token %s does not exist in rule %s.', $tokenName, $this->ruleName);
372 372
             throw new GrammarException($error, 4);
373 373
         }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     {
390 390
         $tokenName = $tokens->current()->getValue(1);
391 391
 
392
-        $isEmptyRule = ! \array_key_exists($tokenName, $this->rules);
392
+        $isEmptyRule = !\array_key_exists($tokenName, $this->rules);
393 393
 
394 394
         if ($isEmptyRule) {
395 395
             $error = \vsprintf('Cannot call rule %s() in rule %s because it does not exist.', [
Please login to merge, or discard this patch.
src/Grammar/Delegate/RuleDelegate.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     }
40 40
 
41 41
     /**
42
-     * @param RuleInterface|NodeInterface $rule
42
+     * @param null|NodeInterface $rule
43 43
      * @return \Traversable
44 44
      */
45 45
     private function getTokens(RuleInterface $rule): \Traversable
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function getInnerTokens(): iterable
30 30
     {
31
-        return new LookaheadIterator((function () {
31
+        return new LookaheadIterator((function() {
32 32
             yield from $this->getTokens($this->first('RuleProduction'));
33 33
             yield new Eoi(0);
34 34
         })->call($this));
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function isKept(): bool
68 68
     {
69
-        return (bool)$this->first('ShouldKeep');
69
+        return (bool) $this->first('ShouldKeep');
70 70
     }
71 71
 
72 72
     /**
Please login to merge, or discard this patch.
src/Console/GrammarCompileCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@
 block discarded – undo
23 23
     /**
24 24
      * @var string Default parser output path
25 25
      */
26
-    private const PARSER_GRAMMAR = __DIR__ . '/../../resources/grammar.pp2';
26
+    private const PARSER_GRAMMAR = __DIR__.'/../../resources/grammar.pp2';
27 27
 
28 28
     /**
29 29
      * @var string Default parser output path
30 30
      */
31
-    private const OUT_PATH = __DIR__ . '/../Grammar';
31
+    private const OUT_PATH = __DIR__.'/../Grammar';
32 32
 
33 33
     /**
34 34
      * @var string Default generated parser class name
Please login to merge, or discard this patch.
src/Console/CompileCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
             $compiler->setClassName($in->getOption('class'));
42 42
         }
43 43
 
44
-        $cwd = \getcwd() ?: __DIR__ . '/..';
44
+        $cwd = \getcwd() ?: __DIR__.'/..';
45 45
 
46 46
         $compiler->saveTo($in->getOption('dir') ?: $cwd);
47 47
     }
Please login to merge, or discard this patch.
src/Console/AnalyzeCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
         $ast = $in->getOption('root') ? $ast->first($in->getOption('root')) : $ast;
39 39
 
40
-        $out->write((string)$ast);
40
+        $out->write((string) $ast);
41 41
     }
42 42
 
43 43
     /**
Please login to merge, or discard this patch.
src/Grammar/Reader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@
 block discarded – undo
111 111
 
112 112
                 case $child instanceof TokenDelegate:
113 113
                     $this->lexer->add($child->getTokenName(), $child->getTokenPattern());
114
-                    if (! $child->isKept()) {
114
+                    if (!$child->isKept()) {
115 115
                         $this->lexer->skip($child->getTokenName());
116 116
                     }
117 117
                     break;
Please login to merge, or discard this patch.
src/Compiler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function saveTo(string $path): void
82 82
     {
83
-        $pathName = $path . '/' . $this->class . '.php';
83
+        $pathName = $path.'/'.$this->class.'.php';
84 84
 
85 85
         \file_put_contents($pathName, $this->build());
86 86
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         \ob_start();
95 95
 
96 96
         try {
97
-            require __DIR__ . '/../resources/templates/parser.tpl.php';
97
+            require __DIR__.'/../resources/templates/parser.tpl.php';
98 98
             return \ob_get_contents();
99 99
         } catch (\Throwable $e) {
100 100
             throw $e;
Please login to merge, or discard this patch.
src/Grammar/Delegate/IncludeDelegate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         $file = $this->getValues()->current()->getValue(1);
31 31
 
32 32
         foreach (['', '.pp', '.pp2'] as $ext) {
33
-            $path = \dirname($from->getPathname()) . '/' . $file . $ext;
33
+            $path = \dirname($from->getPathname()).'/'.$file.$ext;
34 34
 
35 35
             if (\is_file($path)) {
36 36
                 return File::fromPathname($path);
Please login to merge, or discard this patch.