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