Menu

Error Identifier: ignore.noComment

← Back to ignore.*

Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.

Code example #

In phpstan.neon:

parameters:
	reportIgnoresWithoutComments: true
<?php

// @phpstan-ignore variable.undefined
echo $undefined;

Why is it reported? #

When reportIgnoresWithoutComments is enabled, every @phpstan-ignore identifier must have an accompanying comment in parentheses explaining why the error is being ignored.

This ensures that ignored errors are documented and reviewable, making it clear to other developers (and your future self) why each suppression exists.

How to fix it #

Add a comment in parentheses after the identifier:

-// @phpstan-ignore variable.undefined
+// @phpstan-ignore variable.undefined (not available at this point)
 echo $undefined;

When ignoring multiple identifiers on the same line, each one needs its own comment:

-echo $foo; // @phpstan-ignore variable.undefined, wrong.id
+echo $foo; // @phpstan-ignore variable.undefined (reason), wrong.id (reason)

Learn more about ignoring errors in Ignoring Errors.

Non-ignorable error #

This error cannot be ignored using @phpstan-ignore or the ignoreErrors configuration. Non-ignorable errors indicate code that would cause a crash or a fatal error at runtime, or a fundamental problem in the analysed code that must be addressed.

Rules that report this error #

  • PHPStan\Analyser\FileAnalyser [1]
Theme
A
© 2026 PHPStan s.r.o.