Search code examples
phpsymfonyintellij-ideaphpstorm

PhpStorm code formatter and indentation


I'm using PhpStorm with Symfony 3 to write my project.

But I've an issue. When I reformat the code,

This code :

enter image description here

Turns into this code :

enter image description here

And I don't know what is the setting I have to change to fix that :/ Any idea?


Solution

  • I found the solution for this at https://www.jetbrains.com/help/phpstorm/reformat-and-rearrange-code.html

    First enable formatter markers in Settings->Editor->Tab:Formatter Control

    After that, you can switch on/off the formatter on every statement/docblock via

    // @formatter:off
    

    or

    /**
     * @formatter:off
     */
    

    be sure, that you enable the formatter with // @formatter:on if you want to format the code below your chained method call.