1--TEST--
2Reflecting object return type
3--FILE--
4<?php
5
6interface One {
7    public function a() : object;
8}
9
10class Two implements One {
11    public function a() : object {}
12}
13
14function a() : object {}
15
16$returnTypeOne = (new ReflectionClass(One::class))->getMethod('a')->getReturnType();
17var_dump($returnTypeOne->isBuiltin(), $returnTypeOne->getName());
18
19$returnTypeTwo = (new ReflectionClass(Two::class))->getMethod('a')->getReturnType();
20var_dump($returnTypeTwo->isBuiltin(), $returnTypeTwo->getName());
21
22$returnTypea = (new ReflectionFunction('a'))->getReturnType();
23var_dump($returnTypea->isBuiltin(), $returnTypea->getName());
24--EXPECT--
25bool(true)
26string(6) "object"
27bool(true)
28string(6) "object"
29bool(true)
30string(6) "object"
31