-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
I have function with generic callable argument - using generics I describe that the function returns whatever the callback returns.
The problem is when I:
- pass the callback as anonymous function
- which actually has native return type hint
- but throws instead
Code snippet that reproduces the problem
https://phpstan.org/r/d0bf24b0-f404-43f0-b000-1c409ae19aa1#
Expected output
I think the native return type hint shouldn't be overridden by throwing (which I guess resolves it to never), and therefore the snippet above shouldn't report any error. If you think otherwise, could you please explain the philosophy behind that? I've experienced this new behaviour when updating from 67 to 69.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels