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

Inconsistent behaviour of array_shift() return type #3548

Closed
dktapps opened this issue Jun 27, 2020 · 2 comments
Closed

Inconsistent behaviour of array_shift() return type #3548

dktapps opened this issue Jun 27, 2020 · 2 comments
Labels
Milestone

Comments

@dktapps
Copy link
Contributor

dktapps commented Jun 27, 2020

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/531108ab-4b3a-4354-bb59-36261cc64140

in phpstan 0.12.31, this odd behaviour... I don't understand why it works when returning directly vs assigning to a variable.

Expected output

Neither case should report an error because the array is definitely non-empty.

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Jul 27, 2020
@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
@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

2 participants