File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
src/TwigComponent/src/Twig Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -45,14 +45,10 @@ public function compile(Compiler $compiler): void
4545 $ compiler ->addDebugInfo ($ this );
4646
4747 // since twig/twig 3.9.0: Using the internal "twig_to_array" function is deprecated.
48- $ compiler
49- ->write ('$toArray = function ($data) { ' )
50- ;
51-
5248 if (method_exists (CoreExtension::class, 'toArray ' )) {
53- $ compiler -> write ( ' return Twig\Extension\CoreExtension::toArray($data);}; ' ) ;
49+ $ twig_to_array = ' Twig\Extension\CoreExtension::toArray ' ;
5450 } else {
55- $ compiler -> write ( ' return twig_to_array($data);}; ' ) ;
51+ $ twig_to_array = ' twig_to_array ' ;
5652 }
5753
5854 /*
@@ -67,7 +63,8 @@ public function compile(Compiler $compiler): void
6763 ->raw (']->extensionPreCreateForRender( ' )
6864 ->string ($ this ->getAttribute ('component ' ))
6965 ->raw (', ' )
70- ->raw ('$toArray( ' )
66+ ->raw ($ twig_to_array )
67+ ->raw ('( ' )
7168 ;
7269 $ this ->writeProps ($ compiler )
7370 ->raw (') ' )
@@ -98,7 +95,9 @@ public function compile(Compiler $compiler): void
9895 ->string (ComponentExtension::class)
9996 ->raw (']->startEmbeddedComponentRender( ' )
10097 ->string ($ this ->getAttribute ('component ' ))
101- ->raw (', $toArray( ' )
98+ ->raw (', ' )
99+ ->raw ($ twig_to_array )
100+ ->raw ('( ' )
102101 ;
103102 $ this ->writeProps ($ compiler )
104103 ->raw ('), ' )
You can’t perform that action at this time.
0 commit comments