In php, boolean operators like
|| 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 v220.127.116.1109 Intellij Idea plugin.
For you to play around and test: https://3v4l.org/STjfO
PS: This is related to Incorrect warning squid:S1125