Skip to content

How to dynamically narrow a union type on a class property? #10791

Closed Answered by ondrejmirtes
nilmerg asked this question in Support
Discussion options

You must be logged in to vote

Only idea I have for you: https://phpstan.org/r/7edd9a15-7d4d-4b72-8ecc-2ff57a7a2238

Or make two different Foo classes - one for A and another for B.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nilmerg
Comment options

Answer selected by nilmerg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants