File tree 1 file changed +10
-1
lines changed
src/TwigComponent/src/Twig 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \UX \TwigComponent \Twig ;
13
13
14
14
use Twig \Compiler ;
15
+ use Twig \Extension \CoreExtension ;
15
16
use Twig \Node \EmbedNode ;
16
17
use Twig \Node \Expression \AbstractExpression ;
17
18
@@ -34,13 +35,21 @@ public function compile(Compiler $compiler): void
34
35
{
35
36
$ compiler ->addDebugInfo ($ this );
36
37
38
+ // since twig/twig 3.9.0: Using the internal "twig_to_array" function is deprecated.
39
+ if (method_exists (CoreExtension::class, 'toArray ' )) {
40
+ $ twig_to_array = 'Twig\Extension\CoreExtension::toArray ' ;
41
+ } else {
42
+ $ twig_to_array = 'twig_to_array ' ;
43
+ }
44
+
37
45
$ compiler
38
46
->raw ('$props = $this->extensions[ ' )
39
47
->string (ComponentExtension::class)
40
48
->raw (']->embeddedContext( ' )
41
49
->string ($ this ->getAttribute ('component ' ))
42
50
->raw (', ' )
43
- ->raw ('twig_to_array( ' )
51
+ ->raw ($ twig_to_array )
52
+ ->raw ('( ' )
44
53
->subcompile ($ this ->getNode ('variables ' ))
45
54
->raw ('), ' )
46
55
->raw ($ this ->getAttribute ('only ' ) ? '[] ' : '$context ' )
You can’t perform that action at this time.
0 commit comments