1.2.415. Empty Interfaces¶
Empty interfaces are a code smell. Interfaces should contains at least a method or a constant, and not be totally empty.
<?php
// an empty interface
interface empty {}
// an normal interface
interface normal {
public function i() ;
}
// a constants interface
interface constantsOnly {
const FOO = 1;
}
?>
See also Empty interfaces are bad practice and Blog : Are empty interfaces code smell?.
1.2.415.1. Connex PHP features¶
1.2.415.1.1. Suggestions¶
Remove the interface
Add some methods or constants to the interface
1.2.415.1.2. Specs¶
Short name |
Interfaces/EmptyInterface |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Instant (5 mins) |
Precision |
High |
Available in |