PHP开始标记和命名空间之间的空格

Should there be a space between <?php and namespace inside a php class file?

I am looking for this information in PSR guidelines. There are indication about a space after. But before?

PSR-2-coding-style-guid

PSR-2 Its purpose is to have a single style guide for PHP code that results in uniformly formatted shared code.

  • Code MUST use 4 spaces for indenting, not tabs.
  • There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less.
  • There MUST be one blank line after the namespace declaration, and there MUST be one blank line after the block of usedeclarations
  • Opening braces for classes MUST go on the next line, and closing braces MUST go on the next line after the body.
  • Opening braces for methods MUST go on the next line, and closing braces MUST go on the next line after the body.
  • Visibility MUST be declared on all properties and methods; abstract and final MUST be declared before the visibility; static MUST be declared after the visibility
  • Control structure keywords MUST have one space after them; method and function calls MUST NOT.
  • Opening braces for control structures MUST go on the same line, and closing braces MUST go on the next line after the body.
  • Opening parentheses for control structures MUST NOT have a space after them, and closing parentheses for control structures MUST NOT have a space before.

Basic Coding Standard [PSR-2]

*Files

  • All PHP files MUST use the Unix LF (linefeed) line ending.

  • All PHP files MUST end with a single blank line.

  • The closing ?> tag MUST be omitted from files containing only PHP.

Lines

  • There MUST NOT be a hard limit on line length.

  • The soft limit on line length MUST be 120 characters; automated style checkers MUST warn but MUST NOT error at the soft limit.

  • Lines SHOULD NOT be longer than 80 characters; lines longer than that SHOULD be split into multiple subsequent lines of no more than 80 characters each.

  • There MUST NOT be trailing whitespace at the end of non-blank lines.

  • Blank lines MAY be added to improve readability and to indicate related blocks of code.

  • There MUST NOT be more than one statement per line.

Indenting

  • Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting.

Keywords and True/False/Null

  • PHP keywords MUST be in lower case. ( e.g. echo , die, for, throw, catch )
  • The PHP constants true, false, and null MUST be in lower case

NameSpace and Use Declaration

  • When present, there MUST be one blank line after the namespace declaration.
  • When present, all use declarations MUST go after the namespace declaration.
  • There MUST be one use keyword per declaration.
  • There MUST be one blank line after the use block.