Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
FlintMayers opened this issue Jan 5, 2022 · 2 comments · Fixed by #3527
Closed

Comments

@FlintMayers
Copy link

FlintMayers commented Jan 5, 2022

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
@jrfnl
Copy link
Contributor

jrfnl commented Jan 5, 2022

@FlintMayers Thanks for reporting this. PHP 8.1 support is still being worked on - see #3479.

Even so, I have confirmed the issue and pulled a fix in #3527. Testing appreciated.

@jrfnl jrfnl mentioned this issue Jan 5, 2022
8 tasks
@gsherwood gsherwood added this to Idea Bank in PHPCS v3 Development via automation Jan 10, 2022
@gsherwood gsherwood added this to the 3.7.0 milestone Jan 10, 2022
@gsherwood gsherwood changed the title False positive when using public final const syntax PSR12.Properties.ConstantVisibility false positive when using public final const syntax Jan 10, 2022
gsherwood added a commit that referenced this issue Jan 10, 2022
PHPCS v3 Development automation moved this from Idea Bank to Ready for Release Jan 10, 2022
@gsherwood
Copy link
Member

PR worked for me and has been merged. Thanks for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
PHPCS v3 Development
Ready for Release
Development

Successfully merging a pull request may close this issue.

3 participants