Exclude a specific PHPCS rule for a specific file

In our project, we use the standards PSR0, PSR1, and PSR2, but I want to exclude a specific file only from the PSR0 namespace validation rule. Is there a way to add a comment to the file, so phcs ignores this rule:

Each class must be in a namespace of at least one level ...

+4
source share
1 answer

Here: http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php

They show this example:

<!--
    You can also hard-code ignore patterns for specific sniffs,
    a feature not available on the command line.

    The code here will hide all messages from the Squiz DoubleQuoteUsage
    sniff for files that match either of the two exclude patterns.
 -->
 <rule ref="Squiz.Strings.DoubleQuoteUsage">
    <exclude-pattern>*/tests/*</exclude-pattern>
    <exclude-pattern>*/data/*</exclude-pattern>
 </rule>
+8
source

All Articles