summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/inheritance004.phpt
blob: 66d35564f70ded3a2b20a06ae0a3165ee1e85a9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--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() : parent {
        return new Bar;
    }
}

var_dump(Bar::test());
var_dump(Foo::test());

--EXPECTF--
object(Bar)#%d (0) {
}
object(Foo)#%d (0) {
}