diff --git a/src/Mustache/HelperCollection.php b/src/Mustache/HelperCollection.php index bbeb277..c7c7950 100644 --- a/src/Mustache/HelperCollection.php +++ b/src/Mustache/HelperCollection.php @@ -27,14 +27,16 @@ class Mustache_HelperCollection */ public function __construct($helpers = null) { - if ($helpers !== null) { - if (!is_array($helpers) && !$helpers instanceof Traversable) { - throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers'); - } + if ($helpers === null) { + return; + } - foreach ($helpers as $name => $helper) { - $this->add($name, $helper); - } + if (!is_array($helpers) && !$helpers instanceof Traversable) { + throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers'); + } + + foreach ($helpers as $name => $helper) { + $this->add($name, $helper); } }