-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add Null Coalesce Operator #19
Add Null Coalesce Operator #19
Conversation
@carusogabriel I can write the sniff for https://github.com/slevomat/coding-standard, would it be ok? |
@kukulich Perfect. I'm not good at sniffers, so I appreciate your help 😄 |
Fine, I may write it in the evening if my children and wife allow :) |
Ready for test: slevomat/coding-standard@476b0da |
|
||
$bar = isset($bar['baz']) ? $bar['baz'] : 'baz'; | ||
|
||
if (isset($foo)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kukulich This case is already covered? I guess tests are failing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it's not. It's a lot more complicated than simple ternary operator.
composer.json
Outdated
@@ -18,7 +18,7 @@ | |||
"php": "^7.1", | |||
"squizlabs/php_codesniffer": "^3.2", | |||
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.2", | |||
"slevomat/coding-standard": "^4.3.0" | |||
"slevomat/coding-standard": "dev-master" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: we need a stable release and then we can merge/release as well
Manually merged in 2636a26 Thanks @kukulich and @carusogabriel! |
Some to help starts with: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/2.10/src/Fixer/Operator/TernaryToNullCoalescingFixer.php
Something to also be considering:
Already proposed and voted in #9 (comment)