-
Notifications
You must be signed in to change notification settings - Fork 118
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
False positives when using the null-safe operator ?->
in an if-condition
#1954
Comments
Thank you for reporting @windaishi! We have multiple reports for this case and will include a fix into next release. |
…operands types are not considered)
We are pushing fix for We are unsure how to proceed with |
@ea-inspections-team: agree with @windaishi, it's a false-positive. From a types-resolving perspective, the code is correct (assignment in if-body will not inject null into the result type). I'm in support of fixing this false positive. |
@kalessil: thank you. Fixing this is not a trivial task and we have to plan the fix for 2024.3 (not 2024.2). |
Current behaviour
The following code is reported with the following two issues:
Line 5: [EA] Null pointer exception may occur here. (on
$shippingMethodConfig
)Line 6: [EA] The if-else workflow is driven by inverted conditions, consider avoiding invertions. (on `else)
Expected behaviour
No errors are reported. Neither is the if driven by an inverted condition (because we are comparing against
bool?
) nor canshippingMethodConfig
be null here.Environment details
The text was updated successfully, but these errors were encountered: