xref: /php-src/Zend/tests/return_types/005.phpt (revision 7aacc705)
1--TEST--
2Return value fails inheritance check in method
3--FILE--
4<?php
5class foo {}
6
7class qux {
8    public function foo() : foo {
9        return $this;
10    }
11}
12
13$qux = new qux();
14$qux->foo();
15?>
16--EXPECTF--
17Fatal error: Uncaught TypeError: qux::foo(): Return value must be of type foo, qux returned in %s:%d
18Stack trace:
19#0 %s(%d): qux->foo()
20#1 {main}
21  thrown in %s on line %d
22