Open
Description
The when()
method accepts a value it will use as condition. It would be great to be able to access this value in the callback as argument as it's more common to do something like $mail->when($user->email, fn($mail, $email) => $mail->to($email))
then using empty()
function or call the value retriever again in the callback.
Because we already pass the instance when()
is called on as first argument and this change shouldn't be breaking we should pass the value as second argument to the callback. As PHP ignores additional arguments this change isn't breaking.
This should only be applied to the callback way and not the higher-order-proxy as we have no idea to which argument we should pass the value and this could also be breaking.