-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Abilities API: Improve inline documentation for public methods #10412
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
Conversation
|
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the inline documentation for the Abilities API by adding comprehensive file header documentation and improving PHPDoc blocks for all public functions. The changes provide developers with detailed guidance on API usage, including naming conventions, schema definitions, callbacks, REST API integration, and best practices.
Key changes:
- Added extensive file header documentation with overview, usage guide, and examples
- Enhanced all function PHPDocs with detailed descriptions, practical code examples, and improved parameter documentation
- Added cross-references between related functions
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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. |
| * @return WP_Ability|null The unregistered ability instance on success, null on failure. | ||
| * @param string $name The name of the ability to unregister, including namespace prefix | ||
| * (e.g., 'my-plugin/my-ability'). | ||
| * @return WP_Ability|null The unregistered ability instance on success, `null` on failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * @return WP_Ability|null The unregistered ability instance on success, `null` on failure. | |
| * @return WP_Ability|null The unregistered ability instance on success, null on failure. |
Nit-pick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why you suggest to remove markdown formatting here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the consistency as WP docs use null on failure in it's docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found multiple places in the code when null is wrapped with backticks, example:
wordpress-develop/src/wp-includes/html-api/class-wp-html-processor.php
Lines 960 to 963 in 70ca20b
| * @return bool|null Whether to expect a closer for the currently-matched node, | |
| * or `null` if not matched on any token. | |
| */ | |
| public function expects_closer( ?WP_HTML_Token $node = null ): ?bool { |
This is how it looks in the developer docs:
https://developer.wordpress.org/reference/classes/wp_html_processor/expects_closer/#return
I personally prefer it highlighted this way.
JasonTheAdams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good docs! A couple small suggestions.
westonruter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a couple suggestions for issues that Gemini helped identify.
863cef1 to
a8381b7
Compare
a8381b7 to
0392cd8
Compare
This was discussed in #9410 and decided to defer until after beta1. Fleshing out the phpdocs for the extender functions in https://core.trac.wordpress.org/browser/trunk/src/wp-includes/abilities-api.php should make it easier for people working with the abilities API Developed in #10412. Follw-up [61032]. Props jorbin, gziolo, mukesh27, jason_the_adams, westonruter. Fixes #64134. git-svn-id: https://develop.svn.wordpress.org/trunk@61067 602fd350-edb4-49c9-b593-d223f7449a82
This was discussed in WordPress/wordpress-develop#9410 and decided to defer until after beta1. Fleshing out the phpdocs for the extender functions in https://core.trac.wordpress.org/browser/trunk/src/wp-includes/abilities-api.php should make it easier for people working with the abilities API Developed in WordPress/wordpress-develop#10412. Follw-up [61032]. Props jorbin, gziolo, mukesh27, jason_the_adams, westonruter. Fixes #64134. Built from https://develop.svn.wordpress.org/trunk@61067 git-svn-id: http://core.svn.wordpress.org/trunk@60403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This was discussed in WordPress/wordpress-develop#9410 and decided to defer until after beta1. Fleshing out the phpdocs for the extender functions in https://core.trac.wordpress.org/browser/trunk/src/wp-includes/abilities-api.php should make it easier for people working with the abilities API Developed in WordPress/wordpress-develop#10412. Follw-up [61032]. Props jorbin, gziolo, mukesh27, jason_the_adams, westonruter. Fixes #64134. Built from https://develop.svn.wordpress.org/trunk@61067 git-svn-id: https://core.svn.wordpress.org/trunk@60403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Trac ticket: https://core.trac.wordpress.org/ticket/64134
Enhances developer experience with comprehensive file header covering API overview, step-by-step usage guide, and best practices. Expands function PHPDocs with practical code examples, detailed parameter descriptions, and cross-references between related functions. Standardizes formatting and improves consistency throughout.
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.