11Yii 2 Web Framework Coding Standard
22===================================
33
4- This repository contains [ PHP_CodeSniffer] ( https://github.com/squizlabs/PHP_CodeSniffer ) coding standard, rule set
5- and sniff token parsing classes for the [ Yii 2 Web Framework] ( https://github.com/yiisoft/yii2/ ) . Overally rules
6- are based on PSR-2 standard with some minor exceptions and changes. Rules derived from PSR-2 standard and excluded
7- in Yii2 standard were implemented (or planned to be) as sniff classes.
8-
9- Rules located in this repository could also be used for checking code style of an existing Yii2 applications.
10- Everything that is merged into main [ Yii2 development repository] ( https://github.com/yiisoft/yii2 ) being checked
11- with these rule set as well.
12-
13- USAGE
14- -----
4+ This repository contains settings for [ Yii2 coding style] ( https://github.com/yiisoft/yii2/wiki/Core-framework-code-style )
5+ for various tools.
156
16- ### Getting code
7+ Getting code
8+ ------------
179
1810You can get code style definition using one of the following methods.
1911
@@ -41,6 +33,19 @@ $ php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
4133$ php composer.phar install
4234```
4335
36+ PHP_Codesniffer
37+ ---------------
38+
39+ [ PHP_CodeSniffer] ( https://github.com/squizlabs/PHP_CodeSniffer ) coding standard, rule set
40+ and sniff token parsing classes for the [ Yii 2 Web Framework] ( https://github.com/yiisoft/yii2/ ) . Overally rules
41+ are based on PSR-2 standard with some minor exceptions and changes. Rules derived from PSR-2 standard and excluded
42+ in Yii2 standard were implemented (or planned to be) as sniff classes.
43+
44+ Rules could also be used for checking code style of an existing Yii2 applications.
45+
46+ Everything that is merged into main [ Yii2 development repository] ( https://github.com/yiisoft/yii2 ) being checked
47+ with these rule set as well.
48+
4449### Using code style
4550
4651After CodeSniffer is installed you can launch it with custom code style using the following syntax:
@@ -49,20 +54,20 @@ After CodeSniffer is installed you can launch it with custom code style using th
4954$ ./vendor/bin/phpcs --extensions=php --standard=Yii2 /home/resurtm/work/Yii2MegaApp/
5055```
5156
52- If you're using PhpStorm you can configure it to use CodeSniffer using Settings → PHP → Code Sniffer. Yii2 code style can be specified at Inspections → PHP → PHP Code Sniffer validation.
53-
54- USEFUL LINKS
55- ------------
57+ If you're using PhpStorm you can configure it to use CodeSniffer using Settings → PHP → Code Sniffer.
58+ Yii2 code style can be specified at Inspections → PHP → PHP Code Sniffer validation.
5659
57- PHP_CodeSniffer:
60+ ### Useful links
5861
5962* [ Configuration options] ( http://pear.php.net/manual/en/package.php.php-codesniffer.config-options.php )
6063* [ Manual and guide] ( http://pear.php.net/manual/en/package.php.php-codesniffer.php )
6164* [ GitHub repository] ( https://github.com/squizlabs/PHP_CodeSniffer )
6265
63- Yii2:
66+ PhpStorm
67+ --------
6468
65- * [ Coding style] ( https://github.com/yiisoft/yii2/wiki/Core-framework-code-style ) wiki page
69+ You can import PhpStorm code style settings for Yii2 using File → Import Settings and choosing
70+ ` PhpStorm/phpstorm_yii2.jar ` .
6671
6772ADDITIONAL NOTES
6873----------------
0 commit comments