@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | protected function pParam(Node\Param $node) { |
| 27 | 27 | return ($this->pModifiers($node->flags)) |
| 28 | - . ($node->type ? $this->p($node->type) . ' ' : '') |
|
| 29 | - . ($node->byRef ? '&' : '') |
|
| 30 | - . ($node->variadic ? '...' : '') |
|
| 31 | - . $this->p($node->var) |
|
| 32 | - . ($node->default ? ' = ' . $this->p($node->default) : ''); |
|
| 28 | + . ($node->type ? $this->p($node->type) . ' ' : '') |
|
| 29 | + . ($node->byRef ? '&' : '') |
|
| 30 | + . ($node->variadic ? '...' : '') |
|
| 31 | + . $this->p($node->var) |
|
| 32 | + . ($node->default ? ' = ' . $this->p($node->default) : ''); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | protected function pArg(Node\Arg $node) { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | return "<<<'$label'\n$node->value\n$label" |
| 123 | - . $this->docStringEndToken; |
|
| 123 | + . $this->docStringEndToken; |
|
| 124 | 124 | } |
| 125 | 125 | /* break missing intentionally */ |
| 126 | 126 | case Scalar\String_::KIND_SINGLE_QUOTED: |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $escaped = $this->escapeString($node->value, null); |
| 136 | 136 | return "<<<$label\n" . $escaped . "\n$label" |
| 137 | - . $this->docStringEndToken; |
|
| 137 | + . $this->docStringEndToken; |
|
| 138 | 138 | } |
| 139 | 139 | /* break missing intentionally */ |
| 140 | 140 | case Scalar\String_::KIND_DOUBLE_QUOTED: |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | return "<<<$label\n" . $this->pEncapsList($node->parts, null) . "\n$label" |
| 158 | - . $this->docStringEndToken; |
|
| 158 | + . $this->docStringEndToken; |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | return '"' . $this->pEncapsList($node->parts, '"') . '"'; |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | protected function pExpr_Instanceof(Expr\Instanceof_ $node) { |
| 397 | 397 | [$precedence, $associativity] = $this->precedenceMap[Expr\Instanceof_::class]; |
| 398 | 398 | return $this->pPrec($node->expr, $precedence, $associativity, -1) |
| 399 | - . ' instanceof ' |
|
| 400 | - . $this->pNewVariable($node->class); |
|
| 399 | + . ' instanceof ' |
|
| 400 | + . $this->pNewVariable($node->class); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | // Unary expressions |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | protected function pExpr_FuncCall(Expr\FuncCall $node) { |
| 498 | 498 | return $this->pCallLhs($node->name) |
| 499 | - . '(' . $this->pMaybeMultiline($node->args) . ')'; |
|
| 499 | + . '(' . $this->pMaybeMultiline($node->args) . ')'; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | protected function pExpr_MethodCall(Expr\MethodCall $node) { |
@@ -603,12 +603,12 @@ discard block |
||
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | return (null !== $node->key ? $this->p($node->key) . ' => ' : '') |
| 606 | - . $code; |
|
| 606 | + . $code; |
|
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) { |
| 610 | 610 | return $this->pDereferenceLhs($node->var) |
| 611 | - . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']'; |
|
| 611 | + . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']'; |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | protected function pExpr_ConstFetch(Expr\ConstFetch $node) { |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | protected function pExpr_Exit(Expr\Exit_ $node) { |
| 715 | 715 | $kind = $node->getAttribute('kind', Expr\Exit_::KIND_DIE); |
| 716 | 716 | return ($kind === Expr\Exit_::KIND_EXIT ? 'exit' : 'die') |
| 717 | - . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : ''); |
|
| 717 | + . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : ''); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | protected function pExpr_Throw(Expr\Throw_ $node) { |
@@ -727,9 +727,9 @@ discard block |
||
| 727 | 727 | } else { |
| 728 | 728 | // this is a bit ugly, but currently there is no way to detect whether the parentheses are necessary |
| 729 | 729 | return '(yield ' |
| 730 | - . ($node->key !== null ? $this->p($node->key) . ' => ' : '') |
|
| 731 | - . $this->p($node->value) |
|
| 732 | - . ')'; |
|
| 730 | + . ($node->key !== null ? $this->p($node->key) . ' => ' : '') |
|
| 731 | + . $this->p($node->value) |
|
| 732 | + . ')'; |
|
| 733 | 733 | } |
| 734 | 734 | } |
| 735 | 735 | |
@@ -738,10 +738,10 @@ discard block |
||
| 738 | 738 | protected function pStmt_Namespace(Stmt\Namespace_ $node) { |
| 739 | 739 | if ($this->canUseSemicolonNamespaces) { |
| 740 | 740 | return 'namespace ' . $this->p($node->name) . ';' |
| 741 | - . $this->nl . $this->pStmts($node->stmts, false); |
|
| 741 | + . $this->nl . $this->pStmts($node->stmts, false); |
|
| 742 | 742 | } else { |
| 743 | 743 | return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '') |
| 744 | - . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 744 | + . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 745 | 745 | } |
| 746 | 746 | } |
| 747 | 747 | |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | |
| 758 | 758 | protected function pStmt_UseUse(Stmt\UseUse $node) { |
| 759 | 759 | return $this->pUseType($node->type) . $this->p($node->name) |
| 760 | - . (null !== $node->alias ? ' as ' . $node->alias : ''); |
|
| 760 | + . (null !== $node->alias ? ' as ' . $node->alias : ''); |
|
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | protected function pUseType($type) { |
@@ -767,8 +767,8 @@ discard block |
||
| 767 | 767 | |
| 768 | 768 | protected function pStmt_Interface(Stmt\Interface_ $node) { |
| 769 | 769 | return 'interface ' . $node->name |
| 770 | - . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '') |
|
| 771 | - . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 770 | + . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '') |
|
| 771 | + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | protected function pStmt_Class(Stmt\Class_ $node) { |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | |
| 778 | 778 | protected function pStmt_Trait(Stmt\Trait_ $node) { |
| 779 | 779 | return 'trait ' . $node->name |
| 780 | - . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 780 | + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | protected function pStmt_TraitUse(Stmt\TraitUse $node) { |
@@ -788,15 +788,15 @@ discard block |
||
| 788 | 788 | |
| 789 | 789 | protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) { |
| 790 | 790 | return $this->p($node->trait) . '::' . $node->method |
| 791 | - . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';'; |
|
| 791 | + . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';'; |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | protected function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node) { |
| 795 | 795 | return (null !== $node->trait ? $this->p($node->trait) . '::' : '') |
| 796 | - . $node->method . ' as' |
|
| 797 | - . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '') |
|
| 798 | - . (null !== $node->newName ? ' ' . $node->newName : '') |
|
| 799 | - . ';'; |
|
| 796 | + . $node->method . ' as' |
|
| 797 | + . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '') |
|
| 798 | + . (null !== $node->newName ? ' ' . $node->newName : '') |
|
| 799 | + . ';'; |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | protected function pStmt_Property(Stmt\Property $node) { |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | |
| 808 | 808 | protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) { |
| 809 | 809 | return '$' . $node->name |
| 810 | - . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); |
|
| 810 | + . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | protected function pStmt_ClassMethod(Stmt\ClassMethod $node) { |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | |
| 826 | 826 | protected function pStmt_ClassConst(Stmt\ClassConst $node) { |
| 827 | 827 | return $this->pModifiers($node->flags) |
| 828 | - . 'const ' . $this->pCommaSeparated($node->consts) . ';'; |
|
| 828 | + . 'const ' . $this->pCommaSeparated($node->consts) . ';'; |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | protected function pStmt_Function(Stmt\Function_ $node) { |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | |
| 845 | 845 | protected function pStmt_Declare(Stmt\Declare_ $node) { |
| 846 | 846 | return 'declare (' . $this->pCommaSeparated($node->declares) . ')' |
| 847 | - . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); |
|
| 847 | + . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | protected function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) { |
@@ -855,14 +855,14 @@ discard block |
||
| 855 | 855 | |
| 856 | 856 | protected function pStmt_If(Stmt\If_ $node) { |
| 857 | 857 | return 'if (' . $this->p($node->cond) . ') {' |
| 858 | - . $this->pStmts($node->stmts) . $this->nl . '}' |
|
| 859 | - . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '') |
|
| 860 | - . (null !== $node->else ? ' ' . $this->p($node->else) : ''); |
|
| 858 | + . $this->pStmts($node->stmts) . $this->nl . '}' |
|
| 859 | + . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '') |
|
| 860 | + . (null !== $node->else ? ' ' . $this->p($node->else) : ''); |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | protected function pStmt_ElseIf(Stmt\ElseIf_ $node) { |
| 864 | 864 | return 'elseif (' . $this->p($node->cond) . ') {' |
| 865 | - . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 865 | + . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 866 | 866 | } |
| 867 | 867 | |
| 868 | 868 | protected function pStmt_Else(Stmt\Else_ $node) { |
@@ -871,49 +871,49 @@ discard block |
||
| 871 | 871 | |
| 872 | 872 | protected function pStmt_For(Stmt\For_ $node) { |
| 873 | 873 | return 'for (' |
| 874 | - . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '') |
|
| 875 | - . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '') |
|
| 876 | - . $this->pCommaSeparated($node->loop) |
|
| 877 | - . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 874 | + . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '') |
|
| 875 | + . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '') |
|
| 876 | + . $this->pCommaSeparated($node->loop) |
|
| 877 | + . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | protected function pStmt_Foreach(Stmt\Foreach_ $node) { |
| 881 | 881 | return 'foreach (' . $this->p($node->expr) . ' as ' |
| 882 | - . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '') |
|
| 883 | - . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {' |
|
| 884 | - . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 882 | + . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '') |
|
| 883 | + . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {' |
|
| 884 | + . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | protected function pStmt_While(Stmt\While_ $node) { |
| 888 | 888 | return 'while (' . $this->p($node->cond) . ') {' |
| 889 | - . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 889 | + . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | protected function pStmt_Do(Stmt\Do_ $node) { |
| 893 | 893 | return 'do {' . $this->pStmts($node->stmts) . $this->nl |
| 894 | - . '} while (' . $this->p($node->cond) . ');'; |
|
| 894 | + . '} while (' . $this->p($node->cond) . ');'; |
|
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | protected function pStmt_Switch(Stmt\Switch_ $node) { |
| 898 | 898 | return 'switch (' . $this->p($node->cond) . ') {' |
| 899 | - . $this->pStmts($node->cases) . $this->nl . '}'; |
|
| 899 | + . $this->pStmts($node->cases) . $this->nl . '}'; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | protected function pStmt_Case(Stmt\Case_ $node) { |
| 903 | 903 | return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':' |
| 904 | - . $this->pStmts($node->stmts); |
|
| 904 | + . $this->pStmts($node->stmts); |
|
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | protected function pStmt_TryCatch(Stmt\TryCatch $node) { |
| 908 | 908 | return 'try {' . $this->pStmts($node->stmts) . $this->nl . '}' |
| 909 | - . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '') |
|
| 910 | - . ($node->finally !== null ? ' ' . $this->p($node->finally) : ''); |
|
| 909 | + . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '') |
|
| 910 | + . ($node->finally !== null ? ' ' . $this->p($node->finally) : ''); |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | protected function pStmt_Catch(Stmt\Catch_ $node) { |
| 914 | 914 | return 'catch (' . $this->pImplode($node->types, '|') |
| 915 | - . ($node->var !== null ? ' ' . $this->p($node->var) : '') |
|
| 916 | - . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 915 | + . ($node->var !== null ? ' ' . $this->p($node->var) : '') |
|
| 916 | + . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; |
|
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | protected function pStmt_Finally(Stmt\Finally_ $node) { |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | |
| 965 | 965 | protected function pStmt_StaticVar(Stmt\StaticVar $node) { |
| 966 | 966 | return $this->p($node->var) |
| 967 | - . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); |
|
| 967 | + . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | protected function pStmt_Unset(Stmt\Unset_ $node) { |