How to dynamically narrow a union type on a class property? #10791
-
Given the following: https://phpstan.org/r/c67364ca-0153-440a-92c3-edb5075bf3d2 How can I solve the error? I tried object shape syntax, but since my type is not |
Beta Was this translation helpful? Give feedback.
Answered by
ondrejmirtes
Mar 27, 2024
Replies: 1 comment 1 reply
-
Only idea I have for you: https://phpstan.org/r/7edd9a15-7d4d-4b72-8ecc-2ff57a7a2238 Or make two different |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nilmerg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only idea I have for you: https://phpstan.org/r/7edd9a15-7d4d-4b72-8ecc-2ff57a7a2238
Or make two different
Foo
classes - one forA
and another forB
.