Inspection of single equal vs double equal in conditional
Looking for a way to set PhpStorm the show an error in this case.
if( $a = $b ) {
doSomething();
}
I would like be alerted somehow that I am assigning when I whould be comparing with if( $a == $b ).
请先登录再写评论。
Hi there,
Settings (Preferences on Mac) | Editor | Inspections | PHP | Probable bugs | Assignment in conditions
Perfect!
Thank you so much.
It seems that the inspection does not work when you have another condition present:
if ($a >1 || $b = 2) { ... }
will not be detected...
https://youtrack.jetbrains.com/issue/WI-21816 I guess...
(and/or https://youtrack.jetbrains.com/issue/WI-5736)
Thanks for the link. Couldn't find anything searching...