https://wiki.php.net/rfc/typed_class_constants
Since PHP 8.3, class constants can be typed.
Seems to make sense, considering you can subclass and override constants. Typing a constant enforces it down the line. Particularly useful in tests.
Rule: SlevomatCodingStandard.TypeHints.ClassConstantTypeHint
New rule introduced in the latest version of slevomat/coding-standard
Mostly autofixable. In scenarios where a constant isnt subclasses, phpcbf can add types. However things like bools, the autofixer might add true or false, but not pick up hierarchy and set to bool. It also seems like if a constant is a classname CLASS::class, string isnt added, but thats an easy fix.
https://wiki.php.net/rfc/typed_class_constants
Since PHP 8.3, class constants can be typed.
Seems to make sense, considering you can subclass and override constants. Typing a constant enforces it down the line. Particularly useful in tests.
Rule:
SlevomatCodingStandard.TypeHints.ClassConstantTypeHintNew rule introduced in the latest version of
slevomat/coding-standardMostly autofixable. In scenarios where a constant isnt subclasses,
phpcbfcan add types. However things like bools, the autofixer might addtrueorfalse, but not pick up hierarchy and set tobool. It also seems like if a constant is a classnameCLASS::class, string isnt added, but thats an easy fix.