Generic (conditional) type behaviour with anonymous function #11055
-
I'd like to discuss two separate problems (on PHP 8.3) here:
|
Beta Was this translation helpful? Give feedback.
Answered by
ondrejmirtes
May 18, 2024
Replies: 1 comment
-
You need this instead: https://phpstan.org/r/59b020d9-976e-43ac-8a20-c5c0b3284336 It's one of the examples in the docs: https://phpstan.org/blog/generics-by-examples#function-accepts-any-string%2C-but-returns-object-of-the-same-type-if-it%E2%80%99s-a-class-string The fact that first-class callable doesn't work is a bug, please open a bug report, thanks. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
uuf6429
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need this instead: https://phpstan.org/r/59b020d9-976e-43ac-8a20-c5c0b3284336
It's one of the examples in the docs: https://phpstan.org/blog/generics-by-examples#function-accepts-any-string%2C-but-returns-object-of-the-same-type-if-it%E2%80%99s-a-class-string
The fact that first-class callable doesn't work is a bug, please open a bug report, thanks.