Ignore code snippets in PHP_CodeSniffer

Madalina picture Madalina · Nov 29, 2010 · Viewed 20k times · Source

It is possible to ignore some parts of code from a php file when it's analyzed by PHP_CodeSniffer?

Answer

Anti Veeranna picture Anti Veeranna · Nov 29, 2010

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.