blob: b53d24d4827ac0381f2b5eb5a6e03410cdf2ff29 (
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
33
34
35
36
37
38
39
40
|
--TEST--
Incorrect elision of return type checks
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function test1($x) : callable {
if ($x == 1) {
$c = 'foo';
} elseif ($x == 2) {
$c = new stdClass;
} else {
$c = [$x => &$x];
}
return $c;
}
try {
test1(1);
} catch (Error $e) {
echo "Error: {$e->getMessage()}\n";
}
class Foo {}
function test2() : Foo {
$obj = new stdClass;
return $obj;
}
try {
test2();
} catch (Error $e) {
echo "Error: {$e->getMessage()}\n";
}
?>
--EXPECT--
Error: Return value of test1() must be of type callable, string returned
Error: Return value of test2() must be of type Foo, stdClass returned
|