WordPress-Coding-Standards
WordPress-Coding-Standards copied to clipboard
Review sniff handling of PHP 7.4 null coalesce equal operator
Since PHP 7.4 null coalesce equal operator was introduced (??=
).
Now instead of using null coalesce operator when assigning to a variable like:
$_GET['variable'] = $_GET['variable'] ?? 'default';
You can write
$_GET['variable'] ??= ''default';
We need to see what sniffs cover usage of this operator upstream and in the utils and if we can just use them in the WPCS ruleset.
Refs:
- PHP RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator
Related to #764