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

Squiz.NamingConventions.ValidVariableName.NotCamelCaps + property promotion = false positive #3564

Open
LastDragon-ru opened this issue Mar 22, 2022 · 0 comments

Comments

@LastDragon-ru
Copy link

Describe the bug

Property promotions handling like variables, but they are class property

Code sample

<?php declare(strict_types = 1);

namespace Tests;

class Test {
    public string $normal_property = 'abc';

    public function __construct(
        public string $promoted_property = 'abc',
    ) {
        // empty
    }
}

Custom ruleset

<?xml version="1.0"?>
<ruleset name="My Custom Standard">
  <rule ref="Squiz.NamingConventions.ValidVariableName.NotCamelCaps"/>
</ruleset>

To reproduce
Steps to reproduce the behavior:

  1. Create a file called test.php with the code sample above...
  2. Run phpcs test.php ...
  3. See error message displayed
----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------
 9 | ERROR | Variable "promoted_property" is not in valid camel caps format
----------------------------------------------------------------------------

Expected behavior

No error.

Versions (please complete the following information):

  • OS: Windows 10
  • PHP: 8.0
  • PHPCS: 3.6.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant