removed uneeded condition (a filter node cannot be created if the filer does not...
authorFabien Potencier <fabien.potencier@gmail.com>
Sat, 1 Dec 2012 18:41:29 +0000 (19:41 +0100)
committerFabien Potencier <fabien.potencier@gmail.com>
Sat, 1 Dec 2012 18:41:29 +0000 (19:41 +0100)
lib/Twig/NodeVisitor/Escaper.php

index cc9a58b..0d749fe 100644 (file)
@@ -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;
     }