Make WordPress Core

Changeset 59336


Ignore:
Timestamp:
11/02/2024 02:59:16 PM (2 months ago)
Author:
SergeyBiryukov
Message:

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 documentation standards.

Follow-up to [30382], [42967], [43256], [44973], [45448].

Props justlevine.
See #52217, #62281.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-privacy-requests-table.php

    r56665 r59336  
    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 ) {
  • trunk/src/wp-includes/class-wp-recovery-mode.php

    r55703 r59336  
    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 ) {
  • trunk/src/wp-includes/class-wp-widget.php

    r59196 r59336  
    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 ) {
Note: See TracChangeset for help on using the changeset viewer.