Make WordPress Core

Changeset 60180


Ignore:
Timestamp:
04/23/2025 12:12:21 AM (10 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Explicitly return null in wp_get_nav_menu_to_edit().

This commit updates the function to explicitly return null if a valid $menu_id is not passed or the term does not exist. Previously, the function could return void, but was typed as only returning a string or a WP_Error object.

Follow-up to [14248].

Props justlevine.
See #63268.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/nav-menu.php

    r59948 r60180  
    12401240 *
    12411241 * @param int $menu_id Optional. The ID of the menu to format. Default 0.
    1242  * @return string|WP_Error The menu formatted to edit or error object on failure.
     1242 * @return string|WP_Error|null The menu formatted to edit or error object on failure.
     1243 *                              Null if the `$menu_id` parameter is not supplied or the term does not exist.
    12431244 */
    12441245function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
     
    13221323        return $menu;
    13231324    }
     1325
     1326    return null;
    13241327}
    13251328
Note: See TracChangeset for help on using the changeset viewer.