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

PEAR/FunctionDeclaration: ignore multi-line attributes for promoted properties #3427

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Sep 5, 2021

PEAR/FunctionDeclaration: ignore multi-line attributes for promoted properties

Similar to (multi-line) arrays in a multi-line function declaration, ignore (multi-line) attributes for the purposes of the indentation checks in this sniff.

This does mean that inconsistent indentation within multi-line attributes/ for an attribute closer will not be fixed, but that should be handled by a dedicated attribute formatting sniff in my opinion.

Includes unit tests.

Fixes #3424

PEAR/FunctionDeclaration: minor efficiency tweak

(noticed while investigating the above)

Similar to (multi-line) arrays in a multi-line function declaration, ignore (multi-line) attributes for the purposes of the indentation checks in this sniff.

This does mean that inconsistent indentation within multi-line attributes/ for an attribute closer will not be fixed, but that should be handled by a dedicated attribute formatting sniff in my opinion.

Includes unit tests.

Fixes 3424
@jrfnl
Copy link
Contributor Author

jrfnl commented Sep 5, 2021

Note: by extension, this also fixes the same issue in the Squiz.Functions.MultiLineFunctionDeclaration sniff.

@jrfnl jrfnl changed the title PEAR/FunctionDeclaration: ignore multi-line promoted properties PEAR/FunctionDeclaration: ignore multi-line attributes for promoted properties Sep 7, 2021
@gsherwood gsherwood added this to Idea Bank in PHPCS v3 Development via automation Sep 27, 2021
@gsherwood gsherwood added this to the 3.6.1 milestone Sep 27, 2021
gsherwood added a commit that referenced this pull request Sep 27, 2021
gsherwood added a commit that referenced this pull request Sep 27, 2021
@gsherwood gsherwood merged commit 8ea08a5 into squizlabs:master Sep 27, 2021
PHPCS v3 Development automation moved this from Idea Bank to Ready for Release Sep 27, 2021
@gsherwood
Copy link
Member

Thanks for fixing this.

@jrfnl jrfnl deleted the feature/3424-pear-functiondeclaration-handle-attributes branch September 27, 2021 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
PHPCS v3 Development
Ready for Release
Development

Successfully merging this pull request may close these issues.

PHPCS fails when using PHP 8 Constructor property promotion with attributes
2 participants