summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/005.phpt
blob: 9d490df7d93cb65b31fe7c0507190904d7de6b37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
Return value fails inheritance check in method
--FILE--
<?php
class foo {}

class qux {
    public function foo() : foo {
        return $this;
    }
}

$qux = new qux();
$qux->foo();
?>
--EXPECTF--
Fatal error: Uncaught TypeError: qux::foo(): Return value must be of type foo, qux returned in %s:%d
Stack trace:
#0 %s(%d): qux->foo()
#1 {main}
  thrown in %s on line %d