Fix PHPDoc inconsistencies and remove duplicate code#155
Fix PHPDoc inconsistencies and remove duplicate code#155galatanovidiu merged 2 commits intotrunkfrom
Conversation
- Fix @SInCE n.e.x.t. trailing periods across 4 files (6 occurrences) - Fix placeholder @see URLs in 3 Ability classes (your-repo -> WordPress) - Add missing PHPDoc block to McpServer::get_error_handler() - Add @SInCE 0.1.0 to wp_mcp_init action in Plugin.php - Fix @since/@param ordering on 3 hooks to follow WordPress standards - Add @internal annotation to HttpRequestHandler class - Remove duplicate categorize_error() from RequestRouter — use McpObservabilityHelperTrait::categorize_error() instead
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #155 +/- ##
=========================================
Coverage 87.74% 87.74%
Complexity 1230 1230
=========================================
Files 54 54
Lines 3990 3990
=========================================
Hits 3501 3501
Misses 489 489
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR focuses on cleanup work discovered during the v0.5.0 review: standardizing PHPDoc (@since formatting and ordering), improving annotations/docs links, clarifying internal API surface, and removing duplicate error-categorization logic in favor of a shared helper.
Changes:
- Standardize
@since n.e.x.tformatting (remove trailing periods) and reorder hook PHPDoc to match WordPress standards. - Add missing PHPDoc blocks/annotations (
McpServer::get_error_handler(),wp_mcp_inithook@since,@internalonHttpRequestHandler). - Remove duplicated
categorize_error()fromRequestRouterand route categorization throughMcpObservabilityHelperTrait.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| includes/Transport/Infrastructure/RequestRouter.php | Removes duplicated categorize_error() and switches to shared helper for error category tagging. |
| includes/Transport/Infrastructure/HttpRequestHandler.php | Adds @internal and fixes @since formatting. |
| includes/Transport/Infrastructure/HttpRequestContext.php | Fixes @since formatting. |
| includes/Plugin.php | Adds @since tag to wp_mcp_init action PHPDoc. |
| includes/Handlers/Initialize/InitializeHandler.php | Fixes @since formatting. |
| includes/Domain/Tools/RegisterAbilityAsMcpTool.php | Reorders filter PHPDoc so @since precedes @param. |
| includes/Domain/Resources/RegisterAbilityAsMcpResource.php | Reorders filter PHPDoc so @since precedes @param (two hooks). |
| includes/Core/McpVersionNegotiator.php | Fixes @since formatting in class/method PHPDoc. |
| includes/Core/McpServer.php | Adds missing PHPDoc block to get_error_handler(). |
| includes/Abilities/GetAbilityInfoAbility.php | Replaces placeholder @see URL. |
| includes/Abilities/ExecuteAbilityAbility.php | Replaces placeholder @see URL. |
| includes/Abilities/DiscoverAbilitiesAbility.php | Replaces placeholder @see URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace broken @see URLs pointing to non-existent docs/security.md with the canonical WordPress security reference. Restore private categorize_error() to preserve instanceof-based subclass matching that the shared trait's get_class() approach would miss.
Why
The v0.5.0 code review found 8 documentation and annotation issues: inconsistent
@sincetags, placeholder URLs left from scaffolding, a missing PHPDoc block, duplicated logic, and a missing@internalannotation. None of these affect runtime behavior.What
PHPDoc fixes:
@since n.e.x.t.trailing periods in 4 files (6 occurrences) — standardize to@since n.e.x.tMcpServer::get_error_handler()— the only getter without one@since 0.1.0towp_mcp_initaction inPlugin.php— the only hook missing a@sincetag@since/@paramordering on 3 hooks (mcp_adapter_tool_name,mcp_adapter_resource_uri,mcp_adapter_resource_name) —@sincebefore@paramper WordPress PHPDoc standardsAnnotation fixes:
@seeURLs in 3 Ability classes —your-repo→WordPress@internalannotation toHttpRequestHandler— clarifies it is not part of the public APIDead code removal:
categorize_error()fromRequestRouter— useMcpObservabilityHelperTrait::categorize_error()instead (identical logic, one source of truth)Test plan