Make WordPress Core


Ignore:
Timestamp:
03/30/2026 06:01:58 AM (5 months ago)
Author:
westonruter
Message:

Code Quality: Replace void with proper return types in Administration PHPDoc annotations.

Replace void in union return types with null or remove it where the function always returns a value or dies, across 8 files in wp-admin/includes. Adds explicit return null; statements where functions previously fell through without a return value.

Additionally:

  • Adds @return never for media_send_to_editor() and removes misleading return from its callers.
  • Removes void from return types where the function always returns a value or exits: write_post(), WP_Importer::set_blog(), WP_Importer::set_user().
  • Replaces mixed|void with a specific array shape for WP_Site_Health::perform_test().

Developed in https://github.com/WordPress/wordpress-develop/pull/11008

Follow-up to r62178, r62177, r61766, r61719.

Props apermo, xate, westonruter, mukesh27, desrosj.
Fixes #64702.

File:
1 edited

Legend:

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

    r61799 r62179  
    16491649 * @since 3.0.0
    16501650 *
    1651  * @return true|void True if not multisite, user can't upload files, or the space check option is disabled.
     1651 * @return true|null True if not multisite, user can't upload files, or the space check option is disabled.
    16521652 */
    16531653function wp_dashboard_quota() {
     
    17101710        </div>
    17111711        <?php
     1712        return null;
    17121713}
    17131714
Note: See TracChangeset for help on using the changeset viewer.