Jesse Schoff
Jesse Schoff

Reputation: 770

Indent after opening php tag

I just started using PhpStorm, and it doesn't want me to indent the first line after the opening <?php tag. I prefer to, so I do it manually each time. This may seem rather trivial, but after searching I cannot find any definitive reasons to do it one way or the other. Is there a best practice for indenting after opening a script tag?

Upvotes: 9

Views: 3941

Answers (2)

Alexander M. Turek
Alexander M. Turek

Reputation: 576

Open PhpStorm's settings. Under Project Settings -> Code Style -> PHP you should find a tab Other where you can set the desired behavior by clicking the checkbox Indent code in PHP tags.

But as the other answer suggests, this is probably not a good idea, as it is against any common coding standard I know of. :-)

Upvotes: 10

WhoaItsAFactorial
WhoaItsAFactorial

Reputation: 3558

While not directly defined, PSR-0, PSR-1, PSR-2, and PSR-3 do not indent after the PHP tags. Since the PSR's are the defacto standard of PHP coding styles I would recommend sticking to the PSR Standards and trying to break your habit of the initial indent, if for no other reason to reduce the length of lines and thus line wraps and line breaks.

Upvotes: 10

Related Questions