Opened 5 weeks ago
Closed 2 weeks ago
#64211 closed defect (bug) (fixed)
Twenty Eleven: Improve PHP DocBlock compliance with WordPress Documentation Standards
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | 3.2 |
| Component: | Bundled Theme | Keywords: | has-patch |
| Focuses: | docs | Cc: |
Description
The Twenty Eleven theme’s PHP DocBlocks need improvements to fully comply with the WordPress PHP Documentation Standards as outlined in the Developer Handbook.
Changes Needed
- Function summaries – Update to use third-person singular verbs consistently
- Missing @return tags – Add return type documentation where missing
- Missing @param tags – Complete parameter documentation for widget methods
- Sentence structure – Ensure all descriptions end with proper punctuation
Files to Update
src/wp-content/themes/twentyeleven/inc/theme-options.phpsrc/wp-content/themes/twentyeleven/inc/widgets.php
Specific Improvements
inc/theme-options.php
twentyeleven_admin_enqueue_scripts()– Update summary to use third-person singular verbtwentyeleven_theme_options_add_page()– Improve grammar in summarytwentyeleven_theme_options_help()– Add missing DocBlock with@sincetagtwentyeleven_color_schemes()– Add@returntagtwentyeleven_layouts()– Add@returntagtwentyeleven_get_theme_options()– Add@returntagtwentyeleven_theme_options_validate()– Add@returntagtwentyeleven_layout_classes()– Add@returntagtwentyeleven_customize_register()– Fix sentence punctuation
inc/widgets.php
Twenty_Eleven_Ephemera_Widget::update()– Add complete@paramand@returndocumentation
References
Testing
- Verify theme functionality remains unchanged
- Confirm DocBlocks render correctly in Code Reference
- Check PHPDoc parsing compatibility
Change History (10)
#2
@
5 weeks ago
- Milestone changed from Awaiting Review to Future Release
- Type changed from enhancement to defect (bug)
- Version set to 3.2
This ticket was mentioned in PR #10482 on WordPress/wordpress-develop by @huzaifaalmesbah.
5 weeks ago
#3
- Keywords has-patch added; needs-patch removed
Updates PHP DocBlocks in Twenty Eleven theme to better align with WordPress PHP Documentation Standards.
Changes include:
- Use third-person singular verbs in function summaries
- Add missing @return tags for better type documentation
- Complete @param documentation for widget methods
- Ensure proper sentence structure with punctuation
- Add missing DocBlock for twentyeleven_theme_options_help()
Files modified:
- inc/theme-options.php: Updated 9 function DocBlocks
- inc/widgets.php: Enhanced widget update() method documentation
@huzaifaalmesbah commented on PR #10482:
4 weeks ago
#5
Thanks for the detailed review and version history notes @sabernhardt I’ve updated the @since tags accordingly and reviewed your suggestions for Twenty_Eleven_Ephemera_Widget::update(). Really appreciate your guidance!
#7
@
2 weeks ago
I reviewed inc/widgets.php and found that the @param tags are now in place, but several methods are still missing @return tags. Here’s the list for reference:
widget() → should have @return void
update() → should have @return array
#9
@
2 weeks ago
@ravichudasama01 For the widget() method: Core doesn't typically use @return void, except in third party libraries. The exception to this is when the function can return void or a non-void value, for example do_enclose() has @return void|false. I think core should update any such uses of void to return null instead, in any case.
As for the update method, I see the phpdoc being added? See file in PR.
Thanks for detailing the gaps. I’ve reviewed the code in inc/theme-options.php and inc/widgets.php and can confirm the issue is valid. Several functions are missing @return/@param tags.