File tree 1 file changed +4
-1
lines changed
src/TwigComponent/src/Twig
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 15
15
use Symfony \UX \TwigComponent \ComponentAttributes ;
16
16
use Twig \Environment ;
17
17
use Twig \Extension \EscaperExtension ;
18
+ use Twig \Runtime \EscaperRuntime ;
18
19
19
20
/**
20
21
* @final
@@ -31,7 +32,9 @@ public function configure(Environment $environment): void
31
32
$ this ->decorated ->configure ($ environment );
32
33
$ environment ->setLexer (new ComponentLexer ($ environment ));
33
34
34
- if ($ environment ->hasExtension (EscaperExtension::class)) {
35
+ if (class_exists (EscaperRuntime::class)) {
36
+ $ environment ->getRuntime (EscaperRuntime::class)->addSafeClass (ComponentAttributes::class, ['html ' ]);
37
+ } elseif ($ environment ->hasExtension (EscaperExtension::class)) {
35
38
$ environment ->getExtension (EscaperExtension::class)->addSafeClass (ComponentAttributes::class, ['html ' ]);
36
39
}
37
40
}
You can’t perform that action at this time.
0 commit comments