Use is_iterable when possible

This commit is contained in:
Jérôme Tamarelle
2023-10-08 18:21:11 +02:00
committed by Fabien Potencier
parent 78e52452ea
commit cb8a824784
+2 -2
View File
@@ -1229,7 +1229,7 @@ function twig_call_macro(Template $template, string $method, array $args, int $l
*/
function twig_ensure_traversable($seq)
{
if ($seq instanceof \Traversable || \is_array($seq)) {
if (is_iterable($seq)) {
return $seq;
}
@@ -1295,7 +1295,7 @@ function twig_test_empty($value)
*/
function twig_test_iterable($value)
{
return $value instanceof \Traversable || \is_array($value);
return is_iterable($value);
}
/**