From b37cdd5146ccfa3185b4f89a0f69e085d3da7cde Mon Sep 17 00:00:00 2001 From: Giorgio Pogliani Date: Sat, 9 Apr 2022 14:10:39 +0200 Subject: [PATCH] Fix custom tags configuration effect --- src/Configuration.php | 4 +++- tests/ComponentTest.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Configuration.php b/src/Configuration.php index 261afde..87d9ec7 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -131,7 +131,9 @@ public function setup() { $this->twig->addExtension(new ComponentExtension($this)); - $this->twig->setLexer(new ComponentLexer($this->twig)); + if ($this->isUsingCustomTags()) { + $this->twig->setLexer(new ComponentLexer($this->twig)); + } /** @var \Twig\Extension\EscaperExtension */ $escaper = $this->twig->getExtension(\Twig\Extension\EscaperExtension::class); diff --git a/tests/ComponentTest.php b/tests/ComponentTest.php index e0baf81..c044022 100644 --- a/tests/ComponentTest.php +++ b/tests/ComponentTest.php @@ -22,7 +22,8 @@ protected function setupTwig(): \Twig\Environment Configuration::make($twig) ->setTemplatesPath('components') ->setTemplatesExtension('twig') - ->useGlobalContext(false) + ->useGlobalContext() + ->useCustomTags() ->setup(); return $twig;