Allman style indent

I have been configuring PhpStorm to work the way I want it and so far it is good, but I do have one problem.  When I create a function or type an if statement and press enter, it indents the following line one extra tab.  I would like to be able to put my braces on the same level as the function or if statement as in Allman style.  I have gone through the settings and the previews all show exactly how I want it.  Am I missing something in the settings that someone can point out to me?

Also I currently have it set to create the second bracket once I type the first, but I would like to know if it is possible for the first to be created automatically when I hit enter after declaring the function/if/else statement.


Message was edited by: Dan Robertson


That's right but this is largely because when you type, for example, "if (true)" and hit [Enter], PhpStorm first thinks you are going to put a single line statement indented relatively to "if". But when you just type "{", it immidiately corrects the indentation so that "{" gets the same indentation as "if". Does it make sense?


Answering the second part of your question: currently there is no way to specify that the first curly brace must be created automatically once you hit [Enter] after "if" statement or function declaration. You have to do this manually. Though I think implementing such a feature is possible and maybe not such a bad idea. Shall we create a feature request for it?


There's a related feature missing from PHP yet - "Complete statement" watch


I didn't even realize it would automatically pull the indent back for the brace.  I would see that it added an indent then I would delete the indent before typing the brace.  That's great.  Thanks!


Please sign in to leave a comment.