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

array_shift() is not understood #2611

Closed
szepeviktor opened this issue Nov 24, 2019 · 7 comments
Closed

array_shift() is not understood #2611

szepeviktor opened this issue Nov 24, 2019 · 7 comments
Labels
Milestone

Comments

@szepeviktor
Copy link
Contributor

Bug report

I think $item contains $collection which is not null.

Call to function is_array() with null will always evaluate to false.

Code snippet that reproduces the problem

https://phpstan.org/r/3e7005bc-8e9c-4955-bacd-f6dad8b11ff0

Expected output

[OK] No errors

@szepeviktor
Copy link
Contributor Author

@muglug
Copy link
Contributor

muglug commented Nov 26, 2019

I think related to #1723, #1722.

@szepeviktor since you're a contributor, you may be able to fix these bugs. Happy to help you – I've had this working in Psalm for a while.

@szepeviktor
Copy link
Contributor Author

Closing favor of #1723

@ondrejmirtes
Copy link
Member

These are two separate issues I think. One involves general arrays and the other literal arrays.

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Dec 30, 2019
@ondrejmirtes
Copy link
Member

Fixed by: phpstan/phpstan-src#333

ondrejmirtes added a commit that referenced this issue Oct 9, 2020
phpstan/phpstan-src@ae26b54 Fix type inference in assignment with side-effects
phpstan/phpstan-src@81b2385 Add test for fixed bug #3875
phpstan/phpstan-src@f32a30f Add test for fixed bug #2611
phpstan/phpstan-src@5ef1f3a Add test for fixed bug #3548
@szepeviktor
Copy link
Contributor Author

Thank you.

@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 May 11, 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

3 participants