1.2.1059. Rewrote Final Class Constant¶
Final class constants can’t be rewriten in a child class.
It is possible to write code that lints, when the classes are in different files. Such overwrites will only be detected at execution time.
<?php
class x {
final const A = 1;
const B = 1;
}
class y extends x {
const A = 1;
const B = 1;
}
?>
1.2.1059.2. Connex PHP features¶
1.2.1059.2.1. Suggestions¶
Remove the final keyword
Remove the rewritten constant
1.2.1059.2.2. Specs¶
Short name |
Classes/RewroteFinalClassConstant |
Rulesets |
|
Exakat since |
2.5.4 |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |