Is there an intelligent way to do list assignment, when some arguments are not present? I.e.:
[$a, $b] = [1, 2];
// $a=1, $b=2 - good
But how to assign conveniently when some arguments are missing:
[$a, $b] = [1];
// Warning: Undefined array key 1
[$a, $b ?? null] = [1];
// Fatal error: Assignments can only happen to writable values
[$a, $b ?: null] = [1];
// Fatal error: Assignments can only happen to writable values
This works, but error suppressing is bad, also $b default is lost.
$b = 'default';
@[$a, $b] = [1];