Error Identifier: ignore.parseError
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);
$x = 1; // @phpstan-ignore this is not valid(
echo $x;
Why is it reported? #
The @phpstan-ignore inline comment contains a syntax error that prevents PHPStan from parsing the list of error identifiers. The ignore directive must follow a specific format: a comma-separated list of valid error identifiers, optionally with parenthesized descriptions.
How to fix it #
Correct the syntax of the @phpstan-ignore comment. Identifiers are dot-separated names, and optional descriptions go in parentheses with matching opening and closing brackets:
<?php declare(strict_types = 1);
-$x = 1; // @phpstan-ignore this is not valid(
+$x = doSomething(); // @phpstan-ignore return.type (reason for ignoring)
echo $x;
Multiple identifiers can be separated by commas:
<?php declare(strict_types = 1);
$x = doSomething(); // @phpstan-ignore return.type, argument.type
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\Rules\Ignore\IgnoreParseErrorRule [1]