Indent after opening php tag

I just started using PhpStorm and it doesn’t want me to backtrack from the first line after opening the <?php tag. I prefer, so I do it manually every time. This may seem rather trivial, but after searching I can’t find any reason for this anyway. Is there a best practice for indenting after opening a script tag?

+4
source share
2 answers

Not yet defined directly, PSR-0 , PSR-1 , PSR-2 , and PSR-3 do not backtrack after PHP tags. Since PSR is the defacto standard for PHP coding styles, I would recommend adhering to PSR standards and try to break the habit of the original indent if not for any other reason to reduce the length of the lines and thus wrapping the lines and line breaks.

+7
source

Open PhpStorm Settings. In the "Project Settings" → "Code Style" → "PHP" section, you should find the "Other" tab in which you can set the desired behavior by clicking the "Indent" checkbox in PHP tags.

But, as another answer shows, this is probably not a good idea, as it contradicts the usual coding standard that I know of. :-)

+7
source

All Articles