From 5ef0c89c61ead68c3ea820797d2bb53ceb61646e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 2 Nov 2024 15:01:19 +0000 Subject: [PATCH] Docs: Add missing `void` to DocBlock `@return` types. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Built from https://develop.svn.wordpress.org/trunk@59336 git-svn-id: http://core.svn.wordpress.org/trunk@58722 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-privacy-requests-table.php | 3 ++- wp-includes/class-wp-recovery-mode.php | 6 +++--- wp-includes/class-wp-widget.php | 2 +- wp-includes/version.php | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/class-wp-privacy-requests-table.php b/wp-admin/includes/class-wp-privacy-requests-table.php index 61a917c3f6..1c84a21b1b 100644 --- a/wp-admin/includes/class-wp-privacy-requests-table.php +++ b/wp-admin/includes/class-wp-privacy-requests-table.php @@ -430,7 +430,8 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table { * @since 4.9.6 * * @param WP_User_Request $item Item being shown. - * @return string Status column markup. + * @return string|void Status column markup. Returns a string if no status is found, + * otherwise it displays the markup. */ public function column_status( $item ) { $status = get_post_status( $item->ID ); diff --git a/wp-includes/class-wp-recovery-mode.php b/wp-includes/class-wp-recovery-mode.php index bed00d4ef8..afed07b3a7 100644 --- a/wp-includes/class-wp-recovery-mode.php +++ b/wp-includes/class-wp-recovery-mode.php @@ -161,9 +161,9 @@ class WP_Recovery_Mode { * @since 5.2.0 * * @param array $error Error details from `error_get_last()`. - * @return true|WP_Error True if the error was handled and headers have already been sent. - * Or the request will exit to try and catch multiple errors at once. - * WP_Error if an error occurred preventing it from being handled. + * @return true|WP_Error|void True if the error was handled and headers have already been sent. + * Or the request will exit to try and catch multiple errors at once. + * WP_Error if an error occurred preventing it from being handled. */ public function handle_error( array $error ) { diff --git a/wp-includes/class-wp-widget.php b/wp-includes/class-wp-widget.php index f3e4130b32..4773f4b7fa 100644 --- a/wp-includes/class-wp-widget.php +++ b/wp-includes/class-wp-widget.php @@ -138,7 +138,7 @@ class WP_Widget { * @since 2.8.0 * * @param array $instance The settings for the particular instance of the widget. - * @return string Default return is 'noform'. + * @return string|void Default return is 'noform'. */ public function form( $instance ) { echo '

' . __( 'There are no options for this widget.' ) . '

'; diff --git a/wp-includes/version.php b/wp-includes/version.php index 82828eeb3c..b37a9890fe 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59335'; +$wp_version = '6.8-alpha-59336'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.