-
-
Notifications
You must be signed in to change notification settings - Fork 947
T[K] return type not reducing to a single type from array shape #7788
Copy link
Copy link
Closed
phpstan/phpstan-src
#1623Description
Bug report
Code snippet that reproduces the problem
https://phpstan.org/r/ede7535a-4964-4b38-bbfe-c5d5c8cc1571
Expected output
The expectation was that the dumped type would result in 30|0 or int if it's generalised. Similar to psalm
Instead what we're getting is a union of all the types in the array, which then requires doc blocks or assertions I was hoping to avoid.
Did PHPStan help you today? Did it make you happy in any way?
I've been able to wipe out a host of potential bugs while also providing more safety around generic classes, so yeah, this has made me very happy 😄
Side note, I'd be happy to take a stab at looking at resolving this with some pointers, I've tried to grok the codebase but couldn't nail down the right place to look for something like this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels