Fix PHPStan error with wp_insert_user() which causes it to hang#10953
Fix PHPStan error with wp_insert_user() which causes it to hang#10953westonruter wants to merge 4 commits intoWordPress:trunkfrom
wp_insert_user() which causes it to hang#10953Conversation
Co-authored-by: Weston Ruter <westonruter@gmail.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
@peterwilsoncc Hey! I'm requesting your review because this appears to have been related to your commit in r60650. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
peterwilsoncc
left a comment
There was a problem hiding this comment.
@westonruter These changes look fine to me and I'm happy enough for them to go in.
My one nagging concern is about how real and issue this is, and whether the code is being added for the benefit of tooling over users.
I guess my question comes down to, are we better off changing @param array|object|WP_User $userdata to @param array|stdClass|WP_User $userdata?
That said, I'm happy to use your judgement. I have verified that prevents phpstan from hanging.
|
@peterwilsoncc thank you. My guess is that 99.99999% of the time, a It's also true that PHPStan probably shouldn't be struggling so hard here. But I still think this is an overall improvement since it improves type safety, ensuring that down the road the function is guaranteed to always be working with an array as it expects to be. |
…to an array. This fixes an issue where PHPStan hangs when analyzing the containing `users.php` file. Developed in #10953 Follow-up to [60650]. Props westonruter, justlevine, peterwilsoncc. See #64238, #61175. git-svn-id: https://develop.svn.wordpress.org/trunk@61656 602fd350-edb4-49c9-b593-d223f7449a82
wp_insert_post() which causes it to hangwp_insert_user() which causes it to hang
…to an array. This fixes an issue where PHPStan hangs when analyzing the containing `users.php` file. Developed in WordPress/wordpress-develop#10953 Follow-up to [60650]. Props westonruter, justlevine, peterwilsoncc. See #64238, #61175. Built from https://develop.svn.wordpress.org/trunk@61656 git-svn-id: http://core.svn.wordpress.org/trunk@60967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The commits in this PR were cherry-picked from #10419 for Core-61175.
See #10419 (comment):
Trac ticket: https://core.trac.wordpress.org/ticket/64238
Use of AI Tools
n/a
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.