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 #
<?php declare(strict_types = 1);
function doFoo(int $i): int
{
// @phpstan-ignore-next-line
return $i + 1;
}
Why is it reported? #
A @phpstan-ignore-next-line or @phpstan-ignore-line comment is present, but no error is reported on that line. This means the ignore comment is unnecessary because the code on that line does not produce any PHPStan error.
This typically happens when:
- The error that was originally being suppressed has been fixed but the ignore comment was not removed
- Code was refactored and the error moved to a different line
- PHPStan was updated and the rule no longer reports an error in this context
This error is controlled by the reportUnmatchedIgnoredErrors configuration parameter.
How to fix it #
Remove the unnecessary ignore comment:
<?php declare(strict_types = 1);
function doFoo(int $i): int
{
- // @phpstan-ignore-next-line
return $i + 1;
}
If the ignore comment was suppressing an error that still exists but has moved, relocate the comment to the correct line.
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\AnalyserResultFinalizer [1]