xref: /PHP-7.4/ext/reflection/tests/bug69802.phpt (revision 9fcfe52d)
1--TEST--
2Bug #69802 (Reflection on Closure::__invoke borks type hint class name)
3--FILE--
4<?php
5$f = function(stdClass $x): stdClass {};
6$r = new ReflectionMethod($f, '__invoke');
7var_dump($r->getParameters()[0]->getName());
8var_dump($r->getParameters()[0]->getClass());
9echo $r->getParameters()[0], "\n";
10echo $r->getReturnType()->getName(), "\n";
11echo $r,"\n";
12?>
13--EXPECT--
14string(1) "x"
15object(ReflectionClass)#4 (1) {
16  ["name"]=>
17  string(8) "stdClass"
18}
19Parameter #0 [ <required> stdClass $x ]
20stdClass
21Method [ <internal> public method __invoke ] {
22
23  - Parameters [1] {
24    Parameter #0 [ <required> stdClass $x ]
25  }
26  - Return [ stdClass ]
27}
28