1.2.988. Possible Interfaces¶
This analyzer lists classes that may be a base to create interfaces.
Currently, classes with more than 1 defined method are used to identify possible interfaces. An interfaces are considered when at least 2 methods are common in 3 classes.
Only the name of the method is used to identify possible methods. Signature and method options are not taken into account.
<?php
class a {
function m1 () {}
function m2 () {}
function m3 () {}
}
class b {
function m1 () {}
function m2 () {}
function m4 () {}
}
// This class has not enough shared methods with other classes
class c {
function m1 () {}
function m4 () {}
function m5 () {}
}
?>
1.2.988.1. Connex PHP features¶
1.2.988.1.1. Suggestions¶
Add those interfaces, and use the implements keyword in the mentioned classes.
1.2.988.1.2. Specs¶
Short name |
Interfaces/PossibleInterfaces |
Rulesets |
|
Exakat since |
2.0.6 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Medium |
Available in |