#19 Flip Comparison Operators

To swap the values on either side of a comparison operator with each other, place the cursor on the operator and press Alt+Enter to invoke the intention actions menu then select Flip ‘X’ .

With certain operators changing the order of the arguments can change the semantics of the condition, as such PhpStorm will display the (change semantics) warning in the menu when this is the case. Make sure your conditions still make sense when you see this warning.

comments powered by Disqus