On our CI servers we run PHP codesniffer
and phpmd
. Some of issues raised are false-positive. How can I disable certain parts of PHP file to be analysed by those (as @SupressWarning(...) in Java) ? Thanks!
Asked
Active
Viewed 579 times
0

FazoM
- 4,777
- 6
- 43
- 61
2 Answers
3
Taken from the documentation. First hit after doing a Google search for 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
Is this what you mean?
As for PHP-MD...
http://phpmd.org/documentation/suppress-warnings.html
Two clicks from
I'm not normally the kind to say this, but it would be much quicker for you if you read the documentation (which it seems you did, as I edited this answer!)

Rob Baillie
- 3,436
- 2
- 20
- 34
-
Thanks. I need the same for PHP-MD. – FazoM Nov 28 '13 at 15:05
3
For PHPMD it is: @SuppressWarnings(PHPMD) @SuppressWarnings(PHPMD.UnusedLocalVariable)

FazoM
- 4,777
- 6
- 43
- 61