PSR-2
PHP_CodeSniffer PSR-2
Rules
- PHP keywords and True/False/Null MUST be in lower case.
Namespace and Use Declarations
- 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.
class
- The extends and implements keywords MUST be declared on the same line as the class name.
- The opening brace for the class MUST go on its own line; the closing brace for the class MUST go on the next line after the body.
- Lists of implements MAY be split across multiple lines, where each subsequent line is indented once.
property
- Visibility MUST be declared on all properties.
- There MUST NOT be more than one property declared per statement.
- Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility.
Methods
- Visibility declared required
- Method names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility.
- No space after method name
- opening brace on next line
- closing brace on next line
- on space befor opening brace, closing brace
PSR-2
PHP_CodeSniffer PSR-2
Rules
Namespace and Use Declarations
class
property
Methods