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
45
45
$ compiler ->addDebugInfo ($ this );
46
46
47
47
// since twig/twig 3.9.0: Using the internal "twig_to_array" function is deprecated.
48
- $ compiler
49
- ->write ('$toArray = function ($data) { ' )
50
- ;
51
-
52
48
if (method_exists (CoreExtension::class, 'toArray ' )) {
53
- $ compiler -> write ( ' return Twig\Extension\CoreExtension::toArray($data);}; ' ) ;
49
+ $ twig_to_array = ' Twig\Extension\CoreExtension::toArray ' ;
54
50
} else {
55
- $ compiler -> write ( ' return twig_to_array($data);}; ' ) ;
51
+ $ twig_to_array = ' twig_to_array ' ;
56
52
}
57
53
58
54
/*
@@ -67,7 +63,8 @@ public function compile(Compiler $compiler): void
67
63
->raw (']->extensionPreCreateForRender( ' )
68
64
->string ($ this ->getAttribute ('component ' ))
69
65
->raw (', ' )
70
- ->raw ('$toArray( ' )
66
+ ->raw ($ twig_to_array )
67
+ ->raw ('( ' )
71
68
;
72
69
$ this ->writeProps ($ compiler )
73
70
->raw (') ' )
@@ -98,7 +95,9 @@ public function compile(Compiler $compiler): void
98
95
->string (ComponentExtension::class)
99
96
->raw (']->startEmbeddedComponentRender( ' )
100
97
->string ($ this ->getAttribute ('component ' ))
101
- ->raw (', $toArray( ' )
98
+ ->raw (', ' )
99
+ ->raw ($ twig_to_array )
100
+ ->raw ('( ' )
102
101
;
103
102
$ this ->writeProps ($ compiler )
104
103
->raw ('), ' )
You can’t perform that action at this time.
0 commit comments