Bug report
See example here: https://phpstan.org/r/bdba8ec5-b1df-4ff2-a5d3-e3c0bca0b890
Note that changing the return type to Collection<int, object{ch: string, x: Collection<0|1|2|3, object{t: string}>}> resolves the issue.
Code snippet that reproduces the problem
https://phpstan.org/r/bdba8ec5-b1df-4ff2-a5d3-e3c0bca0b890
Expected output
It feels like this is being too overzealous in terms of constraining the generic based on what is ultimately an implementation detail.
Did PHPStan help you today? Did it make you happy in any way?
No response
Bug report
See example here: https://phpstan.org/r/bdba8ec5-b1df-4ff2-a5d3-e3c0bca0b890
Note that changing the return type to
Collection<int, object{ch: string, x: Collection<0|1|2|3, object{t: string}>}>resolves the issue.Code snippet that reproduces the problem
https://phpstan.org/r/bdba8ec5-b1df-4ff2-a5d3-e3c0bca0b890
Expected output
It feels like this is being too overzealous in terms of constraining the generic based on what is ultimately an implementation detail.
Did PHPStan help you today? Did it make you happy in any way?
No response