1.2.1280. Unreachable Method¶
A method that is never called from the code.
The method has the following characteristics : + not private, aka public or protected + The direct class is never instantiated + All children classes overwrite this method + parent:: is never used to reach it
Then, this class is actually dead code.
<?php
class x {
protected function foox() {}
}
class xx extends x {
protected function foox() {}
}
?>
1.2.1280.1. Connex PHP features¶
1.2.1280.1.1. Suggestions¶
Make the method abstract and remove the block
Move the code to one of the child
1.2.1280.1.2. Specs¶
Short name |
Classes/UnreachableMethod |
Rulesets |
|
Exakat since |
2.3.6 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Medium |
Available in |