Skip to content

Commit

Permalink
Micro-micro optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Aug 11, 2024
1 parent 8a8f221 commit e1b0997
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/NodeVisitor/SafeAnalysisNodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ public function leaveNode(Node $node, Environment $env): ?Node
} elseif ($node instanceof FilterExpression) {
// filter expression is safe when the filter is safe
$name = $node->getNode('filter')->getAttribute('value');
$args = $node->getNode('arguments');
if ($filter = $env->getFilter($name)) {
$safe = $filter->getSafe($args);
$safe = $filter->getSafe($node->getNode('arguments'));
if (null === $safe) {
$safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety());
}
Expand All @@ -110,9 +109,8 @@ public function leaveNode(Node $node, Environment $env): ?Node
} elseif ($node instanceof FunctionExpression) {
// function expression is safe when the function is safe
$name = $node->getAttribute('name');
$args = $node->getNode('arguments');
if ($function = $env->getFunction($name)) {
$this->setSafe($node, $function->getSafe($args));
$this->setSafe($node, $function->getSafe($node->getNode('arguments')));
} else {
$this->setSafe($node, []);
}
Expand Down

0 comments on commit e1b0997

Please sign in to comment.