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

Null coalesce assignment to an array with optional key doesn't work #3276

Closed
Daeroni opened this issue May 10, 2020 · 2 comments
Closed

Null coalesce assignment to an array with optional key doesn't work #3276

Daeroni opened this issue May 10, 2020 · 2 comments

Comments

@Daeroni
Copy link
Contributor

Daeroni commented May 10, 2020

Bug report

If an array has been documented with an optional key, and then a null coalesce assignment is used to make sure the key exists, PHPStan doesn't realise that the key always exists in the array after the assignment.

Code snippet that reproduces the problem

https://phpstan.org/r/91be56c3-ab29-44e8-a2d3-059d3a7f9652

Expected output

No errors

@ondrejmirtes
Copy link
Member

Fixed, thank you! phpstan/phpstan-src@55c8a14

@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 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants