conditional throw #11551
SignpostMarv
started this conversation in
Ideas
conditional throw
#11551
Replies: 1 comment
-
|
p.s. yes I realise the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It's been a while since I delved into the guts of psalm, so I'm wondering if this is one of the traditional "Marv's having ideas that are too weird again" issues, or if it's actually a good idea;
off-label docblock theory:
@throwswith existing conditional return syntax withnevertype to indicate that a method will never throw given a condition@throwswith existing conditional return syntax to indicate which exception will be thrown for a given type[MissingThrowsDocblock](https://psalm.dev/169)thrown if conditional@throwssays it is impossible to throwoptional:
[UncaughtThrowInGlobalScope](https://psalm.dev/docs/running_psalm/issues/UncaughtThrowInGlobalScope/) in some circumstances- i.e. if@throwsconditionally resolves toclass A extends Exception{}|class B extends Exception{}, andtry{} catch(A $e) {}is used in a situation where the conditional throw indicates it would _never_throw B`Happy to file this as an issue after working through any kinks in the idea here first, also happy to work on it myself (re: past contributions) if I can be given the right pointers as to where to go digging around 😅
https://psalm.dev/r/7e8f3b86fb
Beta Was this translation helpful? Give feedback.
All reactions