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