Menu

← Back to ignore.*

Error Identifier: ignore.unmatchedLine

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.

How to ignore this error #

You can use the identifier ignore.unmatchedLine to ignore this error using a comment:

// @phpstan-ignore ignore.unmatchedLine
codeThatProducesTheError();

You can also use only the identifier key to ignore all errors of the same type in your configuration file in the ignoreErrors parameter:

parameters:
	ignoreErrors:
		-
			identifier: ignore.unmatchedLine

Rules that report this error #

  • PHPStan\Analyser\AnalyserResultFinalizer [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.