@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $builder = $this->builder; |
24 | 24 | |
25 | 25 | /** @var Builder $result */ |
26 | - $result = static function (array $params) use ($builder) { |
|
26 | + $result = static function(array $params) use ($builder) { |
|
27 | 27 | $fileName = func_get_arg(1); |
28 | 28 | |
29 | 29 | $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | $ast = $parser->parse($code); |
34 | 34 | |
35 | 35 | /** @var Stmt $node */ |
36 | - foreach ($ast as $node){ |
|
37 | - if(isset($node->type) && $node->type == Use_::TYPE_NORMAL and !empty($node->uses)){ |
|
36 | + foreach ($ast as $node) { |
|
37 | + if (isset($node->type) && $node->type == Use_::TYPE_NORMAL and !empty($node->uses)) { |
|
38 | 38 | foreach ($node->uses as $use) { |
39 | 39 | $className = end($use->name->parts); |
40 | - $builder->uses[ $className ] = 'use ' . implode('\\', $use->name->parts) . ';'; |
|
40 | + $builder->uses[$className] = 'use ' . implode('\\', $use->name->parts) . ';'; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | $prettyPrinter = new PhpRender(['builder' => $builder, 'context' => $fileName]); |
50 | 50 | $newCode = $prettyPrinter->prettyPrintFile($ast); |
51 | - $outputPathFile = $builder->getOutputPath(basename($fileName) . '.' .md5($newCode) . '.ast'); |
|
51 | + $outputPathFile = $builder->getOutputPath(basename($fileName) . '.' . md5($newCode) . '.ast'); |
|
52 | 52 | file_put_contents($outputPathFile, $newCode); |
53 | 53 | $output = require $outputPathFile; |
54 | 54 | @unlink($outputPathFile); |
@@ -247,6 +247,6 @@ |
||
247 | 247 | */ |
248 | 248 | public static function require(string $config): callable |
249 | 249 | { |
250 | - return static fn () => require $config; |
|
250 | + return static fn() => require $config; |
|
251 | 251 | } |
252 | 252 | } |
@@ -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) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | protected function pScalar_LNumber(Scalar\LNumber $node) { |
165 | - if ($node->value === -\PHP_INT_MAX-1) { |
|
165 | + if ($node->value === -\PHP_INT_MAX - 1) { |
|
166 | 166 | // PHP_INT_MIN cannot be represented as a literal, |
167 | 167 | // because the sign is not part of the literal |
168 | 168 | return '(-' . \PHP_INT_MAX . '-1)'; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | ? $this->p($node->name) |
521 | 521 | : '{' . $this->p($node->name) . '}') |
522 | 522 | : $node->name); |
523 | - switch ($className){ |
|
523 | + switch ($className) { |
|
524 | 524 | case 'Buildtime': |
525 | 525 | $token = $this->pMaybeMultiline($node->args); |
526 | 526 | break; |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | . ($node->unpack ? '...' : '') |
597 | 597 | . $this->p($node->value); |
598 | 598 | |
599 | - if(isset($node->value) && $node->value instanceof Expr\FuncCall){ |
|
599 | + if (isset($node->value) && $node->value instanceof Expr\FuncCall) { |
|
600 | 600 | $token = '\'__' . md5($code) . '__\''; |
601 | 601 | $this->options['builder']->closures[$token] = $code; |
602 | 602 | $code = $token; |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | } |
692 | 692 | $code = 'new ' . $this->pNewVariable($node->class) |
693 | 693 | . '(' . $this->pMaybeMultiline($node->args) . ')'; |
694 | - if($this->pNewVariable($node->class) == 'ReverseBlockMerge'){ |
|
694 | + if ($this->pNewVariable($node->class) == 'ReverseBlockMerge') { |
|
695 | 695 | return $code; |
696 | 696 | } |
697 | 697 | $token = '\'__' . md5($code) . '__\''; |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | |
783 | 783 | protected function pStmt_TraitUse(Stmt\TraitUse $node) { |
784 | 784 | $class = $this->pCommaSeparated($node->traits) |
785 | - . (empty($node->adaptations)? ';': ' {' . $this->pStmts($node->adaptations) . $this->nl . '}'); |
|
785 | + . (empty($node->adaptations) ? ';' : ' {' . $this->pStmts($node->adaptations) . $this->nl . '}'); |
|
786 | 786 | return 'use ' . $class; |
787 | 787 | } |
788 | 788 | |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | return (null !== $node->trait ? $this->p($node->trait) . '::' : '') |
796 | 796 | . $node->method . ' as' |
797 | 797 | . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '') |
798 | - . (null !== $node->newName ? ' ' . $node->newName : '') |
|
798 | + . (null !== $node->newName ? ' ' . $node->newName : '') |
|
799 | 799 | . ';'; |
800 | 800 | } |
801 | 801 | |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | // Escape other control characters |
1031 | - return preg_replace_callback('/([\0-\10\16-\37])(?=([0-7]?))/', function ($matches) { |
|
1031 | + return preg_replace_callback('/([\0-\10\16-\37])(?=([0-7]?))/', function($matches) { |
|
1032 | 1032 | $oct = decoct(ord($matches[1])); |
1033 | 1033 | if ($matches[2] !== '') { |
1034 | 1034 | // If there is a trailing digit, use the full three character form |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | protected function pDereferenceLhs(Node $node) { |
1062 | 1062 | if (!$this->dereferenceLhsRequiresParens($node)) { |
1063 | 1063 | return $this->p($node); |
1064 | - } else { |
|
1064 | + } else { |
|
1065 | 1065 | return '(' . $this->p($node) . ')'; |
1066 | 1066 | } |
1067 | 1067 | } |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | protected function pCallLhs(Node $node) { |
1070 | 1070 | if (!$this->callLhsRequiresParens($node)) { |
1071 | 1071 | return $this->p($node); |
1072 | - } else { |
|
1072 | + } else { |
|
1073 | 1073 | return '(' . $this->p($node) . ')'; |
1074 | 1074 | } |
1075 | 1075 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | protected function writeFile(string $path, array $data): void |
15 | 15 | { |
16 | - if($data) { |
|
16 | + if ($data) { |
|
17 | 17 | $envs = '[]'; //Helper::exportVar($data); |
18 | 18 | } else { |
19 | 19 | $envs = '[]'; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $constants = $this->constantsRequired() ? $this->builder->getConfig('constants')->buildRequires() : ''; |
144 | 144 | $params = $this->paramsRequired() ? "\$params = (array) require __DIR__ . '/params.php';" : ''; |
145 | 145 | $uses = ''; |
146 | - if($data) { |
|
146 | + if ($data) { |
|
147 | 147 | $variables = $this->buildPhpPartials($data); |
148 | 148 | $uses = implode("\n", $this->builder->uses); |
149 | 149 | } else { |
@@ -181,18 +181,18 @@ discard block |
||
181 | 181 | foreach ($data as $key => $value) { |
182 | 182 | if (is_array($value)) { |
183 | 183 | $output .= "'" . $key . "' => " . $this->buildPhpPartials($value) . ",\n"; |
184 | - } elseif(is_string($value)) { |
|
185 | - if(isset($this->builder->closures["'{$value}'"])) { |
|
184 | + } elseif (is_string($value)) { |
|
185 | + if (isset($this->builder->closures["'{$value}'"])) { |
|
186 | 186 | $value = $this->builder->closures["'{$value}'"]; |
187 | 187 | } else { |
188 | 188 | $value = "'{$value}'"; |
189 | 189 | } |
190 | 190 | $output .= "'" . $key . "' => {$value},\n"; |
191 | 191 | } else { |
192 | - if(is_bool($value)) { |
|
193 | - $value = $value? 'true': 'false'; |
|
192 | + if (is_bool($value)) { |
|
193 | + $value = $value ? 'true' : 'false'; |
|
194 | 194 | $output .= "'" . $key . "' => {$value},\n"; |
195 | - } elseif(is_null($value)){ |
|
195 | + } elseif (is_null($value)) { |
|
196 | 196 | $output .= "'" . $key . "' => null,\n"; |
197 | 197 | } else { |
198 | 198 | $output .= "'" . $key . "' => {$value},\n"; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | - if($output) { |
|
203 | + if ($output) { |
|
204 | 204 | while (preg_match('~\'__(\w+)__\'~', $output, $m)) { |
205 | 205 | foreach ($this->builder->closures as $closureKey => $closure) { |
206 | 206 | if (strpos($output, $closureKey) !== false) { |