summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/005.phpt
blob: f8d666fae5aa6dacc1f18e39625fc1e342161f61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--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: Return value of qux::foo() must be an instance of foo, instance of qux returned in %s:%d
Stack trace:
#0 %s(%d): qux->foo()
#1 {main}
  thrown in %s on line %d