On Tuesday, 24 January 2017 03:25:36 UTC, Ahmad Samiei wrote: > > ... > > Re: Ex. Why a blank line at the end of PHP documents? > Definition of a line in POSIX standard > <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206> > : > 3.206 Line: A sequence of zero or more non- <newline> characters plus a > terminating <newline> character > > Otherwise, some programs might have problems processing the last line then. > Many editors and tools (ex. git) show a warning message if there is no > newline at the end of file. > > Based on this definition, a blank line has zero non-<newline> characters before its terminating <newline>. So that means a PHP file must end with TWO sequential <newline> characters in order to end the file with a blank line.
However - that was never the intention of that PSR statement. There is NO need to put a blank line on the end of each PHP script, in fact you MUST NOT have a blank line. You just need to make sure the file consists of *lines* according to the POSIX standard, and that the last line is NOT blank. It's misleading, and hopefully the replacement for this recommendation will make it clearer. The confusion came from what people *think* they are looking at when viewing a script in their favourite editor, rather than how the file is really constructed. -- Jason -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/3525aeb7-3050-4e91-8d41-581350ae8922%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
