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);
/** @deprecated Use NewConfig instead */
interface OldConfig
{
}
echo OldConfig::$value;
Why is it reported? #
This error is reported by the phpstan-deprecation-rules extension.
A static property is accessed directly on an interface that has been marked as @deprecated. Deprecated interfaces are planned for removal in a future version, and code should not access static properties on them.
How to fix it #
Use the recommended replacement interface or access the property through a non-deprecated type:
-echo OldConfig::$value;
+echo NewConfig::$value;
How to ignore this error #
You can use the identifier staticProperty.deprecatedInterface to ignore this error using a comment:
// @phpstan-ignore staticProperty.deprecatedInterface
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: staticProperty.deprecatedInterface