1.2.711. Missing Visibility¶
Class constants, properties and methods usage may be controlled by the visibility option. When omitted, it is by default public.
When omitted, it should be added to make its configuration explicit.
<?php
class x {
// property is private
private $property = 1;
// This method is public, and should bear the 'public' option
function foo() {}
}
?>
See also Visibility.
1.2.711.1. Connex PHP features¶
1.2.711.1.1. Suggestions¶
Add the public visibility
Actually review the code and set a pragmatic visibility
Set the visibility to private and wait for a request of access
1.2.711.1.2. Specs¶
Short name |
Classes/MissingVisibility |
Rulesets |
|
Exakat since |
2.3.5 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Related rule |
|
Available in |