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

New sniff to align array items #37

Open
fredden opened this issue Jul 25, 2023 · 1 comment
Open

New sniff to align array items #37

fredden opened this issue Jul 25, 2023 · 1 comment

Comments

@fredden
Copy link
Member

fredden commented Jul 25, 2023

This is a follow-up on PHPCompatibility/PHPCompatibility#1586 (comment) so the task doesn't get lost / forgotten. We would like to have a sniff to enforce alignment of array items.

The sniff Squiz.Arrays.ArrayDeclaration (with its DoubleArrowNotAligned rule) has been reviewed and found to be not suitable / robust enough in all cases. For example, see PHPCompatibility/PHPCompatibility@74fc529#diff-05ae9cddcaec1e845771a7db224961439f83ef5939ec67d3a48744cb34d7e58bR106-R110

It's not strictly necessary to create a new sniff in this repository to satisfy this requirement; if a suitable sniff in another standard can be identified, it's possible to use that here.

@jrfnl
Copy link
Member

jrfnl commented Jul 25, 2023

A sniff for this is planned to be added to the PHPCSExtra NormalizedArrays ruleset. Once that ruleset is completely done, the Squiz.Arrays.ArrayDeclaration sniff will be removed from PHPCSDevCS and replaced by the NormalizedArrays standard (with potentially some customization via properties).

There is no intention to add any sniffs to PHPCSDevCS itself. That will only change if at some point the need for a 100% PHPCS sniff writing specific sniff would be identified.

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

No branches or pull requests

2 participants