You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Squiz.Commenting.FunctionCommentThrowTag.WrongNumber is only triggered if at least one throw is present in the function body, and a wrong number of @throws docbloc statements is present.
It is not triggered, if a wrong number of @throws docbloc statements is present but no throw statement is present in the function body.
Minimal Code Snippet
/**
* Short Description
*
* @throws \AnException Comment.
* @throws \AnotherException Comment.
*/
function check_it() {
throw new \AnException(
//do things
);
}
Above will trigger the error.
However, if you do this, the error is not triggered:
/**
* Short Description
*
* @throws \AnException Comment.
* @throws \AnotherException Comment.
*/
function check_it() {
}
smileBeda
changed the title
Squiz.Commenting.FunctionCommentThrowTag.WrongNumber not triggered if no throws statement in function body
Squiz.Commenting.FunctionCommentThrowTag.WrongNumber not triggered if no throw statement in function body
Oct 12, 2023
Bug Description
Squiz.Commenting.FunctionCommentThrowTag.WrongNumber
is only triggered if at least onethrow
is present in the function body, and a wrong number of@throws
docbloc statements is present.It is not triggered, if a wrong number of
@throws
docbloc statements is present but nothrow
statement is present in the function body.Minimal Code Snippet
Above will trigger the error.
However, if you do this, the error is not triggered:
Error Code
Squiz.Commenting.FunctionCommentThrowTag.WrongNumber
Environment
PHP 8, WPCS 3.x, all dependencies updated to latest.
No dev.
The text was updated successfully, but these errors were encountered: