Hi
Am 2025-06-28 07:06, schrieb Larry Garfield:
Hi folks. Arnaud and I would like to present take-2 at Partial
Function Application.
https://wiki.php.net/rfc/partial_function_application_v2
I've now had a *quick* look at the implementation and the following
questions came up that the RFC does not answer (and the tests in the PR
do not obviously answer either):
How will PFA calls appear in a stack trace and how will PFA Closures
look like to `var_dump()`, Reflection, and to observers?
Classic FCC are 100% identical to the underlying function and thus can
just “pretend” they are the underlying function, but that doesn't work
for PFA. Consider the following:
function foo(string $s, int $i) {
var_dump($s, $i);
}
$f = foo("abc", ?);
$f([]);
How will the error message for the resulting TypeError look like?
var_dump($f); // same $f
How will the output look like?
var_dump((new ReflectionFunction($f))->getName());
var_dump((new ReflectionFunction($f))->getParameters());
Ditto
is_callable($f, callable_name: $name);
var_dump($name);
Ditto
function foo(string $s, #[\SensitiveParameter] int $i) {
throw new \Exception();
}
$f = foo("abc", ?);
$f(123);
How will the stack trace look like? Does `#[\SensitiveParameter]` work
properly?
Best regards
Tim Düsterhus