Menu

← Back to constant.*

Error Identifier: constant.attributesRuleCannotRun

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 #

This error cannot be demonstrated with a simple code example because it depends on the PHP runtime version used to run PHPStan.

Why is it reported? #

PHPStan needs PHP 8.5 or later as its runtime to check attributes on global constants. The analysed code uses attributes on a global constant (a feature available since PHP 8.5), but the PHP version running PHPStan itself is older than 8.5.

This is a limitation of the PHPStan runtime environment, not of the analysed code itself.

How to fix it #

Run PHPStan with PHP 8.5 or later to enable checking attributes on global constants.

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\Constants\ConstantAttributesRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.