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

unexpected non-empty-array error #4844

Closed
staabm opened this issue Apr 12, 2021 · 3 comments
Closed

unexpected non-empty-array error #4844

staabm opened this issue Apr 12, 2021 · 3 comments
Labels
Milestone

Comments

@staabm
Copy link
Contributor

staabm commented Apr 12, 2021

Bug report

I am wondering whether its a bug, that a array like array<string, string> violates a non-empty-array type

Code snippet that reproduces the problem

https://phpstan.org/r/cbd1dc4a-8ace-4c0e-98fe-aea5561b9e63
-> expected no error

when using non-empty-array<string, mixed> it works without errors, like expected
see https://phpstan.org/r/e419f103-0573-44b7-964a-4a89a833b911

@staabm staabm changed the title unexpected non-empty-array shape error unexpected non-empty-array error Apr 12, 2021
@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Apr 12, 2021
@phpstan-bot
Copy link
Contributor

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

@@ @@
-15: Parameter #1 $attributes of method HelloWorld::update_attributes() expects array&nonEmpty, array<string, string> given.
 27: Method HelloWorld::update_attributes() has parameter $attributes with no value type specified in iterable type array.
Full report
Line Error
27 Method HelloWorld::update_attributes() has parameter $attributes with no value type specified in iterable type array.

@phpstan-bot
Copy link
Contributor

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

@@ @@
-15: Parameter #1 $attributes of method HelloWorld::update_attributes() expects array<string, mixed>&nonEmpty, array<string, string> given.
+No errors

@github-actions
Copy link

github-actions bot commented Aug 5, 2021

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 Aug 5, 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