在我们的CI服务器上,我们运行PHP codesniffer
和phpmd
。提出的一些问题是误报。如何禁用那些要分析的PHP文件的某些部分(如Java中的@SupressWarning(...))?谢谢!
答案 0 :(得分:2)
取自文档。在Google搜索disable parts of a file codesniffer php
Ignoring parts of a file using comments
$xmlPackage = new XMLPackage;
// @codingStandardsIgnoreStart
$xmlPackage['error_code'] = get_default_error_code_value();
// @codingStandardsIgnoreEnd
$xmlPackage->send();
http://pear.php.net/manual/en/package.php.php-codesniffer.advanced-usage.php
这是你的意思吗?
至于PHP-MD ......
http://phpmd.org/documentation/suppress-warnings.html
从
点击两次我通常不会这么说,但是如果你阅读文档(你似乎已经做了,因为我编辑了这个答案,对你来说会更快!)
答案 1 :(得分:2)
对于PHPMD,它是: @SuppressWarnings(PHPMD) @SuppressWarnings(PHPMD.UnusedLocalVariable)