Let us take this example from PHP.net
<?php
if ($a > $b)
{
echo "a is größer als b";
}
else if ($a == $b)
{
echo "a ist gleich groß wie b";
}
else
{
echo "a ist kleiner als b";
}
?>
Pretty basic stuff. STRG or CTRL + ALT + l reformats the code, but in a way that is rather strange:
if ( $a > $b )
{
echo "a is größer als b";
}
else
{
if ( $a == $b )
{
echo "a ist gleich groß wie b";
}
else
{
echo "a ist kleiner als b";
}
}
There is no template or anything that I would know of that could trigger this. Nevertheless, it is a nuisance to have the code changed in such a kind of way.
The question is: how can I prevent PhpStorm from doing this. It appears only in since the latest update of the software (PhpStorm 2016.2.2) not in earlier ones.
The version of PhpStorm is
Go to File > Settings > Editor > Code Style > PHP > Wrapping and Braces tab and check "Special 'else if' treatment"