-
Notifications
You must be signed in to change notification settings - Fork 529
Fix inferred union types for Ds Map::get() and Map::remove() #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
No idea what's wrong, What happens if you pass in |
Oh, I realized what's wrong. There's this extension: https://github.com/phpstan/phpstan-src/blob/master/src/Type/Php/DsMapDynamicReturnTypeExtension.php You can try to remove it and see what happens. |
You're right. Would it make sense to drop it then? Like in the commit 👆 |
OutOfBounds exception is thrown if I remember correctly |
You're right. So the |
Looks fine, thank you! |
👋 can you guide me with this please?
I'm passing
Map<int, int|string>
into the function.However, return type of
get(0)
call on the map is resolved asint
. I'd expectint|string
.Map stub is
So I believe I'm saying that
TValue
isint|string
.Map::get()
's signature isso
get(0)
should returnTValue
(int|string
). Or not? Thanks!