blob: d2a3bcb368cfdab8696609795f5c66c9e2c7ad07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
--TEST--
iterable type#003 - Return types
--FILE--
<?php
function foo(): iterable {
return [];
}
function bar(): iterable {
return (function () { yield; })();
}
function baz(): iterable {
return 1;
}
var_dump(foo());
var_dump(bar());
try {
baz();
} catch (Throwable $e) {
echo $e->getMessage();
}
?>
--EXPECT--
array(0) {
}
object(Generator)#2 (0) {
}
baz(): Return value must be of type iterable, int returned
|