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?
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.
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. :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With