Cannot use ‘static’ as constant modifier¶
Description¶
static
is an option for properties and methods, and it is not available for class constants. A class constant is reachable with the name of the class: as such, it behaves like a static
class constant by definition: there are not object’s constants.
Example¶
<?php
class X {
private static const A = 1;
}
?>
Solutions¶
Remove the option from the constant signature.
In more recent PHP versions, this error message is now Cannot use the %s modifier on a %s.