function SandboxNodeVisitor::leaveNode
Overrides NodeVisitorInterface::leaveNode
File
-
vendor/
twig/ twig/ src/ NodeVisitor/ SandboxNodeVisitor.php, line 106
Class
- SandboxNodeVisitor
- @author Fabien Potencier <fabien@symfony.com>
Namespace
Twig\NodeVisitorCode
public function leaveNode(Node $node, Environment $env) : ?Node {
if ($node instanceof ModuleNode) {
$this->inAModule = false;
$node->setNode('constructor_end', new Nodes([
new CheckSecurityCallNode(),
$node->getNode('constructor_end'),
]));
$node->setNode('class_end', new Nodes([
new CheckSecurityNode($this->filters, $this->tags, $this->functions),
$node->getNode('class_end'),
]));
}
elseif ($this->inAModule) {
if ($node instanceof PrintNode || $node instanceof SetNode) {
$this->needsToStringWrap = false;
}
}
return $node;
}