|
1 | 1 | Doctrine PHP_CodeSniffer Coding Standard |
2 | 2 | ======================================== |
3 | 3 |
|
4 | | -[](http://travis-ci.org/doctrine/coding-standard) |
5 | | -[](https://coveralls.io/r/doctrine/coding-standard?branch=master) |
| 4 | +[](http://travis-ci.org/doctrine/coding-standard) |
| 5 | +[](https://packagist.org/packages/doctrine/coding-standard) |
| 6 | +[](https://packagist.org/packages/doctrine/coding-standard) |
6 | 7 |
|
7 | | -The [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) Coding Standard to check against the [Doctrine Coding Standard](https://github.com/deeky666/doctrine-coding-standard/blob/master/Docs/README.md). |
| 8 | + |
| 9 | +The [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) ruleset to check that repositories are |
| 10 | +following the standards defined by the our team. |
| 11 | + |
| 12 | +Standards |
| 13 | +--------- |
| 14 | + |
| 15 | +We use [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) |
| 16 | +and [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) with some |
| 17 | +exceptions/differences (:white_check_mark: are the implemented sniffs): |
| 18 | + |
| 19 | +- Keep the nesting of control structures per method as small as possible |
| 20 | +- Add spaces between assignment, control and return statements |
| 21 | +- Prefer early exit over nesting conditions |
| 22 | +- :white_check_mark: Align equals (=) signs |
| 23 | +- :white_check_mark: Add spaces around a concatenation operator `$foo = 'Hello ' . 'World!';` |
| 24 | +- :white_check_mark: Add spaces around a negation if condition `if ( ! $cond)` |
| 25 | +- :white_check_mark: Add spaces around a return type declaration `function () : void {}` |
| 26 | +- :white_check_mark: Add spaces after a type cast `$foo = (int) '12345';` |
8 | 27 |
|
9 | 28 | Installation |
10 | 29 | ------------ |
|
0 commit comments