Use RawFilter in cache extra

This commit is contained in:
Fabien Potencier
2024-07-28 11:00:56 +02:00
parent 76becd4246
commit 8e72c84c63
2 changed files with 3 additions and 3 deletions
@@ -14,6 +14,7 @@ namespace Twig\Extra\Cache\TokenParser;
use Twig\Error\SyntaxError;
use Twig\Extra\Cache\Node\CacheNode;
use Twig\Node\Expression\ConstantExpression;
use Twig\Node\Expression\Filter\RawFilter;
use Twig\Node\Expression\FilterExpression;
use Twig\Node\Node;
use Twig\Node\PrintNode;
@@ -58,9 +59,8 @@ class CacheTokenParser extends AbstractTokenParser
$stream->expect(Token::BLOCK_END_TYPE);
$body = new CacheNode($key, $ttl, $tags, $body, $token->getLine(), $this->getTag());
$body = new FilterExpression($body, new ConstantExpression('raw', $token->getLine()), new Node(), $token->getLine());
return new PrintNode($body, $token->getLine(), $this->getTag());
return new PrintNode(new RawFilter($body), $token->getLine(), $this->getTag());
}
public function decideCacheEnd(Token $token): bool
+1 -1
View File
@@ -17,7 +17,7 @@
"require": {
"php": ">=7.2.5",
"symfony/cache": "^5.4|^6.4|^7.0",
"twig/twig": "^3.9"
"twig/twig": "^3.11"
},
"require-dev": {
"symfony/phpunit-bridge": "^6.4|^7.0"