Closed rebeccahum closed 1 year ago
@jrfnl Is this expected of the AbstractArrayAssignmentRestrictionsSniff
?
This seems like an upstream issue. Doesn't seem to be fixed with WPCS develop
(pre-3.0) branch.
The abstract class is tested with https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/WordPress/Tests/DB/SlowDBQueryUnitTest.inc and https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/WordPress/Tests/WP/PostsPerPageUnitTest.inc and neither of those have an array key and value without a trailing comma. cc @jrfnl
I agree, this should be reported upstream.
Also note that the AbstractArrayAssignmentRestrictionsSniff
class is one I've barely ever touched (original was created before my time) as the premise of that sniff is iffy to say the least, so it's an abstract which is likely to have quite a few more flaws.
Closing in favour of https://github.com/WordPress/WordPress-Coding-Standards/issues/2211.
Bug Description
There's a false negative when there's no comma after a single item array. For example, this will flag as expected:
However, this won't:
Minimal Code Snippet
This should flag as an error:
Error Code
WordPressVIPMinimum.Performance.NoPaging.nopaging_nopaging
Environment
Use
php -v
andcomposer show
to get versions.Tested Against
master
branch?master
branch of VIPCS.develop
branch of VIPCS.