1.2.103. Can’t Overwrite Final Method¶
A final method is a method that cannot be overwritten in a child class. This means that no class below the current class may define a method with the same name.
<?php
class y extends x {
function method() {}
}
class x {
final function method() {}
}
?>
1.2.103.1. Suggestions¶
Remove the final keyword in the parent class
Remove the method in the child class
Rename the method in the child class
1.2.103.2. Specs¶
Short name |
Classes/CantOverwriteFinalMethod |
Rulesets |
|
Exakat since |
2.4.2 |
PHP Version |
With PHP 5.0 and more recent |
Severity |
Major |
Time To Fix |
Slow (1 hour) |
Precision |
High |
Features |
final, overwrite |
Available in |