Skip to content

Conversation

@herndlm
Copy link
Contributor

@herndlm herndlm commented Feb 3, 2022

No description provided.

@herndlm
Copy link
Contributor Author

herndlm commented Feb 3, 2022

This is currently not working, the SpecifiedTypes look a bit odd. e.g. in case of passing mixed to isMap:
image

Could this be a bug on type specification or can you see something that I'm doing wrong @ondrejmirtes?

If i use an array as input (passing mixed[]) it starts working suddenly, not sure why. e.g. with an array passed
image

I kept staring at the expression and compared it to something generated with php-parser, but it looks fine to me. Well, I'll take another look later..

ah yeah and the expression type handling in general is fine of course: https://phpstan.org/r/43b72845-d649-4a60-8953-afc24cfaaf39

UPDATE: ok, the main problem seems to be the independent type specification of the left and right expression. And the right one kind of already needs the info from the left one (that the input is an array). without it, it finds (array|null) as return type of array_filter being called with mixed hmm 🤔

UDPATE2: hah, the resolved type in the scope is odd, after specifiny the left expression. maybe that's it?! it seems to be somewhere overriden or does not remember it's value. I was interrupted and need to debug this deeper later..
image

@herndlm herndlm marked this pull request as ready for review February 15, 2022 19:54
@ondrejmirtes ondrejmirtes merged commit 086010d into phpstan:master Feb 15, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@herndlm herndlm deleted the support-is-map branch April 8, 2022 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants