Make WordPress Core


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

Code Modernization: Block Supports: Use null coalescing operator instead of isset() 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 [61429], [61424], [61404], [61403].

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/dimensions.php

    r57491 r61430  
    6161
    6262        $has_min_height_support = block_has_support( $block_type, array( 'dimensions', 'minHeight' ), false );
    63         $block_styles           = isset( $block_attributes['style'] ) ? $block_attributes['style'] : null;
     63        $block_styles           = $block_attributes['style'] ?? null;
    6464
    6565        if ( ! $block_styles ) {
     
    7171        $dimensions_block_styles['minHeight'] = null;
    7272        if ( $has_min_height_support && ! $skip_min_height ) {
    73                 $dimensions_block_styles['minHeight'] = isset( $block_styles['dimensions']['minHeight'] )
    74                         ? $block_styles['dimensions']['minHeight']
    75                         : null;
     73                $dimensions_block_styles['minHeight'] = $block_styles['dimensions']['minHeight'] ?? null;
    7674        }
    7775        $styles = wp_style_engine_get_styles( array( 'dimensions' => $dimensions_block_styles ) );
Note: See TracChangeset for help on using the changeset viewer.