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

Unsetting array keys after checking their existence give strange behaviour #3544

Closed
BackEndTea opened this issue Jun 26, 2020 · 3 comments
Closed
Labels
Milestone

Comments

@BackEndTea
Copy link
Contributor

Bug report

Checking if an array key exist, and then throwing an exception/ returning when it does not makes it so the array can not be empty, even when it is unset

Code snippet that reproduces the problem

https://phpstan.org/r/74c5fd68-3156-4618-9b1e-a7db1cf3f0f6

Expected output

I'd expect no errors here, as the array can be empty

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Jun 28, 2020
@BackEndTea
Copy link
Contributor Author

I recently upgraded to the latest phpstan version, and this specific issue is no longer here, so i'm assuming it is fixed.

@ondrejmirtes
Copy link
Member

We still need a regression test and an investigation into what actually fixed the case and if it's really solved :)

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants