Documentation for add_meta_boxes hook specifies incomplete parameter types
Issue Description
The documentation page for the add_meta_boxes hook says that the second parameter is a WP_Post type, but it is sometimes a WP_Comment, and is sometimes a stdClass which leads to fatal errors if developers hook a function to add_meta_boxes with typed parameters.
A WP_Comment is passed to the hook in the Edit Comment screen, for example: /wp-admin/comment.php?action=editcomment&c=12332
A `stcClass is passed to the hook in the Edit lInk screen, for example: /wp-admin/link.php?action=edit&link_id=5
The possibility that the second parameter could be a WP_Comment was reported and fixed in Trac 6 years ago, but maybe the fix there never got migrated to developer.wordpress.org. I haven't found any reference to the possibility of the parameter being a stdClass.
URL of the Page with the Issue
https://developer.wordpress.org/reference/hooks/add_meta_boxes/
Section of Page with the issue
The function definition at the top of the page and the parameter descriptions include the erroneous WP_Post type.
Why is this a problem?
PHP is moving more towards typed function definitions, and if developers try to hook a function to add_meta_boxes that has a WP_Post type for the second argument, (like I did!), they get a fatal error.
Suggested Fix
Specify that the second argument may be a WP_Post, WP_Comment, or stcClass.
Heads up @WordPress/docs-issues-coordinators, we have a new issue open. Time to use 'em labels.
/assign
Hey @nishitapandya, thanks for your interest in this issue! 🍪🍪🍪
If you have any questions, do not hesitate to ask them in our #docs Slack channel.
Enjoy and happy contributing ❤️