1.2.1303. Unused Methods¶
Those methods are never called.
They are probably dead code, unless they are called dynamically.
This analysis omits methods which are in a class that makes dynamical self calls : $this->$m()
. That way, any method may be called.
This analysis omits methods which are overwritten by a child class. That way, they are considered to provide a default behavior.
<?php
class foo {
public function used() {
$this->used();
}
public function unused() {
$this->used();
}
}
class bar extends foo {
public function some() {
$this->used();
}
}
$a = new foo();
$a->used();
?>
See also Dead Code: Unused Method.
1.2.1303.1. Connex PHP features¶
1.2.1303.1.1. Suggestions¶
Make use of the method
Remove the method
Move the method to another class
1.2.1303.1.2. Specs¶
Short name |
Classes/UnusedMethods |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Slow (1 hour) |
Precision |
Very high |
Related rule |
|
Available in |