Ignore code snippets in PHP_CodeSniffer
Solution 1:
Yes it is possible with @codingStandardsIgnoreStart and @codingStandardsIgnoreEnd annotations
<?php
some_code();
// @codingStandardsIgnoreStart
this_will_be_ignored();
// @codingStandardsIgnoreEnd
some_other_code();
It is also described in the documentation.
Solution 2:
You can either use the combination: @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