Use is_countable()

This commit is contained in:
Fabien Potencier
2023-12-09 15:12:04 +01:00
parent 89d37cd510
commit 06d9fc6ad0
+1 -1
View File
@@ -1119,7 +1119,7 @@ function twig_length_filter(Environment $env, $thing)
return mb_strlen($thing, $env->getCharset());
}
if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) {
if (is_countable($thing) || $thing instanceof \SimpleXMLElement) {
return \count($thing);
}