Menu
Error Identifier: phpDoc.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);
/**
* @param array<int, > $values
*/
function doFoo(array $values): void
{
}
Why is it reported? #
The PHPDoc tag contains a value that could not be parsed. In the example above, the @param tag has an incomplete generic type array<int, > (missing the value type after the comma).
How to fix it #
Fix the PHPDoc syntax:
<?php declare(strict_types = 1);
/**
- * @param array<int, > $values
+ * @param array<int, string> $values
*/
function doFoo(array $values): void
{
}
How to ignore this error #
You can use the identifier phpDoc.parseError to ignore this error using a comment:
// @phpstan-ignore phpDoc.parseError
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: phpDoc.parseError