mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-05 06:56:51 +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)
|
function twig_ensure_traversable($seq)
|
||||||
{
|
{
|
||||||
if ($seq instanceof \Traversable || \is_array($seq)) {
|
if (is_iterable($seq)) {
|
||||||
return $seq;
|
return $seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1295,7 +1295,7 @@ function twig_test_empty($value)
|
|||||||
*/
|
*/
|
||||||
function twig_test_iterable($value)
|
function twig_test_iterable($value)
|
||||||
{
|
{
|
||||||
return $value instanceof \Traversable || \is_array($value);
|
return is_iterable($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user