Make WordPress Core


Ignore:
Timestamp:
01/05/2026 04:31:14 AM (7 months ago)
Author:
westonruter
Message:

Code Modernization: REST API: Use null coalescing operator in place of isset() in ternaries.

Developed as a subset of https://github.com/WordPress/wordpress-develop/pull/10654
Initially developed in https://github.com/WordPress/wordpress-develop/pull/4886

Follow-up to [61424], [61404], [61403].

Props costdev, westonruter.
See #58874, #63430.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    r61065 r61429  
    160160                 * @param string|null $mime_type  The mime type of the file being uploaded (if available).
    161161                 */
    162                 $prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, isset( $files['file']['type'] ) ? $files['file']['type'] : null );
     162                $prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, $files['file']['type'] ?? null );
    163163
    164164                // If the upload is an image, check if the server can handle the mime type.
Note: See TracChangeset for help on using the changeset viewer.