Madalina Madalina - 2 months ago 21
PHP Question

Ignore code snippets in PHP_CodeSniffer

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

PHP_CodeSniffer
?

Answer

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.