php-src/Zend/tests/generators/errors/count_error.phpt
George Peter Banyard 2ee7e2982f Promote count() warning to TypeError
Closes GH-6180
2020-09-21 21:29:15 +01:00

18 lines
274 B
PHP

--TEST--
Generators can't be counted
--FILE--
<?php
function gen() { yield; }
$gen = gen();
try {
count($gen);
} catch (\TypeError $e) {
echo $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
count(): Argument #1 ($var) must be of type Countable|array, Generator given