summaryrefslogtreecommitdiff
path: root/Zend/tests/object_types/return_type_in_class.phpt
blob: 2d0f771106188511291244c45002d624e0fe6c2b (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
--TEST--
Adding a class method object return type
--FILE--
<?php

interface One {
    public function a() : object;
}

class Two implements One {
    public function a() : object {}
}

$three = new class extends Two {
    public function a() : object {
        return 12345;
    }
};
$three->a();
--EXPECTF--

Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, integer returned in %s:13
Stack trace:
#0 %s(16): class@anonymous->a()
#1 {main}
  thrown in %s on line 13