Bug report / Feature Request? I'm not sure…
It seems that under some conditions, PHPStan generalizes a "finite" (not sure what the right term is) type to an "infinite" one.
Code snippet that reproduces the problem
https://phpstan.org/r/1d06b068-483f-483e-a0cf-ef0ff3a29ade
Expected output
No errors.