Skip to content

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Sep 4, 2022

Closes phpstan/phpstan#7898

Looks like the type comparison was mixed up here, I'm surprised that this wasn't noticed so far and wonder if this has more implications 🤔 But I have to admit that this was more a lucky guess, I did not fully understand it yet tbh.

UPDATE: I think I got it, basically it correctly skips the removal of the other arrays same key now, if it's value is a narrower type. before it would do it the other way around which could lead to a false-positive true return and therefore information loss, if I'm right.

@herndlm herndlm marked this pull request as ready for review September 4, 2022 17:59
@ondrejmirtes ondrejmirtes merged commit 06bd752 into phpstan:1.8.x Sep 4, 2022
@ondrejmirtes
Copy link
Member

Perfect, thank you!

@herndlm herndlm deleted the fix-7898 branch September 4, 2022 18:29
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.

PHPStan 1.8.3 - Array shape guessing is missing some keys (array_key_exists/isset is alway falsy even if not)
2 participants