Ignore code snippets in PHP_CodeSniffer

Can I ignore some parts of the code from a php file when parsing it using PHP_CodeSniffer ?

+43
php codesniffer
Nov 29 '10 at 17:26
source share
2 answers

Yes, this is possible with @codingStandardsIgnoreStart and @codingStandardsIgnoreEnd annotations

 <?php some_code(); // @codingStandardsIgnoreStart this_will_be_ignored(); // @codingStandardsIgnoreEnd some_other_code(); 

The documentation also describes

+69
Nov 29 '10 at 18:29
source share

You can use a combination of: @codingStandardsIgnoreStart and @codingStandardsIgnoreEnd , or you can use @codingStandardsIgnoreLine .

Example:

 <?php command1(); // @codingStandardsIgnoreStart command2(); // this line will be ignored by Codesniffer command3(); // this one too command4(); // this one too // @codingStandardsIgnoreEnd command6(); // @codingStandardsIgnoreLine command7(); // this line will be ignored by Codesniffer 
+26
Jun 10 '15 at 11:09
source share



All Articles