narrow tagged union #11473
narrow tagged union
#11473
-
|
I wonder whether a tagged union can/should be narrowed when using see suggested expectations in https://phpstan.org/r/02b86e3d-d5a8-43de-a993-3e6e2b4aa2a2 |
Beta Was this translation helpful? Give feedback.
Answered by
ondrejmirtes
Aug 7, 2024
Replies: 1 comment 1 reply
-
|
Yeah, it definitely should narrow based on which parts of the union match based on getArraySize. Right now PHPStan has some logic about changing |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
staabm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, it definitely should narrow based on which parts of the union match based on getArraySize.
Right now PHPStan has some logic about changing
list<string>intoarray{string, string, string}when asked about count() === 3 so this could be implemented somewhere near that.