PhpStorm gives you the power to convert an
if block to a
and vise versa.
Simply place the cursor on the
if block and press Alt+Enter to
invoke the intention actions menu, then select Replace ‘if’ with ‘switch’
from the list. You can even apply the action to a
switch statement to convert
it to an
Note that the intention action is only available if every statement in the
block is using an equality condition.