summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/inheritance008.phpt
blob: df353cda056d834b642c31b82de6deec1339a446 (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
26
27
--TEST--
External covariant return type of self
--INI--
opcache.enable_cli=1
--FILE--
<?php
require __DIR__ . "/classes.php.inc";

class Foo {
    public static function test() : A {
        return new A;
    }
}

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

var_dump(Bar::test());
var_dump(Foo::test());
--EXPECTF--
object(B)#%d (0) {
}
object(A)#%d (0) {
}