Menu
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 int|& $value
*/
function doFoo($value): 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 invalid type int|& – the & is not a valid type and cannot appear after the union operator |.
How to fix it #
Fix the PHPDoc syntax:
<?php declare(strict_types = 1);
/**
- * @param int|& $value
+ * @param int $value
*/
-function doFoo($value): void
+function doFoo(int $value): 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