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

PHPStan fails to recognize "$a" used as an array key is a string #8642

Closed
mibk opened this issue Jan 3, 2023 · 3 comments
Closed

PHPStan fails to recognize "$a" used as an array key is a string #8642

mibk opened this issue Jan 3, 2023 · 3 comments

Comments

@mibk
Copy link

mibk commented Jan 3, 2023

Bug report

Possibly related to #8635.

Code snippet that reproduces the problem

https://phpstan.org/r/45f19333-c62b-4c58-b22b-57ec0487ab5e

Expected output

Dumped type: non-empty-array<string, string>
@ondrejmirtes
Copy link
Member

ondrejmirtes commented Jan 3, 2023

Please refer to the PHP manual, your expectations are incorrect: https://www.php.net/manual/en/language.types.array.php

Additionally the following key casts will occur...

@mibk
Copy link
Author

mibk commented Jan 3, 2023

You're right! Sorry for misreporting, and thanks for clarification! Have a nice day :)

@github-actions
Copy link

github-actions bot commented Feb 4, 2023

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 Feb 4, 2023
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