Closed dingo-d closed 4 years ago
I do prefer short syntax array.
If we enforce them that means that all the sniffs will have to have the array syntax changed, but that can be autofixed, so it shouldn't be problematic I guess. Should I make a new PR and close this one then?
Either that or update this PR to do the reverse (and change the description and title).
If needs be, you can look at this PR for inspiration: https://github.com/Yoast/yoastcs/pull/159/files
FYI: I haven't merged any of the others yet as this one is basically needed to get the builds to pass again. So once this PR is updated (or closed and a new one created), I'll merge it and then merge the others.
I excluded the short array syntax using this
<rule ref="Generic.Arrays">
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
</rule>
instead of loading the entire WordPress
ruleset and just excluding this one. This does the same thing. I worry that if I inlcuded the entire WordPress
ruleset, I'd have to exclude tons of other sniffs as well.
Yeah, autoprefixer actually failed so I did it all by hand :grimacing:
Yeah, autoprefixer actually failed so I did it all by hand grimacing
Huh ? Hmm.... I'll have a look as that's something we should be concerned about.
I did run a quick test on the develop
commit before the merge and the auto-fixer worked perfectly in isolation (with the ruleset change as has now been merged):
phpcbf --sniffs=generic.arrays.disallowlongarraysyntax
And just ran a test using just phpcbf
with the ruleset changes as now merged and I don't get any fixer-conflicts.
Could it be you tried with the ruleset which included <rule ref="Generic.Arrays">
? That could be the reason as - not surprisingly - that just means that the WPCS and the upstream array indentation sniffs work differently and conflict.
That conflict is now resolved though with the updated ruleset.
Yeah, I ran it with the old change. So that must be it :+1:
This is done to prevent failing of the TravisCI due to changes made in the WPCS 2.2.0 where short array syntax was disallowed.