-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Support question
I opened an issue about the @throws annotation #3350 and the solution was @throws void.
But there is multiple issue with this:
- it's not valid according to phpDoc definition of
@throws-voiddoesn't extendThrowable, - it's hard to remove only some exceptions, e.g. would this be valid?
interface Foo {
/**
* @throws FirstException
* @throws SecondException
*/
function bar(): void;
}
class SomeFoo implements Foo {
/**
* @throws void
* @throws SecondException
*/
public function bar(): void
{
// only throws SecondException, not FirstException
}
}Also, this is correct for phpstan
https://phpstan.org/r/55fd90ce-a9f6-4a55-b9f5-d0a1cec96d02
But this conflict with
Phan: https://phan.github.io/demo/?code=%3C%3Fphp%0A%0Ainterface+Foo+%7B%0A++++%2F**%0A+++++*+%40throws+SomeException%0A+++++*%2F%0A++++function+bar%28%29%3A+void%3B%0A%7D%0A%0Aclass+SomeFoo+implements+Foo+%7B%0A++++%2F**%0A+++++*+%40throws+void%0A+++++*%2F%0A++++public+function+bar%28%29%3A+void%0A++++%7B%0A++++++++%2F%2F+no+throws%0A++++%7D%0A%7D
Psalm: https://psalm.dev/r/87f2f3634c
which report @throws void as invalid.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels