Variadic placeholder must be last
Description
The … placeholder used for partial function application (PHP 8.5) introduces the parameters of the resulting Closure, made of every parameter of the original function that was not already given a fixed value. Because everything before it is treated as a fixed, bound argument, the placeholder itself must come last in the call; PHP has no way to bind arguments positioned after it.
Example
<?php
function add($a, $b, $c) {
return $a + $b + $c;
}
$curried = add(..., 2, 3);
?>
Alternatives
- Put every fixed argument before …, and keep … as the final argument: add(1, 2, …).
Related error messages
Changed Behavior
This error may appear following an evolution in behavior, in previous versions. See