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/endpoints/class-wp-rest-block-directory-controller.php

    r59501 r61429  
    137137            'author_block_count'  => (int) $plugin['author_block_count'],
    138138            'author'              => wp_strip_all_tags( $plugin['author'] ),
    139             'icon'                => ( isset( $plugin['icons']['1x'] ) ? $plugin['icons']['1x'] : 'block-default' ),
     139            'icon'                => $plugin['icons']['1x'] ?? 'block-default',
    140140            'last_updated'        => gmdate( 'Y-m-d\TH:i:s', strtotime( $plugin['last_updated'] ) ),
    141141            'humanized_updated'   => sprintf(
Note: See TracChangeset for help on using the changeset viewer.