Skip to content

Commit

Permalink
[TwigBridge][WebProfilerBundle] Require Twig 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed May 11, 2024
1 parent 855028e commit 061e239
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions Twig/WebProfilerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Twig\Environment;
use Twig\Extension\EscaperExtension;
use Twig\Extension\ProfilerExtension;
use Twig\Profiler\Profile;
use Twig\Runtime\EscaperRuntime;
Expand Down Expand Up @@ -109,17 +108,6 @@ public function getName(): string

private static function escape(Environment $env, string $s): string
{
// Twig 3.10 and above
if (class_exists(EscaperRuntime::class)) {
return $env->getRuntime(EscaperRuntime::class)->escape($s);
}

// Twig 3.9
if (method_exists(EscaperExtension::class, 'escape')) {
return EscaperExtension::escape($env, $s);
}

// to be removed when support for Twig 3 is dropped
return twig_escape_filter($env, $s);
return $env->getRuntime(EscaperRuntime::class)->escape($s);
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"symfony/http-kernel": "^6.4|^7.0",
"symfony/routing": "^6.4|^7.0",
"symfony/twig-bundle": "^6.4|^7.0",
"twig/twig": "^3.0.4"
"twig/twig": "^3.10"
},
"require-dev": {
"symfony/browser-kit": "^6.4|^7.0",
Expand Down

0 comments on commit 061e239

Please sign in to comment.