Completed
Push — master ( 9a6a14...6dffb7 )
by Nikita
04:08
created
grammar/analyze.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -20,10 +20,16 @@
 block discarded – undo
20 20
     'case_separator', 'optional_comma'
21 21
 ));
22 22
 
23
+/**
24
+ * @param string $regex
25
+ */
23 26
 function regex($regex) {
24 27
     return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~';
25 28
 }
26 29
 
30
+/**
31
+ * @param string $regex
32
+ */
27 33
 function magicSplit($regex, $string) {
28 34
     $pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string);
29 35
 
Please login to merge, or discard this patch.
grammar/rebuildParsers.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -175,6 +175,9 @@  discard block
 block discarded – undo
175 175
     );
176 176
 }
177 177
 
178
+/**
179
+ * @param integer $num
180
+ */
178 181
 function assertArgs($num, $args, $name) {
179 182
     if ($num != count($args)) {
180 183
         die('Wrong argument count for ' . $name . '().');
@@ -203,10 +206,16 @@  discard block
 block discarded – undo
203 206
 /// Regex helper functions ///
204 207
 //////////////////////////////
205 208
 
209
+/**
210
+ * @param string $regex
211
+ */
206 212
 function regex($regex) {
207 213
     return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~';
208 214
 }
209 215
 
216
+/**
217
+ * @param string $regex
218
+ */
210 219
 function magicSplit($regex, $string) {
211 220
     $pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string);
212 221
 
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 assertArgs(2, $args, $name);
139 139
 
140 140
                 return 'if (is_array(' . $args[1] . ')) { $$ = array_merge(' . $args[0] . ', ' . $args[1] . '); }'
141
-                     . ' else { ' . $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0] . '; }';
141
+                        . ' else { ' . $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0] . '; }';
142 142
             }
143 143
 
144 144
             if ('toArray' == $name) {
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
                 assertArgs(3, $args, $name);
158 158
 
159 159
                 return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {'
160
-                     . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, ' . $args[1] . ', ' . $args[2] . '); } }';
160
+                        . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, ' . $args[1] . ', ' . $args[2] . '); } }';
161 161
             }
162 162
 
163 163
             if ('parseEncapsedDoc' == $name) {
164 164
                 assertArgs(2, $args, $name);
165 165
 
166 166
                 return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {'
167
-                     . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, ' . $args[1] . '); } }'
168
-                     . ' $s->value = preg_replace(\'~(\r\n|\n|\r)\z~\', \'\', $s->value);'
169
-                     . ' if (\'\' === $s->value) array_pop(' . $args[0] . ');';
167
+                        . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, ' . $args[1] . '); } }'
168
+                        . ' $s->value = preg_replace(\'~(\r\n|\n|\r)\z~\', \'\', $s->value);'
169
+                        . ' if (\'\' === $s->value) array_pop(' . $args[0] . ');';
170 170
             }
171 171
 
172 172
             return $matches[0];
Please login to merge, or discard this patch.
lib/PhpParser/Builder/Class_.php 1 patch
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,6 @@
 block discarded – undo
44 44
     /**
45 45
      * Implements one or more interfaces.
46 46
      *
47
-     * @param Name|string $interface Name of interface to implement
48
-     * @param Name|string $...       More interfaces to implement
49 47
      *
50 48
      * @return $this The builder instance (for fluid interface)
51 49
      */
Please login to merge, or discard this patch.
lib/PhpParser/Builder/Interface_.php 1 patch
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,6 @@
 block discarded – undo
25 25
     /**
26 26
      * Extends one or more interfaces.
27 27
      *
28
-     * @param Name|string $interface Name of interface to extend
29
-     * @param Name|string $...       More interfaces to extend
30 28
      *
31 29
      * @return $this The builder instance (for fluid interface)
32 30
      */
Please login to merge, or discard this patch.
lib/PhpParser/NodeVisitor/NameResolver.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -110,6 +110,9 @@
 block discarded – undo
110 110
         );
111 111
     }
112 112
 
113
+    /**
114
+     * @param Name $type
115
+     */
113 116
     protected function addAlias(Stmt\UseUse $use, $type, Name $prefix = null) {
114 117
         // Add prefix for group uses
115 118
         $name = $prefix ? Name::concat($prefix, $use->name) : $use->name;
Please login to merge, or discard this patch.
lib/PhpParser/Parser/Multiple.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -51,6 +51,9 @@
 block discarded – undo
51 51
         return $this->errors;
52 52
     }
53 53
 
54
+    /**
55
+     * @param string $code
56
+     */
54 57
     private function tryParse(Parser $parser, $code) {
55 58
         $stmts = null;
56 59
         $error = null;
Please login to merge, or discard this patch.
lib/PhpParser/PrettyPrinter/Standard.php 3 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -534,6 +534,9 @@  discard block
 block discarded – undo
534 534
              . ($node->name->getLast() !== $node->alias ? ' as ' . $node->alias : '');
535 535
     }
536 536
 
537
+    /**
538
+     * @param integer $type
539
+     */
537 540
     private function pUseType($type) {
538 541
         return $type === Stmt\Use_::TYPE_FUNCTION ? 'function '
539 542
             : ($type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : '');
@@ -744,6 +747,9 @@  discard block
 block discarded – undo
744 747
         return is_string($node) ? $node : $this->p($node);
745 748
     }
746 749
 
750
+    /**
751
+     * @param string $afterClassToken
752
+     */
747 753
     protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) {
748 754
         return $this->pModifiers($node->type)
749 755
         . 'class' . $afterClassToken
@@ -760,6 +766,9 @@  discard block
 block discarded – undo
760 766
         }
761 767
     }
762 768
 
769
+    /**
770
+     * @param integer $modifiers
771
+     */
763 772
     protected function pModifiers($modifiers) {
764 773
         return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC    ? 'public '    : '')
765 774
              . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '')
@@ -769,6 +778,9 @@  discard block
 block discarded – undo
769 778
              . ($modifiers & Stmt\Class_::MODIFIER_FINAL     ? 'final '     : '');
770 779
     }
771 780
 
781
+    /**
782
+     * @param string $quote
783
+     */
772 784
     protected function pEncapsList(array $encapsList, $quote) {
773 785
         $return = '';
774 786
         foreach ($encapsList as $element) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
         return ($node->static ? 'static ' : '')
464 464
              . 'function ' . ($node->byRef ? '&' : '')
465 465
              . '(' . $this->pCommaSeparated($node->params) . ')'
466
-             . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')': '')
466
+             . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')' : '')
467 467
              . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
468 468
              . ' {' . $this->pStmts($node->stmts) . "\n" . '}';
469 469
     }
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
         return (null !== $node->trait ? $this->p($node->trait) . '::' : '')
571 571
              . $node->method . ' as'
572 572
              . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '')
573
-             . (null !== $node->newName     ? ' ' . $node->newName                        : '')
573
+             . (null !== $node->newName ? ' ' . $node->newName : '')
574 574
              . ';';
575 575
     }
576 576
 
@@ -761,12 +761,12 @@  discard block
 block discarded – undo
761 761
     }
762 762
 
763 763
     protected function pModifiers($modifiers) {
764
-        return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC    ? 'public '    : '')
764
+        return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '')
765 765
              . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '')
766
-             . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE   ? 'private '   : '')
767
-             . ($modifiers & Stmt\Class_::MODIFIER_STATIC    ? 'static '    : '')
768
-             . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT  ? 'abstract '  : '')
769
-             . ($modifiers & Stmt\Class_::MODIFIER_FINAL     ? 'final '     : '');
766
+             . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE ? 'private ' : '')
767
+             . ($modifiers & Stmt\Class_::MODIFIER_STATIC ? 'static ' : '')
768
+             . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT ? 'abstract ' : '')
769
+             . ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : '');
770 770
     }
771 771
 
772 772
     protected function pEncapsList(array $encapsList, $quote) {
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
             || $node instanceof Expr\ClassConstFetch
798 798
         ) {
799 799
             return $this->p($node);
800
-        } else  {
800
+        } else {
801 801
             return '(' . $this->p($node) . ')';
802 802
         }
803 803
     }
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
             || $node instanceof Expr\Array_
813 813
         ) {
814 814
             return $this->p($node);
815
-        } else  {
815
+        } else {
816 816
             return '(' . $this->p($node) . ')';
817 817
         }
818 818
     }
Please login to merge, or discard this patch.
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 
20 20
     public function pParam(Node\Param $node) {
21 21
         return ($node->type ? $this->pType($node->type) . ' ' : '')
22
-             . ($node->byRef ? '&' : '')
23
-             . ($node->variadic ? '...' : '')
24
-             . '$' . $node->name
25
-             . ($node->default ? ' = ' . $this->p($node->default) : '');
22
+                . ($node->byRef ? '&' : '')
23
+                . ($node->variadic ? '...' : '')
24
+                . '$' . $node->name
25
+                . ($node->default ? ' = ' . $this->p($node->default) : '');
26 26
     }
27 27
 
28 28
     public function pArg(Node\Arg $node) {
@@ -357,22 +357,22 @@  discard block
 block discarded – undo
357 357
 
358 358
     public function pExpr_FuncCall(Expr\FuncCall $node) {
359 359
         return $this->pCallLhs($node->name)
360
-             . '(' . $this->pCommaSeparated($node->args) . ')';
360
+                . '(' . $this->pCommaSeparated($node->args) . ')';
361 361
     }
362 362
 
363 363
     public function pExpr_MethodCall(Expr\MethodCall $node) {
364 364
         return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name)
365
-             . '(' . $this->pCommaSeparated($node->args) . ')';
365
+                . '(' . $this->pCommaSeparated($node->args) . ')';
366 366
     }
367 367
 
368 368
     public function pExpr_StaticCall(Expr\StaticCall $node) {
369 369
         return $this->pDereferenceLhs($node->class) . '::'
370
-             . ($node->name instanceof Expr
370
+                . ($node->name instanceof Expr
371 371
                 ? ($node->name instanceof Expr\Variable
372 372
                    ? $this->p($node->name)
373 373
                    : '{' . $this->p($node->name) . '}')
374 374
                 : $node->name)
375
-             . '(' . $this->pCommaSeparated($node->args) . ')';
375
+                . '(' . $this->pCommaSeparated($node->args) . ')';
376 376
     }
377 377
 
378 378
     public function pExpr_Empty(Expr\Empty_ $node) {
@@ -431,12 +431,12 @@  discard block
 block discarded – undo
431 431
 
432 432
     public function pExpr_ArrayItem(Expr\ArrayItem $node) {
433 433
         return (null !== $node->key ? $this->p($node->key) . ' => ' : '')
434
-             . ($node->byRef ? '&' : '') . $this->p($node->value);
434
+                . ($node->byRef ? '&' : '') . $this->p($node->value);
435 435
     }
436 436
 
437 437
     public function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) {
438 438
         return $this->pDereferenceLhs($node->var)
439
-             . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']';
439
+                . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']';
440 440
     }
441 441
 
442 442
     public function pExpr_ConstFetch(Expr\ConstFetch $node) {
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
 
462 462
     public function pExpr_Closure(Expr\Closure $node) {
463 463
         return ($node->static ? 'static ' : '')
464
-             . 'function ' . ($node->byRef ? '&' : '')
465
-             . '(' . $this->pCommaSeparated($node->params) . ')'
466
-             . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')': '')
467
-             . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
468
-             . ' {' . $this->pStmts($node->stmts) . "\n" . '}';
464
+                . 'function ' . ($node->byRef ? '&' : '')
465
+                . '(' . $this->pCommaSeparated($node->params) . ')'
466
+                . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')': '')
467
+                . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
468
+                . ' {' . $this->pStmts($node->stmts) . "\n" . '}';
469 469
     }
470 470
 
471 471
     public function pExpr_ClosureUse(Expr\ClosureUse $node) {
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
         } else {
503 503
             // this is a bit ugly, but currently there is no way to detect whether the parentheses are necessary
504 504
             return '(yield '
505
-                 . ($node->key !== null ? $this->p($node->key) . ' => ' : '')
506
-                 . $this->p($node->value)
507
-                 . ')';
505
+                    . ($node->key !== null ? $this->p($node->key) . ' => ' : '')
506
+                    . $this->p($node->value)
507
+                    . ')';
508 508
         }
509 509
     }
510 510
 
@@ -515,23 +515,23 @@  discard block
 block discarded – undo
515 515
             return 'namespace ' . $this->p($node->name) . ';' . "\n" . $this->pStmts($node->stmts, false);
516 516
         } else {
517 517
             return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '')
518
-                 . ' {' . $this->pStmts($node->stmts) . "\n" . '}';
518
+                    . ' {' . $this->pStmts($node->stmts) . "\n" . '}';
519 519
         }
520 520
     }
521 521
 
522 522
     public function pStmt_Use(Stmt\Use_ $node) {
523 523
         return 'use ' . $this->pUseType($node->type)
524
-             . $this->pCommaSeparated($node->uses) . ';';
524
+                . $this->pCommaSeparated($node->uses) . ';';
525 525
     }
526 526
 
527 527
     public function pStmt_GroupUse(Stmt\GroupUse $node) {
528 528
         return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix)
529
-             . '\{' . $this->pCommaSeparated($node->uses) . '};';
529
+                . '\{' . $this->pCommaSeparated($node->uses) . '};';
530 530
     }
531 531
 
532 532
     public function pStmt_UseUse(Stmt\UseUse $node) {
533 533
         return $this->pUseType($node->type) . $this->p($node->name)
534
-             . ($node->name->getLast() !== $node->alias ? ' as ' . $node->alias : '');
534
+                . ($node->name->getLast() !== $node->alias ? ' as ' . $node->alias : '');
535 535
     }
536 536
 
537 537
     private function pUseType($type) {
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 
542 542
     public function pStmt_Interface(Stmt\Interface_ $node) {
543 543
         return 'interface ' . $node->name
544
-             . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '')
545
-             . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
544
+                . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '')
545
+                . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
546 546
     }
547 547
 
548 548
     public function pStmt_Class(Stmt\Class_ $node) {
@@ -551,27 +551,27 @@  discard block
 block discarded – undo
551 551
 
552 552
     public function pStmt_Trait(Stmt\Trait_ $node) {
553 553
         return 'trait ' . $node->name
554
-             . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
554
+                . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
555 555
     }
556 556
 
557 557
     public function pStmt_TraitUse(Stmt\TraitUse $node) {
558 558
         return 'use ' . $this->pCommaSeparated($node->traits)
559
-             . (empty($node->adaptations)
559
+                . (empty($node->adaptations)
560 560
                 ? ';'
561 561
                 : ' {' . $this->pStmts($node->adaptations) . "\n" . '}');
562 562
     }
563 563
 
564 564
     public function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) {
565 565
         return $this->p($node->trait) . '::' . $node->method
566
-             . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';';
566
+                . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';';
567 567
     }
568 568
 
569 569
     public function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node) {
570 570
         return (null !== $node->trait ? $this->p($node->trait) . '::' : '')
571
-             . $node->method . ' as'
572
-             . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '')
573
-             . (null !== $node->newName     ? ' ' . $node->newName                        : '')
574
-             . ';';
571
+                . $node->method . ' as'
572
+                . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '')
573
+                . (null !== $node->newName     ? ' ' . $node->newName                        : '')
574
+                . ';';
575 575
     }
576 576
 
577 577
     public function pStmt_Property(Stmt\Property $node) {
@@ -580,15 +580,15 @@  discard block
 block discarded – undo
580 580
 
581 581
     public function pStmt_PropertyProperty(Stmt\PropertyProperty $node) {
582 582
         return '$' . $node->name
583
-             . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
583
+                . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
584 584
     }
585 585
 
586 586
     public function pStmt_ClassMethod(Stmt\ClassMethod $node) {
587 587
         return $this->pModifiers($node->type)
588
-             . 'function ' . ($node->byRef ? '&' : '') . $node->name
589
-             . '(' . $this->pCommaSeparated($node->params) . ')'
590
-             . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
591
-             . (null !== $node->stmts
588
+                . 'function ' . ($node->byRef ? '&' : '') . $node->name
589
+                . '(' . $this->pCommaSeparated($node->params) . ')'
590
+                . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
591
+                . (null !== $node->stmts
592 592
                 ? "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}'
593 593
                 : ';');
594 594
     }
@@ -599,9 +599,9 @@  discard block
 block discarded – undo
599 599
 
600 600
     public function pStmt_Function(Stmt\Function_ $node) {
601 601
         return 'function ' . ($node->byRef ? '&' : '') . $node->name
602
-             . '(' . $this->pCommaSeparated($node->params) . ')'
603
-             . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
604
-             . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
602
+                . '(' . $this->pCommaSeparated($node->params) . ')'
603
+                . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
604
+                . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
605 605
     }
606 606
 
607 607
     public function pStmt_Const(Stmt\Const_ $node) {
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 
611 611
     public function pStmt_Declare(Stmt\Declare_ $node) {
612 612
         return 'declare (' . $this->pCommaSeparated($node->declares) . ')'
613
-             . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . "\n" . '}' : ';');
613
+                . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . "\n" . '}' : ';');
614 614
     }
615 615
 
616 616
     public function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) {
@@ -621,14 +621,14 @@  discard block
 block discarded – undo
621 621
 
622 622
     public function pStmt_If(Stmt\If_ $node) {
623 623
         return 'if (' . $this->p($node->cond) . ') {'
624
-             . $this->pStmts($node->stmts) . "\n" . '}'
625
-             . $this->pImplode($node->elseifs)
626
-             . (null !== $node->else ? $this->p($node->else) : '');
624
+                . $this->pStmts($node->stmts) . "\n" . '}'
625
+                . $this->pImplode($node->elseifs)
626
+                . (null !== $node->else ? $this->p($node->else) : '');
627 627
     }
628 628
 
629 629
     public function pStmt_ElseIf(Stmt\ElseIf_ $node) {
630 630
         return ' elseif (' . $this->p($node->cond) . ') {'
631
-             . $this->pStmts($node->stmts) . "\n" . '}';
631
+                . $this->pStmts($node->stmts) . "\n" . '}';
632 632
     }
633 633
 
634 634
     public function pStmt_Else(Stmt\Else_ $node) {
@@ -637,50 +637,50 @@  discard block
 block discarded – undo
637 637
 
638 638
     public function pStmt_For(Stmt\For_ $node) {
639 639
         return 'for ('
640
-             . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '')
641
-             . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '')
642
-             . $this->pCommaSeparated($node->loop)
643
-             . ') {' . $this->pStmts($node->stmts) . "\n" . '}';
640
+                . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '')
641
+                . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '')
642
+                . $this->pCommaSeparated($node->loop)
643
+                . ') {' . $this->pStmts($node->stmts) . "\n" . '}';
644 644
     }
645 645
 
646 646
     public function pStmt_Foreach(Stmt\Foreach_ $node) {
647 647
         return 'foreach (' . $this->p($node->expr) . ' as '
648
-             . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '')
649
-             . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {'
650
-             . $this->pStmts($node->stmts) . "\n" . '}';
648
+                . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '')
649
+                . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {'
650
+                . $this->pStmts($node->stmts) . "\n" . '}';
651 651
     }
652 652
 
653 653
     public function pStmt_While(Stmt\While_ $node) {
654 654
         return 'while (' . $this->p($node->cond) . ') {'
655
-             . $this->pStmts($node->stmts) . "\n" . '}';
655
+                . $this->pStmts($node->stmts) . "\n" . '}';
656 656
     }
657 657
 
658 658
     public function pStmt_Do(Stmt\Do_ $node) {
659 659
         return 'do {' . $this->pStmts($node->stmts) . "\n"
660
-             . '} while (' . $this->p($node->cond) . ');';
660
+                . '} while (' . $this->p($node->cond) . ');';
661 661
     }
662 662
 
663 663
     public function pStmt_Switch(Stmt\Switch_ $node) {
664 664
         return 'switch (' . $this->p($node->cond) . ') {'
665
-             . $this->pStmts($node->cases) . "\n" . '}';
665
+                . $this->pStmts($node->cases) . "\n" . '}';
666 666
     }
667 667
 
668 668
     public function pStmt_Case(Stmt\Case_ $node) {
669 669
         return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':'
670
-             . $this->pStmts($node->stmts);
670
+                . $this->pStmts($node->stmts);
671 671
     }
672 672
 
673 673
     public function pStmt_TryCatch(Stmt\TryCatch $node) {
674 674
         return 'try {' . $this->pStmts($node->stmts) . "\n" . '}'
675
-             . $this->pImplode($node->catches)
676
-             . ($node->finallyStmts !== null
675
+                . $this->pImplode($node->catches)
676
+                . ($node->finallyStmts !== null
677 677
                 ? ' finally {' . $this->pStmts($node->finallyStmts) . "\n" . '}'
678 678
                 : '');
679 679
     }
680 680
 
681 681
     public function pStmt_Catch(Stmt\Catch_ $node) {
682 682
         return ' catch (' . $this->p($node->type) . ' $' . $node->var . ') {'
683
-             . $this->pStmts($node->stmts) . "\n" . '}';
683
+                . $this->pStmts($node->stmts) . "\n" . '}';
684 684
     }
685 685
 
686 686
     public function pStmt_Break(Stmt\Break_ $node) {
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 
724 724
     public function pStmt_StaticVar(Stmt\StaticVar $node) {
725 725
         return '$' . $node->name
726
-             . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
726
+                . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
727 727
     }
728 728
 
729 729
     public function pStmt_Unset(Stmt\Unset_ $node) {
@@ -762,11 +762,11 @@  discard block
 block discarded – undo
762 762
 
763 763
     protected function pModifiers($modifiers) {
764 764
         return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC    ? 'public '    : '')
765
-             . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '')
766
-             . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE   ? 'private '   : '')
767
-             . ($modifiers & Stmt\Class_::MODIFIER_STATIC    ? 'static '    : '')
768
-             . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT  ? 'abstract '  : '')
769
-             . ($modifiers & Stmt\Class_::MODIFIER_FINAL     ? 'final '     : '');
765
+                . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '')
766
+                . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE   ? 'private '   : '')
767
+                . ($modifiers & Stmt\Class_::MODIFIER_STATIC    ? 'static '    : '')
768
+                . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT  ? 'abstract '  : '')
769
+                . ($modifiers & Stmt\Class_::MODIFIER_FINAL     ? 'final '     : '');
770 770
     }
771 771
 
772 772
     protected function pEncapsList(array $encapsList, $quote) {
Please login to merge, or discard this patch.
lib/PhpParser/PrettyPrinterAbstract.php 3 patches
Doc Comments   +13 added lines, -1 removed lines patch added patch discarded remove patch
@@ -187,6 +187,10 @@  discard block
 block discarded – undo
187 187
         return $this->{'p' . $node->getType()}($node);
188 188
     }
189 189
 
190
+    /**
191
+     * @param string $type
192
+     * @param string $operatorString
193
+     */
190 194
     protected function pInfixOp($type, Node $leftNode, $operatorString, Node $rightNode) {
191 195
         list($precedence, $associativity) = $this->precedenceMap[$type];
192 196
 
@@ -195,11 +199,19 @@  discard block
 block discarded – undo
195 199
              . $this->pPrec($rightNode, $precedence, $associativity, 1);
196 200
     }
197 201
 
202
+    /**
203
+     * @param string $type
204
+     * @param string $operatorString
205
+     */
198 206
     protected function pPrefixOp($type, $operatorString, Node $node) {
199 207
         list($precedence, $associativity) = $this->precedenceMap[$type];
200 208
         return $operatorString . $this->pPrec($node, $precedence, $associativity, 1);
201 209
     }
202 210
 
211
+    /**
212
+     * @param string $type
213
+     * @param string $operatorString
214
+     */
203 215
     protected function pPostfixOp($type, Node $node, $operatorString) {
204 216
         list($precedence, $associativity) = $this->precedenceMap[$type];
205 217
         return $this->pPrec($node, $precedence, $associativity, -1) . $operatorString;
@@ -264,7 +276,7 @@  discard block
 block discarded – undo
264 276
      *
265 277
      * @param string $string Not to be indented string
266 278
      *
267
-     * @return mixed String marked with $this->noIndentToken's.
279
+     * @return string String marked with $this->noIndentToken's.
268 280
      */
269 281
     protected function pNoIndent($string) {
270 282
         return str_replace("\n", "\n" . $this->noIndentToken, $string);
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -191,8 +191,8 @@
 block discarded – undo
191 191
         list($precedence, $associativity) = $this->precedenceMap[$type];
192 192
 
193 193
         return $this->pPrec($leftNode, $precedence, $associativity, -1)
194
-             . $operatorString
195
-             . $this->pPrec($rightNode, $precedence, $associativity, 1);
194
+                . $operatorString
195
+                . $this->pPrec($rightNode, $precedence, $associativity, 1);
196 196
     }
197 197
 
198 198
     protected function pPrefixOp($type, $operatorString, Node $node) {
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -9,65 +9,65 @@
 block discarded – undo
9 9
 {
10 10
     protected $precedenceMap = array(
11 11
         // [precedence, associativity] where for the latter -1 is %left, 0 is %nonassoc and 1 is %right
12
-        'Expr_BinaryOp_Pow'            => array(  0,  1),
13
-        'Expr_BitwiseNot'              => array( 10,  1),
14
-        'Expr_PreInc'                  => array( 10,  1),
15
-        'Expr_PreDec'                  => array( 10,  1),
16
-        'Expr_PostInc'                 => array( 10, -1),
17
-        'Expr_PostDec'                 => array( 10, -1),
18
-        'Expr_UnaryPlus'               => array( 10,  1),
19
-        'Expr_UnaryMinus'              => array( 10,  1),
20
-        'Expr_Cast_Int'                => array( 10,  1),
21
-        'Expr_Cast_Double'             => array( 10,  1),
22
-        'Expr_Cast_String'             => array( 10,  1),
23
-        'Expr_Cast_Array'              => array( 10,  1),
24
-        'Expr_Cast_Object'             => array( 10,  1),
25
-        'Expr_Cast_Bool'               => array( 10,  1),
26
-        'Expr_Cast_Unset'              => array( 10,  1),
27
-        'Expr_ErrorSuppress'           => array( 10,  1),
28
-        'Expr_Instanceof'              => array( 20,  0),
29
-        'Expr_BooleanNot'              => array( 30,  1),
30
-        'Expr_BinaryOp_Mul'            => array( 40, -1),
31
-        'Expr_BinaryOp_Div'            => array( 40, -1),
32
-        'Expr_BinaryOp_Mod'            => array( 40, -1),
33
-        'Expr_BinaryOp_Plus'           => array( 50, -1),
34
-        'Expr_BinaryOp_Minus'          => array( 50, -1),
35
-        'Expr_BinaryOp_Concat'         => array( 50, -1),
36
-        'Expr_BinaryOp_ShiftLeft'      => array( 60, -1),
37
-        'Expr_BinaryOp_ShiftRight'     => array( 60, -1),
38
-        'Expr_BinaryOp_Smaller'        => array( 70,  0),
39
-        'Expr_BinaryOp_SmallerOrEqual' => array( 70,  0),
40
-        'Expr_BinaryOp_Greater'        => array( 70,  0),
41
-        'Expr_BinaryOp_GreaterOrEqual' => array( 70,  0),
42
-        'Expr_BinaryOp_Equal'          => array( 80,  0),
43
-        'Expr_BinaryOp_NotEqual'       => array( 80,  0),
44
-        'Expr_BinaryOp_Identical'      => array( 80,  0),
45
-        'Expr_BinaryOp_NotIdentical'   => array( 80,  0),
46
-        'Expr_BinaryOp_Spaceship'      => array( 80,  0),
47
-        'Expr_BinaryOp_BitwiseAnd'     => array( 90, -1),
12
+        'Expr_BinaryOp_Pow'            => array(0, 1),
13
+        'Expr_BitwiseNot'              => array(10, 1),
14
+        'Expr_PreInc'                  => array(10, 1),
15
+        'Expr_PreDec'                  => array(10, 1),
16
+        'Expr_PostInc'                 => array(10, -1),
17
+        'Expr_PostDec'                 => array(10, -1),
18
+        'Expr_UnaryPlus'               => array(10, 1),
19
+        'Expr_UnaryMinus'              => array(10, 1),
20
+        'Expr_Cast_Int'                => array(10, 1),
21
+        'Expr_Cast_Double'             => array(10, 1),
22
+        'Expr_Cast_String'             => array(10, 1),
23
+        'Expr_Cast_Array'              => array(10, 1),
24
+        'Expr_Cast_Object'             => array(10, 1),
25
+        'Expr_Cast_Bool'               => array(10, 1),
26
+        'Expr_Cast_Unset'              => array(10, 1),
27
+        'Expr_ErrorSuppress'           => array(10, 1),
28
+        'Expr_Instanceof'              => array(20, 0),
29
+        'Expr_BooleanNot'              => array(30, 1),
30
+        'Expr_BinaryOp_Mul'            => array(40, -1),
31
+        'Expr_BinaryOp_Div'            => array(40, -1),
32
+        'Expr_BinaryOp_Mod'            => array(40, -1),
33
+        'Expr_BinaryOp_Plus'           => array(50, -1),
34
+        'Expr_BinaryOp_Minus'          => array(50, -1),
35
+        'Expr_BinaryOp_Concat'         => array(50, -1),
36
+        'Expr_BinaryOp_ShiftLeft'      => array(60, -1),
37
+        'Expr_BinaryOp_ShiftRight'     => array(60, -1),
38
+        'Expr_BinaryOp_Smaller'        => array(70, 0),
39
+        'Expr_BinaryOp_SmallerOrEqual' => array(70, 0),
40
+        'Expr_BinaryOp_Greater'        => array(70, 0),
41
+        'Expr_BinaryOp_GreaterOrEqual' => array(70, 0),
42
+        'Expr_BinaryOp_Equal'          => array(80, 0),
43
+        'Expr_BinaryOp_NotEqual'       => array(80, 0),
44
+        'Expr_BinaryOp_Identical'      => array(80, 0),
45
+        'Expr_BinaryOp_NotIdentical'   => array(80, 0),
46
+        'Expr_BinaryOp_Spaceship'      => array(80, 0),
47
+        'Expr_BinaryOp_BitwiseAnd'     => array(90, -1),
48 48
         'Expr_BinaryOp_BitwiseXor'     => array(100, -1),
49 49
         'Expr_BinaryOp_BitwiseOr'      => array(110, -1),
50 50
         'Expr_BinaryOp_BooleanAnd'     => array(120, -1),
51 51
         'Expr_BinaryOp_BooleanOr'      => array(130, -1),
52
-        'Expr_BinaryOp_Coalesce'       => array(140,  1),
52
+        'Expr_BinaryOp_Coalesce'       => array(140, 1),
53 53
         'Expr_Ternary'                 => array(150, -1),
54 54
         // parser uses %left for assignments, but they really behave as %right
55
-        'Expr_Assign'                  => array(160,  1),
56
-        'Expr_AssignRef'               => array(160,  1),
57
-        'Expr_AssignOp_Plus'           => array(160,  1),
58
-        'Expr_AssignOp_Minus'          => array(160,  1),
59
-        'Expr_AssignOp_Mul'            => array(160,  1),
60
-        'Expr_AssignOp_Div'            => array(160,  1),
61
-        'Expr_AssignOp_Concat'         => array(160,  1),
62
-        'Expr_AssignOp_Mod'            => array(160,  1),
63
-        'Expr_AssignOp_BitwiseAnd'     => array(160,  1),
64
-        'Expr_AssignOp_BitwiseOr'      => array(160,  1),
65
-        'Expr_AssignOp_BitwiseXor'     => array(160,  1),
66
-        'Expr_AssignOp_ShiftLeft'      => array(160,  1),
67
-        'Expr_AssignOp_ShiftRight'     => array(160,  1),
68
-        'Expr_AssignOp_Pow'            => array(160,  1),
69
-        'Expr_YieldFrom'               => array(165,  1),
70
-        'Expr_Print'                   => array(168,  1),
55
+        'Expr_Assign'                  => array(160, 1),
56
+        'Expr_AssignRef'               => array(160, 1),
57
+        'Expr_AssignOp_Plus'           => array(160, 1),
58
+        'Expr_AssignOp_Minus'          => array(160, 1),
59
+        'Expr_AssignOp_Mul'            => array(160, 1),
60
+        'Expr_AssignOp_Div'            => array(160, 1),
61
+        'Expr_AssignOp_Concat'         => array(160, 1),
62
+        'Expr_AssignOp_Mod'            => array(160, 1),
63
+        'Expr_AssignOp_BitwiseAnd'     => array(160, 1),
64
+        'Expr_AssignOp_BitwiseOr'      => array(160, 1),
65
+        'Expr_AssignOp_BitwiseXor'     => array(160, 1),
66
+        'Expr_AssignOp_ShiftLeft'      => array(160, 1),
67
+        'Expr_AssignOp_ShiftRight'     => array(160, 1),
68
+        'Expr_AssignOp_Pow'            => array(160, 1),
69
+        'Expr_YieldFrom'               => array(165, 1),
70
+        'Expr_Print'                   => array(168, 1),
71 71
         'Expr_BinaryOp_LogicalAnd'     => array(170, -1),
72 72
         'Expr_BinaryOp_LogicalXor'     => array(180, -1),
73 73
         'Expr_BinaryOp_LogicalOr'      => array(190, -1),
Please login to merge, or discard this patch.
lib/PhpParser/Lexer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         $this->code = $code; // keep the code around for __halt_compiler() handling
64 64
         $this->pos  = -1;
65
-        $this->line =  1;
65
+        $this->line = 1;
66 66
         $this->filePos = 0;
67 67
     }
68 68
 
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
             if (T_DOUBLE_COLON === $i) {
265 265
                 // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM
266 266
                 $tokenMap[$i] = Tokens::T_PAAMAYIM_NEKUDOTAYIM;
267
-            } elseif(T_OPEN_TAG_WITH_ECHO === $i) {
267
+            } elseif (T_OPEN_TAG_WITH_ECHO === $i) {
268 268
                 // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO
269 269
                 $tokenMap[$i] = Tokens::T_ECHO;
270
-            } elseif(T_CLOSE_TAG === $i) {
270
+            } elseif (T_CLOSE_TAG === $i) {
271 271
                 // T_CLOSE_TAG is equivalent to ';'
272 272
                 $tokenMap[$i] = ord(';');
273 273
             } elseif ('UNKNOWN' !== $name = token_name($i)) {
Please login to merge, or discard this patch.