mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-15 18:24:56 +02:00
Update Twig to v2.15.4
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace Twig\NodeVisitor;
|
||||
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\EscaperExtension;
|
||||
use Twig\Node\AutoEscapeNode;
|
||||
use Twig\Node\BlockNode;
|
||||
use Twig\Node\BlockReferenceNode;
|
||||
@@ -27,18 +28,16 @@ use Twig\Node\PrintNode;
|
||||
use Twig\NodeTraverser;
|
||||
|
||||
/**
|
||||
* @final
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class EscaperNodeVisitor extends AbstractNodeVisitor
|
||||
final class EscaperNodeVisitor extends AbstractNodeVisitor
|
||||
{
|
||||
protected $statusStack = [];
|
||||
protected $blocks = [];
|
||||
protected $safeAnalysis;
|
||||
protected $traverser;
|
||||
protected $defaultStrategy = false;
|
||||
protected $safeVars = [];
|
||||
private $statusStack = [];
|
||||
private $blocks = [];
|
||||
private $safeAnalysis;
|
||||
private $traverser;
|
||||
private $defaultStrategy = false;
|
||||
private $safeVars = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -48,7 +47,7 @@ class EscaperNodeVisitor extends AbstractNodeVisitor
|
||||
protected function doEnterNode(Node $node, Environment $env)
|
||||
{
|
||||
if ($node instanceof ModuleNode) {
|
||||
if ($env->hasExtension('\Twig\Extension\EscaperExtension') && $defaultStrategy = $env->getExtension('\Twig\Extension\EscaperExtension')->getDefaultStrategy($node->getTemplateName())) {
|
||||
if ($env->hasExtension(EscaperExtension::class) && $defaultStrategy = $env->getExtension(EscaperExtension::class)->getDefaultStrategy($node->getTemplateName())) {
|
||||
$this->defaultStrategy = $defaultStrategy;
|
||||
}
|
||||
$this->safeVars = [];
|
||||
@@ -128,7 +127,7 @@ class EscaperNodeVisitor extends AbstractNodeVisitor
|
||||
return new InlinePrint($this->getEscaperFilter($type, $expression), $node->getTemplateLine());
|
||||
}
|
||||
|
||||
protected function escapePrintNode(PrintNode $node, Environment $env, $type)
|
||||
private function escapePrintNode(PrintNode $node, Environment $env, $type)
|
||||
{
|
||||
if (false === $type) {
|
||||
return $node;
|
||||
@@ -145,7 +144,7 @@ class EscaperNodeVisitor extends AbstractNodeVisitor
|
||||
return new $class($this->getEscaperFilter($type, $expression), $node->getTemplateLine());
|
||||
}
|
||||
|
||||
protected function preEscapeFilterNode(FilterExpression $filter, Environment $env)
|
||||
private function preEscapeFilterNode(FilterExpression $filter, Environment $env)
|
||||
{
|
||||
$name = $filter->getNode('filter')->getAttribute('value');
|
||||
|
||||
@@ -164,7 +163,7 @@ class EscaperNodeVisitor extends AbstractNodeVisitor
|
||||
return $filter;
|
||||
}
|
||||
|
||||
protected function isSafeFor($type, \Twig_NodeInterface $expression, $env)
|
||||
private function isSafeFor($type, Node $expression, $env)
|
||||
{
|
||||
$safe = $this->safeAnalysis->getSafe($expression);
|
||||
|
||||
@@ -182,7 +181,7 @@ class EscaperNodeVisitor extends AbstractNodeVisitor
|
||||
return \in_array($type, $safe) || \in_array('all', $safe);
|
||||
}
|
||||
|
||||
protected function needEscaping(Environment $env)
|
||||
private function needEscaping(Environment $env)
|
||||
{
|
||||
if (\count($this->statusStack)) {
|
||||
return $this->statusStack[\count($this->statusStack) - 1];
|
||||
@@ -191,7 +190,7 @@ class EscaperNodeVisitor extends AbstractNodeVisitor
|
||||
return $this->defaultStrategy ? $this->defaultStrategy : false;
|
||||
}
|
||||
|
||||
protected function getEscaperFilter($type, \Twig_NodeInterface $node)
|
||||
private function getEscaperFilter(string $type, Node $node): FilterExpression
|
||||
{
|
||||
$line = $node->getTemplateLine();
|
||||
$name = new ConstantExpression('escape', $line);
|
||||
|
Reference in New Issue
Block a user