In my PhpStorm 8.0.3 code style, I have set it to add a new line after a function declaration, which works fine.
Problem is now I'm in a new project that follows the PSR-2 Standards, which say that the opening brace of a function MUST be placed in the same line that the closing parenthesis of the function arguments when these split across multiple lines, as you can see here.
I want this when arguments split across multiple lines...
public function myMethod(
MyClass $arg1,
$arg2 = null
) {
// method body
}
...and this when they are all in the same line...
public function myMethod(MyClass $arg1, $arg2 = null)
{
// method body
}
I was trying to search for that option but I couldn't find it - I know I can decide whether I want to add the new line for all functions, but I need it only in these particular occasions.
In the File -> Settings
dialogue, under Editor -> Code Style -> PHP
select Wrapping and Braces
tab on the right hand side.
Find the Function declaration parameters
block and check the main control, here you have a bunch of options regarding wrapping parameters and few other options in this block to control braces placement. Also look at the Braces placement
block above.