summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/005.phpt
blob: edf54db07cb9f56bceedbbdc13aace799c38d186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--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 TypeException: 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