diff --git a/src/Counter.php b/src/Counter.php new file mode 100644 index 0000000..1889c02 --- /dev/null +++ b/src/Counter.php @@ -0,0 +1,27 @@ +|Traversable $data + */ + public static function count(iterable $data): int + { + // php 8.1 compat + if (is_array($data)) { + return count($data); + } + + return iterator_count($data); + } +}