xref: /PHP-7.2/Zend/tests/return_types/008.phpt (revision f1d7e3ca)
1--TEST--
2Return type covariance in interface implementation
3--FILE--
4<?php
5interface foo {
6    public function bar() : foo;
7}
8
9
10class qux implements foo {
11    public function bar() : qux {
12        return $this;
13    }
14}
15
16$qux = new qux();
17var_dump($qux->bar());
18--EXPECTF--
19Fatal error: Declaration of qux::bar(): qux must be compatible with foo::bar(): foo in %s008.php on line 7
20