Replies: 2 comments 1 reply
-
|
Hello, please show this as an example on phpstan.org/try with some |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
This is now possible thanks to: phpstan/phpstan-src#5837 |
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.
-
Hi, I'm writing a simple function which should take a list of values of two distinct types along with a callable which can distinguish between those types, and the function should return two lists with the values partitioned by their type. Basically this:
The problem is obviously the return type of the
$predicatecallable, which isbool, but it should be something like$value is T0, which is what one would do in e.g. TypeScript. PhpStan seems to use the@phpstan-assert-if-trueannotation for this purpose for annotating function / method declarations, but I can't see any obvious ways of applying that to the signature of$predicate. Is there something I'm missing, or is this simply not possible? Thanks for any input!Beta Was this translation helpful? Give feedback.
All reactions