From 6810dbe8a7be204813a4397b1bddcfdb875fe2e2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 1 Dec 2012 19:41:29 +0100 Subject: [PATCH] removed uneeded condition (a filter node cannot be created if the filer does not exist) --- lib/Twig/NodeVisitor/Escaper.php | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/Twig/NodeVisitor/Escaper.php b/lib/Twig/NodeVisitor/Escaper.php index cc9a58b..0d749fe 100644 --- a/lib/Twig/NodeVisitor/Escaper.php +++ b/lib/Twig/NodeVisitor/Escaper.php @@ -107,22 +107,18 @@ class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface { $name = $filter->getNode('filter')->getAttribute('value'); - if (false !== $f = $env->getFilter($name)) { - $type = $f->getPreEscape(); - if (null === $type) { - return $filter; - } - - $node = $filter->getNode('node'); - if ($this->isSafeFor($type, $node, $env)) { - return $filter; - } - - $filter->setNode('node', $this->getEscaperFilter($type, $node)); + $type = $env->getFilter($name)->getPreEscape(); + if (null === $type) { + return $filter; + } + $node = $filter->getNode('node'); + if ($this->isSafeFor($type, $node, $env)) { return $filter; } + $filter->setNode('node', $this->getEscaperFilter($type, $node)); + return $filter; } -- 1.7.2.5