By default, PHP_CodeSniffer will use the PEAR coding standard if no standard is supplied on the command line. You can change the default standard by setting the default_standard configuration option.
Example 55-1. Setting the default standard to be the Zend coding standard
|
By default, PHP_CodeSniffer will use the full report format if no format is supplied on the command line. You can change the default report format by setting the report_format configuration option.
Example 55-2. Setting the default report format to be the summary report
|
By default, PHP_CodeSniffer will show both errors and warnings for your code. You can hide warnings for a single script run by using the -n command line argument, but you can also enable this by default if you prefer. To hide warnings by default, set the show_warnings configuration option to 0.
Example 55-3. Hiding warnings by default
|
Note: When warnings are hidden by default, you can use the -w command line argument to show them for a single script run.
By default, PHP_CodeSniffer will not convert tabs to spaces in checked files. Specifying a tab width will make PHP_CodeSniffer replace tabs with spaces. You can force PHP_CodeSniffer to replace tabs with spaces by default by setting the tab_width configuration option.
Example 55-4. Setting the default tab width to be 4 spaces
|
Note: When the tab width is set by default, the replacement of tabs with spaces can be disabled for a single script run by setting the tab width to zero.
Example 55-5. Disabling the replacement of tabs with spaces
$ phpcs --tab-width=0 /path/to/code
The Zend coding standard includes a sniff that will check each file using the Zend Code Analyzer, a tool that comes with Zend Studio. Use the zend_ca_path configuration option to tell the Zend Code Analyzer sniff where to find the tool.
Example 55-6. Setting the path to Zend Code Analyzer
|