blob: c8014383ca43cf654dc883f07169f5b7f52b4797 (
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 callable, string returned
Error: Return value of test2() must be an instance of Foo, instance of stdClass returned
|