|Supported Version||2.9.1, 3.2.3|
To start using PHP_CodeSniffer, enable it in repository setting.
To customize standard you want to follow, add
sideci.yml in your repository and write down your desired standard in it.
linter: code_sniffer: dir: app/ options: standard: CakePHP
SideCI assumes you are using PHP_CodeSniffer 2.9, for compatibility.
If you want to use version 3, declare that in
linter: code_sniffer: version: 3
SideCI tries to detect standard and target directory for your project automatically when you specifies nothing in
If it cannot find appropriate standard, it assumes
PSR2 as its standard and analyzes all PHP files in your repository.
SideCI tries to detect the most suitable standard and target directory for your project, based on the framework your project is using.
When you are using CodeSniffer version 2, the following standards can be auto-detected:
When you are using CodeSniffer version 3, the following standards can be auto-detected:
The autodetection is based on file and directory structure.
For the case auto detection fails, you can specify standard in
Example setting for PHP_CodeSniffer under
code_sniffer is the following:.
linter: code_sniffer: version: 3 dir: app/ options: standard: phpcs.xml extensions: php,inc,lib encoding: utf-8
This option controls version of PHP_CodeSniffer in running. Default value is
This option controls directories SideCI inspects. The default value is depended on frameworks PHP_CodeSniffer supports.
If you use no frameworks or use any frameworks PHP_CodeSniffer does not support,
./ is adopted by default.
In case you would like to exclude specific directories, you should write it in your custom ruleset file.
This option controls command line options given to
This option controls coding standard of your project. If you leave this value absent, SideCI tries to detect standard automatically.
PSR2 is used when auto detection fails.
You available your custom ruleset to declare it in a
/path/to/MyStandard. Furthermore, you can use other standards which PHP_CodeSniffer supports below:
$ phpcs -i The installed coding standards are FuelPHP, Symfony2, CodeIgniter, CakePHP, PEAR, Zend, Squiz, PSR2, PHPCS, PSR1, MySource, WordPress-Docs, WordPress-Extra, WordPress-VIP, WordPress and WordPress-Core
$ phpcs3 -i The installed coding standards are MySource, PEAR, PSR1, PSR2, Squiz, Zend, Symfony, CakePHP, WordPress-Docs, WordPress-Core, WordPress, WordPress-Extra and WordPress-VIP
This option controls extensions of files SideCI inspects. The default value is
This option controls file encoding.
SideCI has a plan to run with version 2 by default for a while. However, PHP_CodeSniffer says that version 2 is released to serious bug and security fixes only and that new features are developed for only after version 3. Thus we recommend you to use version 3 in a case of some reasons.