summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/inheritance005.phpt
blob: 31e0e11dd8c9357e3b05a2b9b0517efc46a7dcf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--TEST--
Internal covariant return type of self

--FILE--
<?php
class Foo {
    public static function test() : self {
        return new Foo;
    }
}

class Bar extends Foo {
    public static function test() : self {
        return new Bar;
    }
}

--EXPECTF--
Fatal error: Declaration of Bar::test(): Bar must be compatible with Foo::test(): Foo in %sinheritance005.php on line 12