Performance/WPQueryParams: defer to the parent sniff #780
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thegetGroups()
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 thecallback()
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!
WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn
is nowWordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in
.WordPressVIPMinimum.Performance.WPQueryParams.SuppressFiltersTrue
is nowWordPressVIPMinimum.Performance.WPQueryParams.SuppressFilters_suppress_filters
.WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
error code, as introduced in WPQueryParams: sniff forexclude
array key being set #589, remains the same.Fixes #594