Ignore comments
Suppress specific rules for a line, region, or file.
An ignore comment names full rule IDs, such as lint/security/no-eval, or groups, such as lint/dead-code. Separate several with commas.
| Form | Applies to |
|---|---|
$x = foo(); // @pun-ignore analyse/undefined/function |
The line it ends |
// @pun-ignore lint/types/no-loose-comparison on its own line |
The next line |
// @pun-ignore-next-line <id> |
The next line |
// @pun-ignore-file <id> before the first statement |
The whole file |
// @pun-ignore-start <id> … // @pun-ignore-end |
A region |
Add a reason after --:
eval($code); // @pun-ignore lint/security/no-eval -- legacy plugin loader
Scope and validation
/* */and/** */comments work too.- Format rules and the token-based lint rules from PHP-CS-Fixer accept only
@pun-ignore-file. - An ignore comment without an ID is an error.
lint/comments/no-unused-ignorereports IDs that suppress nothing.--fixremoves them.
pun migrate converts the PHPStan and PHP-CS-Fixer ignore comments it recognizes.