Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 912 Bytes

SlevomatCodingStandard.Classes.ClassConstantVisibility.md

File metadata and controls

20 lines (12 loc) · 912 Bytes

Pattern: Missing class constant visibility

Issue: -

Description

In PHP 7.1+ it's possible to declare visibility of class constants. In a similar vein to optional declaration of visibility for properties and methods which is actually required in sane coding standards, this rule also requires declaring visibility for all class constants.

Rule provides the following settings:

  • fixable: the rule is not fixable by default because we think it's better to decide about each constant one by one, however you can enable fixability with this option.
const FOO = 1; // visibility missing!
public const BAR = 2; // correct

Further Reading