【发布时间】:2015-10-30 22:47:09
【问题描述】:
我们在项目中使用 PSR0、PSR1 和 PSR2 标准,但我想从 PSR0 命名空间检查规则中排除特定文件。有没有办法可以在文件中添加注释,所以 phpcs 会忽略此规则:
每个类必须位于至少一层的命名空间中...
【问题讨论】:
标签: php codesniffer
我们在项目中使用 PSR0、PSR1 和 PSR2 标准,但我想从 PSR0 命名空间检查规则中排除特定文件。有没有办法可以在文件中添加注释,所以 phpcs 会忽略此规则:
每个类必须位于至少一层的命名空间中...
【问题讨论】:
标签: php codesniffer
这里: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>
【讨论】: