-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Add support for error fixing to ArrayDeclaration #378
Conversation
This basically synchronizes it with `Squiz.Arrays.ArrayDeclaration`. The upstream version is similar, except that we exclude a few errors. Unfortunately we have to actually comment out the code rather than just using the upstream sniff and `<exclude>` in our ruleset, due to a bug (squizlabs/PHP_CodeSniffer#582). (I’ve also included a fix for another bug, squizlabs/PHP_CodeSniffer#584.) Because of this, we cannot yet eliminate duplicated logic from this child sniff. I think this pretty much maintains the previous behavior, except that I have added a warning for extra whitespace at the edges of multiline arrays.
Note: I don't think this will be compatible withe PHPCS < 2.0. Are we trying to maintain compatibility with 1.5? There is this note in the reademe:
|
@JDGrimes I don't think we should be trying to maintain compatibility with PHPCS 1.5, no. That readme note is just an old one. There's no need to incur the burden of supporting older versions of PHPCS. Maybe the base sniff class could do a check for the PHPCS version and error-out if it detects that an older version is being used. |
+1. I know Yoast has currently tied itself to PHPCS 2.2.0 (latest tag is 2.3.2) because one of the tools they use hasn't been updated yet, but there's no need to support PHPCS lower than that. |
I've converted the warnings to errors in e2c5160. This should be ready to merge. |
…-declaration Add support for error fixing to ArrayDeclaration
This basically synchronizes it with
Squiz.Arrays.ArrayDeclaration
.The upstream version is similar, except that we exclude a few errors.
Unfortunately we have to actually comment out the code rather than just
using the upstream sniff and
<exclude>
in our ruleset, due to a bug(squizlabs/PHP_CodeSniffer#582). (I’ve also included a fix for another
bug, squizlabs/PHP_CodeSniffer#584.) Because of this, we cannot yet
eliminate duplicated logic from this child sniff.
I think this pretty much maintains the previous behavior, except that I
have added a warning for extra whitespace at the edges of multiline
arrays.
Another note, the whitespace messages are warnings:
Maybe these should be converted to errors? I'm not sure why they are just warnings (it goes all the way back to Urban Giraffe).