From 242e94c91b4853812422288e8622d1295788f837 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Wed, 1 Aug 2012 23:29:20 -0700 Subject: [PATCH] Avoid indentomatic with long filter chains. --- src/Mustache/Compiler.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index 1c3bcc4..fe02419 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -315,11 +315,10 @@ class Mustache_Compiler const FILTER = ' $filter = $context->%s(%s); - if (!is_string($filter) && is_callable($filter)) { - $value = call_user_func($filter, $value);%s - } else { + if (is_string($filter) || !is_callable($filter)) { throw new UnexpectedValueException(%s); } + $value = call_user_func($filter, $value);%s '; /** @@ -341,7 +340,7 @@ class Mustache_Compiler $filter = ($method !== 'last') ? var_export($name, true) : ''; $msg = var_export(sprintf('Filter not found: %s', $name), true); - return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $this->getFilter($filters, $level + 1), $msg); + return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $msg, $this->getFilter($filters, $level)); } const LINE = '$buffer .= "\n";';