mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 02:16:41 +00:00
Remove redundant "$thing instanceof \Countable" check
The check L1183 is redundant as "$thing instanceof \Countable" is already checked L1175.
```php
if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) {
return \count($thing);
}
if ($thing instanceof \Traversable) {
return iterator_count($thing);
}
if (method_exists($thing, '__toString') && !$thing instanceof \Countable) {
return mb_strlen((string) $thing, $env->getCharset());
}
```
This commit is contained in:
@@ -1180,7 +1180,7 @@ final class CoreExtension extends AbstractExtension
|
||||
return iterator_count($thing);
|
||||
}
|
||||
|
||||
if (method_exists($thing, '__toString') && !$thing instanceof \Countable) {
|
||||
if (method_exists($thing, '__toString')) {
|
||||
return mb_strlen((string) $thing, $env->getCharset());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user