Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request for referencedClass to allow missing @throws exceptions of specified types to be suppressed #8638

Closed
SignpostMarv opened this issue Oct 31, 2022 · 6 comments · Fixed by #9303
Labels
easy problems Issues that can be fixed without background knowledge of Psalm enhancement Help wanted

Comments

@SignpostMarv
Copy link
Contributor

It'd be nice to be able to ignore missing phpunit-internal @throws docblock issues

relates to #2297

i.e.

<issueHandlers>
    <MissingThrowsDocblock>
        <errorLevel type="suppress">
            <referencedClass name="SeabstianBergmann\RecursionContext\InvalidArgumentException" />
            <referencedClass name="PHPUnit\Framework\Exception" />
        </errorLevel>
    </MissignThrowsDocblock>
</issueHandlers>
@psalm-github-bot
Copy link

Hey @SignpostMarv, can you reproduce the issue on https://psalm.dev ?

@orklah
Copy link
Collaborator

orklah commented Nov 1, 2022

Do you have more details? Did you try and it doesn't work or is it more that refereencedClass can't be used for MissingThrows or something? Can you also post an example of an error?

@SignpostMarv
Copy link
Contributor Author

Do you have more details? Did you try and it doesn't work or is it more that refereencedClass can't be used for MissingThrows or something? Can you also post an example of an error?

MissingThrowsDocblock isn't of the appropriate type, per the xml schema.

An example of the issue in question is whenever you use phpunit and make an assertion, checking for missing throws docblock will raise the seb exception for assertion arguments and the phpunit exception for when assertions fail.

@orklah
Copy link
Collaborator

orklah commented Nov 2, 2022

I think it's just a matter of making MissingThrowsDocblock extends ClassIssue instead of CodeIssue and changing xml category also. This will make __construct take the classname as additional parameter so you'd need to change the single instance creation too.

@orklah orklah added enhancement easy problems Issues that can be fixed without background knowledge of Psalm Help wanted labels Nov 2, 2022
@SignpostMarv
Copy link
Contributor Author

@orklah my concern would be as-written that referencedClass would refer to the class on which the @throws is missing, not the class that is being suggested to add a @throws for 🤔

@orklah
Copy link
Collaborator

orklah commented Nov 4, 2022

IIRC, referencedClass concern the class that is referenced by the Issue (For example, if you want to suppress UndefinedClass the referencedClass refers to the class that is undefined, not the one in which you use the class that happens to be undefined)

So, for me the logic is the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy problems Issues that can be fixed without background knowledge of Psalm enhancement Help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants