Make WordPress Core


Ignore:
Timestamp:
01/05/2026 04:31:14 AM (3 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.php

    r61178 r61429  
    953953                break 2;
    954954            }
    955             $ref[ $next ] = isset( $ref[ $next ] ) ? $ref[ $next ] : array();
     955            $ref[ $next ] = $ref[ $next ] ?? array();
    956956            $ref          = &$ref[ $next ];
    957957        }
     
    30893089
    30903090        if ( $is_array_type ) {
    3091             $check = isset( $schema['items'] ) ? $schema['items'] : array();
     3091            $check = $schema['items'] ?? array();
    30923092        } elseif ( $is_object_type ) {
    30933093            if ( isset( $schema['properties'][ $key ] ) ) {
     
    34183418        $error->get_all_error_data(),
    34193419        static function ( $status, $error_data ) {
    3420             return is_array( $error_data ) && isset( $error_data['status'] ) ? $error_data['status'] : $status;
     3420            return $error_data['status'] ?? $status;
    34213421        },
    34223422        500
Note: See TracChangeset for help on using the changeset viewer.