File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,17 @@ public function render(): string
5050 */
5151 public static function addExtension (\Twig \Extension \ExtensionInterface $ extension ): void
5252 {
53- self ::twig ()->addExtension ($ extension );
53+ $ twig = self ::twig ();
54+
55+ if ($ extension instanceof \Twig \Extension \AttributeExtension) {
56+ $ extension_class = $ extension ->getClass ();
57+ } else {
58+ $ extension_class = $ extension ::class;
59+ }
60+
61+ if (!$ twig ->hasExtension ($ extension_class )) {
62+ self ::twig ()->addExtension ($ extension );
63+ }
5464 }
5565
5666 /**
Original file line number Diff line number Diff line change @@ -51,10 +51,6 @@ trait ApplicationHelper
5151 #[\PHPUnit \Framework \Attributes \BeforeClass]
5252 public static function loadApplication (): void
5353 {
54- // This avoids to register extensions multiple times (normally done in
55- // the Application class constructor) as it would fail.
56- \Minz \Template \Twig::reset ();
57-
5854 $ app_name = \Minz \Configuration::$ app_name ;
5955 $ application_class_name = "\\{$ app_name }\\Application " ;
6056 try {
You can’t perform that action at this time.
0 commit comments