Skip to content
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

Simplify assertions generated by an array_key_exists check #8763

Merged
merged 1 commit into from Nov 25, 2022

Conversation

muglug
Copy link
Collaborator

@muglug muglug commented Nov 25, 2022

There are three forms of array_key_exists that are useful for Psalm's inference:

array_key_exists('known_key', $array_with_unknown_keys);
array_key_exists('known_key', $array_shape_with_possibly_undefined_key);
array_key_exists($unknown_key, $array_shape_with_known_keys);

In the third example we were generating one more assertion than was necessary. This should simplify the calculation, and fix #8741

@muglug muglug added the release:fix The PR will be included in 'Fixes' section of the release notes label Nov 25, 2022
@muglug muglug marked this pull request as ready for review November 25, 2022 16:37
@muglug muglug merged commit a0e4468 into vimeo:master Nov 25, 2022
@muglug muglug deleted the muglug-simpler-array-key-exists-check branch November 25, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simple example takes over 64 seconds to scan
1 participant