xref: /PHP-8.3/ext/reflection/tests/bug69802.phpt (revision 93640db4)
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--EXPECTF--
14string(1) "x"
15
16Deprecated: Method ReflectionParameter::getClass() is deprecated in %s on line %d
17object(ReflectionClass)#4 (1) {
18  ["name"]=>
19  string(8) "stdClass"
20}
21Parameter #0 [ <required> stdClass $x ]
22stdClass
23Method [ <internal> public method __invoke ] {
24
25  - Parameters [1] {
26    Parameter #0 [ <required> stdClass $x ]
27  }
28  - Return [ stdClass ]
29}
30