Automattic / VIP-Coding-Standards

PHP_CodeSniffer ruleset to enforce WordPress VIP coding standards.
https://wpvip.com/documentation/how-to-install-php-code-sniffer-for-wordpress-com-vip/
Other
237 stars 40 forks source link

Performance/WPQueryParams: defer to the parent sniff #780

Closed jrfnl closed 1 year ago

jrfnl commented 1 year ago

This commit removes the custom token target + custom logic from this sniff in favour of deferring to the logic in the parent sniff - as discussed in #589.

To that end, the keys which were handled in the custom process_token() logic have now been added to the getGroups() array.

As the logic for whether or not an error message should be thrown is different for each group, an extra 'name' key has been added to each group to allow the callback() function to distinguish what group the detected key came from.

It also updates the error message being used to better cover both keys being looked for, as well as mention this only applies when the array is passed to get_posts() (in an attempt to remove some of the confusion reported in #672).

Note: this is a BC-break as the error codes for the two out of the three existing checks change!

Fixes #594