Search Terms
Nullish coalescing assignment
Suggestion
A new operator ??= to assign some default to a variable/property if it is nullish.
It's also avaibale in PHP: https://wiki.php.net/rfc/null_coalesce_equal_operator
Examples
obj1.obj2.obj3.x ??= 42;
instead of
obj1.obj2.obj3.x = obj1.obj2.obj3.x ?? 42;
Checklist
My suggestion meets these guidelines:
Search Terms
Nullish coalescing assignment
Suggestion
A new operator
??=to assign some default to a variable/property if it is nullish.It's also avaibale in PHP: https://wiki.php.net/rfc/null_coalesce_equal_operator
Examples
obj1.obj2.obj3.x ??= 42;instead of
obj1.obj2.obj3.x = obj1.obj2.obj3.x ?? 42;Checklist
My suggestion meets these guidelines: