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.WhiteSpace.MemberVarSpacing can only fix property with attribute preceded by a comment #3594

Open
pattisahusiwa opened this issue May 16, 2022 · 1 comment

Comments

@pattisahusiwa
Copy link

Describe the bug
Currently, phpcs can only fix a property with attribute preceded by a comment.

Code sample

<?php

final class MemberVar
{
    // phpcs can fix this but not the next one
    #[SingleAttribute]

    public $property1;
    #[SingleAttribute]

    public $property2;

    #[SingleAttribute]

    public $property3;
}

Custom ruleset

<?xml version="1.0"?>
<ruleset name="My Custom Standard">
  <rule ref="Squiz.WhiteSpace.MemberVarSpacing" />
</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 ...

Expected behavior
The result should be something like this

<?php

final class MemberVar
{
    // phpcs can fix this but not the next one
    #[SingleAttribute]
    public $property1;

    #[SingleAttribute]
    public $property2;

    #[SingleAttribute]
    public $property3;
}

Versions (please complete the following information):

  • OS: Arch Linux
  • PHP: 8.1
  • PHPCS: 3.6.2
  • Standard: Squiz
@jrfnl
Copy link
Contributor

jrfnl commented May 17, 2022

Related #3334, #3419, #3440

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

No branches or pull requests

3 participants