Simplify if-else conditions to null coalesce / ternary #7392
HenkPoley
started this conversation in
Feature ideas
Replies: 1 comment
-
Nice idea, we might even try a
if we would run that one before TernaryToNullCoalescingFixer than your case would be fixed as well :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
New rule proposal: transforming simple if/else-based assignments into null coalesce operator.
Code example:
Expected output:
Side note: It might also be clearer for single-line if-not-else statements to simply flip both arms and remove the not.
Beta Was this translation helpful? Give feedback.
All reactions