hhvm
hhvm copied to clipboard
ReflectionFunctionAbstract->getParamInfo appending class name in default expressions to current namespace
HHVM Version
3.22.1
Standalone code, or other way to reproduce the problem
<?hh
namespace Test {
function dumpFoo(\Foo $foo = new \Foo()): void {
var_dump($foo);
}
}
namespace {
class Foo {}
$rf = new ReflectionFunction('Test\dumpFoo');
var_dump($rf->getParameters());
}
Expected result
array(1) {
[0]=>
object(ReflectionParameter)#3 (3) {
["info"]=>
array(11) {
["index"]=>
int(0)
["name"]=>
string(3) "foo"
["type"]=>
string(3) "Foo"
["type_hint"]=>
string(3) "Foo"
["type_hint_builtin"]=>
bool(false)
["function"]=>
string(7) "Test\dumpFoo"
["type_hint_nullable"]=>
bool(false)
["default"]=>
object(Test\Foo)#2 (0) {
}
["defaultText"]=>
string(9) "new \Foo()"
["attributes"]=>
array(0) {
}
["is_optional"]=>
bool(true)
}
["name"]=>
string(3) "foo"
["paramTypeInfo"]=>
array(3) {
["name"]=>
string(3) "Foo"
["nullable"]=>
bool(false)
["builtin"]=>
bool(false)
}
}
}
Actual result
Fatal error: Uncaught Error: Class undefined: Test\Foo in :1
Stack trace:
#0 (): include()
#1 (): ReflectionFunctionAbstract->getParamInfo()
#2 /in/HCRR3(-1): ReflectionFunctionAbstract->getParameters()
#3 {main}