4
我們在我們的項目中使用PSR0,PSR1和PSR2標準,但是我想從PSR0命名空間檢查規則中排除特定文件。有沒有一種方法,我可以添加到文件的註釋,所以phpcs該規則被忽略:排除特定文件的特定PHPCS規則
每個類都必須在至少一個級別的命名空間...
我們在我們的項目中使用PSR0,PSR1和PSR2標準,但是我想從PSR0命名空間檢查規則中排除特定文件。有沒有一種方法,我可以添加到文件的註釋,所以phpcs該規則被忽略:排除特定文件的特定PHPCS規則
每個類都必須在至少一個級別的命名空間...
這裏: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>
這就是我最終做的,再加上從頭開始編寫自己的規則集。 –