Skip to content

Squiz.WhiteSpace.MemberVarSpacing removes comments before first member var during auto fixing #2656

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

Merged

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Oct 17, 2019

Squiz/MemberVarSpacing: bug fix - don't remove comments before first member var

If there would be comments (or commented out code) before the first member variable, the fixer as it was, would remove those comments, including potential PHPCS annotations.

By allowing for other comments between the class opener/trait import use statement and a property, this is prevented.

The fix now implemented means that if there is anything between the class opener/trait import use and the first property, other than a property docblock/comment, the property will be treated as any property and won't get the special "first property" treatment.

Includes unit test.

…member var

If there would be comments (or commented out code) before the first member variable, the fixer as it was, would remove those comments, including potential PHPCS annotations.

By allowing for others comments between the class opener/trait import `use` statement and a property, this is prevented.

The fix now implemented means that if there is anything between the class opener/trait import `use` and the first property, other than a property docblock/comment, the property will be treated as any property and won't get the special "first property" treatment.

Includes unit test.
@gsherwood gsherwood added this to the 3.5.2 milestone Oct 20, 2019
@gsherwood gsherwood changed the title Squiz/MemberVarSpacing: bug fix - don't remove comments before first member var Squiz.WhiteSpace.MemberVarSpacing removes comments before first member var during auto fixing Oct 20, 2019
gsherwood added a commit that referenced this pull request Oct 20, 2019
@gsherwood gsherwood merged commit 49c430a into squizlabs:master Oct 20, 2019
@gsherwood
Copy link
Member

Thanks a lot for this fix.

@jrfnl jrfnl deleted the feature/squiz-membervarspacing-bugfix branch October 21, 2019 01:16
@gsherwood gsherwood modified the milestones: 3.5.3, 3.5.2 Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants