summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/008.phpt
blob: 47343d05640ffd18abd61f7e8eceffe250848bbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
Return type covariance in interface implementation

--FILE--
<?php
interface foo {
    public function bar() : foo;
}


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

$qux = new qux();
var_dump($qux->bar());

--EXPECTF--
Fatal error: Declaration of qux::bar(): qux must be compatible with foo::bar(): foo in %s008.php on line 7