1.2.550. Implemented Methods Must Be Public¶
Class methods that are defined in an interface must be public. They cannot be either private, nor protected. This error is not reported by lint, and is reported at execution time.
<?php
interface i {
function foo();
}
class X {
// This method is defined in the interface : it must be public
protected function foo() {}
// other methods may be private
private function bar() {}
}
?>
See also Interfaces and Interfaces - the next level of abstraction.
1.2.550.2. Connex PHP features¶
1.2.550.2.1. Suggestions¶
Make the implemented method public
1.2.550.2.2. Specs¶
Short name |
Classes/ImplementedMethodsArePublic |
Rulesets |
|
Exakat since |
0.11.5 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Instant (5 mins) |
Precision |
Very high |
Note |
This issue may lint but will not run |
Available in |