Skip to content

PSR12.Properties.ConstantVisibility false positive when using public final const syntax #3526

Closed
@FlintMayers

Description

@FlintMayers

Describe the bug
False positive found with the example below
Code sample

class SampleEnum
{
    public final const SAMPLE_CONST = 'SAMPLE';
}

To reproduce
Steps to reproduce the behavior:

  1. Create a file called SampleEnum.php with the code sample above...
  2. Run phpcs SampleEnum.php ...
  3. See error message displayed
Visibility must be declared on all constants if your project supports PHP 7.1 or later
    |         | (PSR12.Properties.ConstantVisibility.NotFound)

Expected behavior
False positive. It shouldn't show a warning.

Versions (please complete the following information):

  • OS: Linux
  • PHP: 8.1
  • PHPCS: 3.6.2
  • Standard: PSR12

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions