File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
src/Bridges/ApplicationLatte Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,19 @@ public function macroControl(MacroNode $node, PhpWriter $writer)
8484 $ name = $ writer ->formatWord ($ words [0 ]);
8585 $ method = isset ($ words [1 ]) ? ucfirst ($ words [1 ]) : '' ;
8686 $ method = Strings::match ($ method , '#^\w*\z# ' ) ? "render $ method " : "{ \"render $ method \"} " ;
87+
88+ $ tokens = $ node ->tokenizer ;
89+ $ pos = $ tokens ->position ;
8790 $ param = $ writer ->formatArray ();
88- if (!Strings::contains ($ node ->args , '=> ' )) {
89- $ param = substr ($ param , $ param [0 ] === '[ ' ? 1 : 6 , -1 ); // removes array() or []
91+ $ tokens ->position = $ pos ;
92+ while ($ tokens ->nextToken ()) {
93+ if ($ tokens ->isCurrent ('=> ' ) && !$ tokens ->depth ) {
94+ $ wrap = TRUE ;
95+ break ;
96+ }
97+ }
98+ if (empty ($ wrap )) {
99+ $ param = substr ($ param , 1 , -1 ); // removes array() or []
90100 }
91101 return ($ name [0 ] === '$ ' ? "if (is_object( $ name)) \$_tmp = $ name; else " : '' )
92102 . '$_tmp = $this->global->uiControl->getComponent( ' . $ name . '); '
You can’t perform that action at this time.
0 commit comments