From 67d1162e8f32e8c63c762b3141066b1a568d3e7a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 4 May 2024 16:14:59 +0200 Subject: [PATCH] Remove unneeded code --- src/Environment.php | 2 +- src/Extension/EscaperExtension.php | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Environment.php b/src/Environment.php index da0438df39f..183b8c493e2 100644 --- a/src/Environment.php +++ b/src/Environment.php @@ -138,7 +138,7 @@ public function __construct(LoaderInterface $loader, $options = []) ]); $this->addExtension(new CoreExtension()); - $this->addExtension(new EscaperExtension($this->getRuntime(EscaperRuntime::class), $options['autoescape'])); + $this->addExtension(new EscaperExtension($options['autoescape'])); $this->addExtension(new OptimizerExtension($options['optimizations'])); } diff --git a/src/Extension/EscaperExtension.php b/src/Extension/EscaperExtension.php index 3cb847beb64..6204fe77889 100644 --- a/src/Extension/EscaperExtension.php +++ b/src/Extension/EscaperExtension.php @@ -11,7 +11,6 @@ namespace Twig\Extension; -use Twig\Environment; use Twig\FileExtensionEscapingStrategy; use Twig\Node\Expression\ConstantExpression; use Twig\Node\Node; @@ -22,18 +21,10 @@ final class EscaperExtension extends AbstractExtension { - private $escaper; - private $defaultStrategy; - - /** - * @param string|false|callable $defaultStrategy An escaping strategy - * - * @see setDefaultStrategy() - */ - public function __construct(EscaperRuntime $escaper, $defaultStrategy = 'html') - { + public function __construct( + private $defaultStrategy = 'html' + ) { $this->setDefaultStrategy($defaultStrategy); - $this->escaper = $escaper; } public function getTokenParsers(): array