Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review sniff handling of PHP 7.4 null coalesce equal operator #2044

Closed
dingo-d opened this issue Apr 22, 2022 · 1 comment
Closed

Review sniff handling of PHP 7.4 null coalesce equal operator #2044

dingo-d opened this issue Apr 22, 2022 · 1 comment

Comments

@dingo-d
Copy link
Member

dingo-d commented Apr 22, 2022

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:

Related to #764

@dingo-d dingo-d added this to the 3.0.0 milestone Apr 22, 2022
@jrfnl
Copy link
Member

jrfnl commented Aug 18, 2023

All sniffs have been reviewed and fixed to support modern PHP in as far as my imagination reached.

If any more situations would be discovered which need to be taken into account, a new issue should be opened with code samples etc.

Closing this now as fixed.

@jrfnl jrfnl closed this as completed Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants