summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/errors/count_error.phpt
blob: b88902d841c18b5d8be27b1a79f38438e59ea443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--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