From: Fabien Potencier Date: Fri, 27 Dec 2013 14:21:16 +0000 (+0100) Subject: Revert "merged branch javer/hhvm-array-traversable (PR #1192)" X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=cb43b1234d081ed82b803fae0e0cca6c91727b88;p=web%2Fkonrad%2Ftwig.git Revert "merged branch javer/hhvm-array-traversable (PR #1192)" This reverts commit 0d97eb95288c6f08d5c46e9aa5706f2341a34e29, reversing changes made to 4fcaf0c5fc91435cf625c20c0ecbd29c4f8b25a1. This change is not needed anymore as HHVM has been fixed as of 2.3.0. --- diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 4e80c67..14f73d2 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -393,7 +393,7 @@ function twig_random(Twig_Environment $env, $values = null) return $values < 0 ? mt_rand($values, 0) : mt_rand(0, $values); } - if (is_object($values) && $values instanceof Traversable) { + if ($values instanceof Traversable) { $values = iterator_to_array($values); } elseif (is_string($values)) { if ('' === $values) { @@ -689,7 +689,7 @@ function twig_array_merge($arr1, $arr2) */ function twig_slice(Twig_Environment $env, $item, $start, $length = null, $preserveKeys = false) { - if (is_object($item) && $item instanceof Traversable) { + if ($item instanceof Traversable) { $item = iterator_to_array($item, false); } @@ -756,7 +756,7 @@ function twig_last(Twig_Environment $env, $item) */ function twig_join_filter($value, $glue = '') { - if (is_object($value) && $value instanceof Traversable) { + if ($value instanceof Traversable) { $value = iterator_to_array($value, false); } @@ -898,7 +898,7 @@ function twig_in_filter($value, $compare) } return false !== strpos($compare, (string) $value); - } elseif (is_object($compare) && $compare instanceof Traversable) { + } elseif ($compare instanceof Traversable) { return in_array($value, iterator_to_array($compare, false), is_object($value)); } @@ -1436,7 +1436,7 @@ function twig_constant($constant, $object = null) */ function twig_array_batch($items, $size, $fill = null) { - if (is_object($items) && $items instanceof Traversable) { + if ($items instanceof Traversable) { $items = iterator_to_array($items, false); }