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_merge lost non-empty-string keys type #6927

Closed
Guuzen opened this issue Mar 28, 2022 · 4 comments
Closed

array_merge lost non-empty-string keys type #6927

Guuzen opened this issue Mar 28, 2022 · 4 comments
Labels
Milestone

Comments

@Guuzen
Copy link

Guuzen commented Mar 28, 2022

Bug report

array_merge lose information about input arrays non-empty-string keys and infer result as just string.

Code snippet that reproduces the problem

https://phpstan.org/r/2c50337c-f1d4-4e79-b230-de7cf21a666f

Expected output

Result key should be non-empty-string.

@Guuzen
Copy link
Author

Guuzen commented Mar 28, 2022

Is it related to #5846 ?

@phpstan-bot
Copy link
Contributor

@Guuzen After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-14: Dumped type: array<string, string>
+14: Dumped type: array<non-empty-string, string>
Full report
Line Error
14 Dumped type: array<non-empty-string, string>

@ondrejmirtes
Copy link
Member

Fixed by phpstan/phpstan-src#1135

@github-actions
Copy link

github-actions bot commented May 1, 2022

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 1, 2022
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