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 PR introduces rule error identifiers for the following rules:
IsWpErrorRule
HookDocsRule
HookCallbackRule
The identifiers are sourced from the PHPStan code base, except for
paramTag.count
. PHPStan does not have a corresponding error identifier for this; there isarguments.count
, but this handles arguments, not tags. If anyone has better ideas on how to name the identifiers, I am happy to change them.For
HookDocsRule
andHookCallbackRule
, this PR replaces the try-catch blocks with checks for existing errors in an array holding the errors and removes the exceptions since they are no longer used. Keeping the exceptions would have required different exceptions for each error identifier to retrieve the correct identifier if the exception is thrown.Changes not related to error identifiers:
HookCallbackRule::getAcceptedArgs()
.HookCallbackRule::validateActionReturnType()
andHookCallbackRule::validateFilterReturnType()
on the return type instead of on the callable acceptor.HookCallbackRule::isNever()
toHookCallbackRule::isExplicitNever()
to be more explicit about the method's functionality.