PHPStorm Reformatting Issue
When I try to auto-indent lines and remove extra empty lines by pressing Ctrl+Shift+L and assuming code is below:
if ($compress)
{
return $this->compress();
}
else
{
return $this->html;
}
PHPStorm turns it into:
if ($compress) {
return $this->compress();
} else {
return $this->html;
}
Is there a way so PHPStorm doesn't put starting curly braces on same lines eg it should be same as first method above without pulling starting curly brace on same line?
It would be great if one could specify reformatting style from settings with style options such as (similar to phpformatter.com):
K/R Style
Allman Style
Whitesmiths Style
GNU Style
Pear Style
Thanks
Please sign in to leave a comment.
The formatting rules used to reformat code are in Settings > Code Style > PHP (in v6 EAP at least, should be a similar location in version 5)
There are a few built in styles (There is a "Set from..." link in the upper left corner) that you can use as the basis for your style rules. Zend, Symphony, etc. From there you can customize all the settings as needed.
Thanks for the useful information :)