summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/021.phpt
blob: 051f7dce69a691640b972597583352b5db864b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
Return type allows self

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

class Bar extends Foo {}

var_dump(Foo::getInstance());
var_dump(Bar::getInstance());

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