In php, boolean operators like &&
and ||
always return a boolean!
Code where the incorrect rule triggers:
return $condition ? true : $exp;
That code is not equivalent to
return $condition || $exp;
This happens in Sonarlint v4.0.2.3009 Intellij Idea plugin.
For you to play around and test: https://3v4l.org/STjfO
PS: This is related to Incorrect warning squid:S1125