1.2.1390. Useless Constant Overwrite¶
A class constant is defined in a parent and child class, with the same value. One of them is useless and may be removed.
<?php
class x {
const A = 1;
const B = 1;
}
class y extends x {
// A is the same as in the parent class.
const A = 1;
// B has a new value, so it is important.
const B = 2;
}
?>
1.2.1390.1. Suggestions¶
Remove the parent constant
Remove the child constant
1.2.1390.2. Specs¶
Short name |
Classes/UselessConstantOverwrite |
Rulesets |
|
Exakat since |
2.5.3 |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Medium |
Available in |