Open
Description
Description
The following code:
<?php
declare(strict_types=1);
function f(...$args){
echo "see? arguments are optional.\n";
}
f();
$ref = new ReflectionFunction('f');
var_dump($ref->getParameters()[0]->getDefaultValue());
Resulted in this output:
see? arguments are optional.
Fatal error: Uncaught ReflectionException: Internal error: Failed to retrieve the default value in /in/gHhJ2:8
Stack trace:
#0 /in/gHhJ2(8): ReflectionParameter->getDefaultValue()
#1 {main}
thrown in /in/gHhJ2 on line 8
But I expected this output instead:
see? arguments are optional.
array(0) {
}
3v4l: https://3v4l.org/gHhJ2
PHP Version
8.2.11
Operating System
windows 10