-
Notifications
You must be signed in to change notification settings - Fork 651
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
Allow object type to be given to array_walk and array_walk_recursive. #6339
Conversation
Sorry that I did not add any tests to ensure the error won't be triggered anymore with objects now. I wasn't capable of finding how/where to do that. Feel free to enhance this, or giving me tips on how to do it. Regards, |
Not sure if this should be allowed, given that we're already flagging |
I found these snippets: https://psalm.dev/r/9bc231231c<?php
foreach (new stdClass as $_prop) {}
|
@weirdan Do you mean passing an object to In that case, I'm not sure I have the skills to add this error management in Psalm, enhancing the PR. Meanwhile, I think the dictionnary update should be kept, because PHP internal is allowing it: the fact Psalm could consider this as a smell should be defined in the engine, IMHO.
@orklah Thank you for the location of the providers to test this. Nevertheless, I think we need to status if the array_walk of an object is a smell or not, so I could add the providers in either |
I found these snippets: https://psalm.dev/r/9bc231231c<?php
foreach (new stdClass as $_prop) {}
|
I mean there should be some issue emitted, and I care less what that specific issue would be. Right now it's |
I'll add it. |
Done. |
Thanks! |
Fixes #6338