This repository exists just for archival matters, there's no real use since PHP_CodeSniffer already ships with a proper and modern sniffer for PSR's. Also, it was created with all three PSRs in mind, having a window for future modifications (such as filtering between standards).
So, please, contribute to http://pear.php.net/package/PHP_CodeSniffer/
You can read more about the PHP FIG and the PSR's on this excellent article by Paul Jones.
Files MUST use only
Files MUST use only UTF-8 without BOM for PHP code.
Files SHOULD either declare symbols (classes, functions, constants, etc.) or cause side-effects (e.g. generate output, change .ini settings, etc.) but SHOULD NOT do both.
Namespaces and classes MUST follow PSR-0.
Class names MUST be declared in
Class constants MUST be declared in all upper case with underscore separators.
Method names MUST be declared in
Code MUST follow PSR-1.
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
namespacedeclaration, and there MUST be one blank line after the block of
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;
finalMUST be declared before the visibility;
staticMUST 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.
pear install PHP_CodeSniffer
Clone this repository to a folder called PSR inside your CodeSniffer Standards directory (eg.: /usr/share/php/PHP/CodeSniffer/Standards)
cd /usr/share/php/PHP/CodeSniffer/Standards git clone https://github.com/klaussilveira/phpcs-psr PSR
Set PSR as the default sniff for CodeSniffer:
phpcs --config-set default_standard PSR