排除特定文件的特定PHPCS规则

jos*_*erk 4 php codesniffer

我们在项目中使用PSR0,PSR1和PSR2标准,但我想从PSR0命名空间检查规则中排除特定文件.有没有办法可以在文件中添加注释,所以phpcs会忽略这个规则:

每个类必须位于至少一个级别的命名空间中......

Laj*_*res 11

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

他们展示了这个例子:

<!--
    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>
Run Code Online (Sandbox Code Playgroud)