Skip to content

Commit 0a45a6c

Browse files
Docs: Add missing void to DocBlock @return types.
This commit adds missing `void` return types to (parent) methods that can ''explicitly'' return `void` as one of their conditional paths. Addressed methods: * `WP_Privacy_Requests_Table::column_status()` * `WP_Recovery_Mode::handle_error()` * `WP_Widget::form()` — unlike the others, it's the ''child'' classes that return `void` when the method is correctly implemented. Note: `@return void` (where `void` is the single type returned) should not be used outside the default bundled themes and the PHP compatibility shims included in WordPress Core, as per the [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/ documentation standards]. Follow-up to [30382], [42967], [43256], [44973], [45448]. Props justlevine. See #52217, #62281. git-svn-id: https://develop.svn.wordpress.org/trunk@59336 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b1b5761 commit 0a45a6c

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/wp-admin/includes/class-wp-privacy-requests-table.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ public function column_cb( $item ) {
430430
* @since 4.9.6
431431
*
432432
* @param WP_User_Request $item Item being shown.
433-
* @return string Status column markup.
433+
* @return string|void Status column markup. Returns a string if no status is found,
434+
* otherwise it displays the markup.
434435
*/
435436
public function column_status( $item ) {
436437
$status = get_post_status( $item->ID );

src/wp-includes/class-wp-recovery-mode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ public function is_initialized() {
161161
* @since 5.2.0
162162
*
163163
* @param array $error Error details from `error_get_last()`.
164-
* @return true|WP_Error True if the error was handled and headers have already been sent.
165-
* Or the request will exit to try and catch multiple errors at once.
166-
* WP_Error if an error occurred preventing it from being handled.
164+
* @return true|WP_Error|void True if the error was handled and headers have already been sent.
165+
* Or the request will exit to try and catch multiple errors at once.
166+
* WP_Error if an error occurred preventing it from being handled.
167167
*/
168168
public function handle_error( array $error ) {
169169

src/wp-includes/class-wp-widget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function update( $new_instance, $old_instance ) {
138138
* @since 2.8.0
139139
*
140140
* @param array $instance The settings for the particular instance of the widget.
141-
* @return string Default return is 'noform'.
141+
* @return string|void Default return is 'noform'.
142142
*/
143143
public function form( $instance ) {
144144
echo '<p class="no-options-widget">' . __( 'There are no options for this widget.' ) . '</p>';

0 commit comments

Comments
 (0)