mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-04 06:30:57 +00:00
Use is_iterable when possible
This commit is contained in:
committed by
Fabien Potencier
parent
78e52452ea
commit
cb8a824784
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user