Commit 527ccba62f for wordpress.org
commit 527ccba62f72bfbb0e59fd0db6ca76c6c27a8603
Author: Weston Ruter <weston@xwp.co>
Date: Mon Jan 5 05:24:33 2026 +0000
Code Modernization: Editor: 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 [61430], [61429], [61424], [61404], [61403].
Props costdev, westonruter.
See #58874, #63430.
Built from https://develop.svn.wordpress.org/trunk@61431
git-svn-id: http://core.svn.wordpress.org/trunk@60743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 0380a48a9c..a22acd74cc 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -69,7 +69,7 @@ if ( wp_is_mobile() ) {
*/
$post_ID = isset( $post_ID ) ? (int) $post_ID : 0;
$user_ID = isset( $user_ID ) ? (int) $user_ID : 0;
-$action = isset( $action ) ? $action : '';
+$action = $action ?? '';
if ( (int) get_option( 'page_for_posts' ) === $post->ID && empty( $post->post_content ) ) {
add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
diff --git a/wp-admin/site-editor.php b/wp-admin/site-editor.php
index b0bb4e2bb1..628be66253 100644
--- a/wp-admin/site-editor.php
+++ b/wp-admin/site-editor.php
@@ -287,7 +287,7 @@ if ( ! empty( $registered_sources ) ) {
wp_add_inline_script(
'wp-blocks',
- sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( isset( $editor_settings['blockCategories'] ) ? $editor_settings['blockCategories'] : array(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ),
+ sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( $editor_settings['blockCategories'] ?? array(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ),
'after'
);
diff --git a/wp-includes/block-editor.php b/wp-includes/block-editor.php
index 6f5720ec21..40575f0486 100644
--- a/wp-includes/block-editor.php
+++ b/wp-includes/block-editor.php
@@ -566,30 +566,15 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
// These settings may need to be updated based on data coming from theme.json sources.
if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {
$colors_by_origin = $editor_settings['__experimentalFeatures']['color']['palette'];
- $editor_settings['colors'] = isset( $colors_by_origin['custom'] ) ?
- $colors_by_origin['custom'] : (
- isset( $colors_by_origin['theme'] ) ?
- $colors_by_origin['theme'] :
- $colors_by_origin['default']
- );
+ $editor_settings['colors'] = $colors_by_origin['custom'] ?? $colors_by_origin['theme'] ?? $colors_by_origin['default'];
}
if ( isset( $editor_settings['__experimentalFeatures']['color']['gradients'] ) ) {
$gradients_by_origin = $editor_settings['__experimentalFeatures']['color']['gradients'];
- $editor_settings['gradients'] = isset( $gradients_by_origin['custom'] ) ?
- $gradients_by_origin['custom'] : (
- isset( $gradients_by_origin['theme'] ) ?
- $gradients_by_origin['theme'] :
- $gradients_by_origin['default']
- );
+ $editor_settings['gradients'] = $gradients_by_origin['custom'] ?? $gradients_by_origin['theme'] ?? $gradients_by_origin['default'];
}
if ( isset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] ) ) {
$font_sizes_by_origin = $editor_settings['__experimentalFeatures']['typography']['fontSizes'];
- $editor_settings['fontSizes'] = isset( $font_sizes_by_origin['custom'] ) ?
- $font_sizes_by_origin['custom'] : (
- isset( $font_sizes_by_origin['theme'] ) ?
- $font_sizes_by_origin['theme'] :
- $font_sizes_by_origin['default']
- );
+ $editor_settings['fontSizes'] = $font_sizes_by_origin['custom'] ?? $font_sizes_by_origin['theme'] ?? $font_sizes_by_origin['default'];
}
if ( isset( $editor_settings['__experimentalFeatures']['color']['custom'] ) ) {
$editor_settings['disableCustomColors'] = ! $editor_settings['__experimentalFeatures']['color']['custom'];
@@ -622,12 +607,7 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['spacingSizes'] ) ) {
$spacing_sizes_by_origin = $editor_settings['__experimentalFeatures']['spacing']['spacingSizes'];
- $editor_settings['spacingSizes'] = isset( $spacing_sizes_by_origin['custom'] ) ?
- $spacing_sizes_by_origin['custom'] : (
- isset( $spacing_sizes_by_origin['theme'] ) ?
- $spacing_sizes_by_origin['theme'] :
- $spacing_sizes_by_origin['default']
- );
+ $editor_settings['spacingSizes'] = $spacing_sizes_by_origin['custom'] ?? $spacing_sizes_by_origin['theme'] ?? $spacing_sizes_by_origin['default'];
}
$editor_settings['__unstableResolvedAssets'] = _wp_get_iframed_editor_assets();
diff --git a/wp-includes/block-template-utils.php b/wp-includes/block-template-utils.php
index be15b8c398..df016c4a1d 100644
--- a/wp-includes/block-template-utils.php
+++ b/wp-includes/block-template-utils.php
@@ -382,10 +382,10 @@ function _get_block_templates_files( $template_type, $query = array() ) {
}
// Prepare metadata from $query.
- $slugs_to_include = isset( $query['slug__in'] ) ? $query['slug__in'] : array();
- $slugs_to_skip = isset( $query['slug__not_in'] ) ? $query['slug__not_in'] : array();
- $area = isset( $query['area'] ) ? $query['area'] : null;
- $post_type = isset( $query['post_type'] ) ? $query['post_type'] : '';
+ $slugs_to_include = $query['slug__in'] ?? array();
+ $slugs_to_skip = $query['slug__not_in'] ?? array();
+ $area = $query['area'] ?? null;
+ $post_type = $query['post_type'] ?? '';
$stylesheet = get_stylesheet();
$template = get_template();
@@ -1115,7 +1115,7 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' )
return $templates;
}
- $post_type = isset( $query['post_type'] ) ? $query['post_type'] : '';
+ $post_type = $query['post_type'] ?? '';
$wp_query_args = array(
'post_status' => array( 'auto-draft', 'draft', 'publish' ),
'post_type' => $template_type,
@@ -1702,8 +1702,8 @@ function inject_ignored_hooked_blocks_metadata_attributes( $changes, $deprecated
return $changes;
}
- $meta = isset( $changes->meta_input ) ? $changes->meta_input : array();
- $terms = isset( $changes->tax_input ) ? $changes->tax_input : array();
+ $meta = $changes->meta_input ?? array();
+ $terms = $changes->tax_input ?? array();
if ( empty( $changes->ID ) ) {
// There's no post object for this template in the database for this template yet.
diff --git a/wp-includes/block-template.php b/wp-includes/block-template.php
index eecbe2d61d..df3735b238 100644
--- a/wp-includes/block-template.php
+++ b/wp-includes/block-template.php
@@ -373,10 +373,10 @@ function _resolve_template_for_new_post( $wp_query ) {
remove_filter( 'pre_get_posts', '_resolve_template_for_new_post' );
// Pages.
- $page_id = isset( $wp_query->query['page_id'] ) ? $wp_query->query['page_id'] : null;
+ $page_id = $wp_query->query['page_id'] ?? null;
// Posts, including custom post types.
- $p = isset( $wp_query->query['p'] ) ? $wp_query->query['p'] : null;
+ $p = $wp_query->query['p'] ?? null;
$post_id = $page_id ? $page_id : $p;
$post = get_post( $post_id );
diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php
index a8ed76d3bd..2a99686081 100644
--- a/wp-includes/blocks.php
+++ b/wp-includes/blocks.php
@@ -171,9 +171,9 @@ function register_block_script_module_id( $metadata, $field_name, $index = 0 ) {
$module_uri = get_block_asset_url( $module_path_norm );
$module_asset = ! empty( $module_asset_path ) ? require $module_asset_path : array();
- $module_dependencies = isset( $module_asset['dependencies'] ) ? $module_asset['dependencies'] : array();
- $block_version = isset( $metadata['version'] ) ? $metadata['version'] : false;
- $module_version = isset( $module_asset['version'] ) ? $module_asset['version'] : $block_version;
+ $module_dependencies = $module_asset['dependencies'] ?? array();
+ $block_version = $metadata['version'] ?? false;
+ $module_version = $module_asset['version'] ?? $block_version;
$supports_interactivity_true = isset( $metadata['supports']['interactivity'] ) && true === $metadata['supports']['interactivity'];
$is_interactive = $supports_interactivity_true || ( isset( $metadata['supports']['interactivity']['interactive'] ) && true === $metadata['supports']['interactivity']['interactive'] );
@@ -248,8 +248,7 @@ function register_block_script_handle( $metadata, $field_name, $index = 0 ) {
// Asset file for blocks is optional. See https://core.trac.wordpress.org/ticket/60460.
$script_asset = ! empty( $script_asset_path ) ? require $script_asset_path : array();
- $script_handle = isset( $script_asset['handle'] ) ?
- $script_asset['handle'] :
+ $script_handle = $script_asset['handle'] ??
generate_block_asset_handle( $metadata['name'], $field_name, $index );
if ( wp_script_is( $script_handle, 'registered' ) ) {
return $script_handle;
@@ -257,9 +256,9 @@ function register_block_script_handle( $metadata, $field_name, $index = 0 ) {
$script_path_norm = wp_normalize_path( realpath( $path . '/' . $script_path ) );
$script_uri = get_block_asset_url( $script_path_norm );
- $script_dependencies = isset( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : array();
- $block_version = isset( $metadata['version'] ) ? $metadata['version'] : false;
- $script_version = isset( $script_asset['version'] ) ? $script_asset['version'] : $block_version;
+ $script_dependencies = $script_asset['dependencies'] ?? array();
+ $block_version = $metadata['version'] ?? false;
+ $script_version = $script_asset['version'] ?? $block_version;
$script_args = array();
if ( 'viewScript' === $field_name && $script_uri ) {
$script_args['strategy'] = 'defer';
@@ -1068,9 +1067,7 @@ function set_ignored_hooked_blocks_metadata( &$parsed_anchor_block, $relative_po
}
}
- $previously_ignored_hooked_blocks = isset( $parsed_anchor_block['attrs']['metadata']['ignoredHookedBlocks'] )
- ? $parsed_anchor_block['attrs']['metadata']['ignoredHookedBlocks']
- : array();
+ $previously_ignored_hooked_blocks = $parsed_anchor_block['attrs']['metadata']['ignoredHookedBlocks'] ?? array();
$parsed_anchor_block['attrs']['metadata']['ignoredHookedBlocks'] = array_unique(
array_merge(
@@ -1404,9 +1401,7 @@ function update_ignored_hooked_blocks_postmeta( $post ) {
$serialized_block = apply_block_hooks_to_content( $markup, $context, 'set_ignored_hooked_blocks_metadata' );
$root_block = parse_blocks( $serialized_block )[0];
- $ignored_hooked_blocks = isset( $root_block['attrs']['metadata']['ignoredHookedBlocks'] )
- ? $root_block['attrs']['metadata']['ignoredHookedBlocks']
- : array();
+ $ignored_hooked_blocks = $root_block['attrs']['metadata']['ignoredHookedBlocks'] ?? array();
if ( ! empty( $ignored_hooked_blocks ) ) {
$existing_ignored_hooked_blocks = get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true );
@@ -1823,7 +1818,7 @@ function traverse_and_serialize_block( $block, $pre_callback = null, $post_callb
}
$block_content .= traverse_and_serialize_block( $inner_block, $pre_callback, $post_callback );
- $block_content .= isset( $post_markup ) ? $post_markup : '';
+ $block_content .= $post_markup ?? '';
++$block_index;
}
@@ -1983,7 +1978,7 @@ function traverse_and_serialize_blocks( $blocks, $pre_callback = null, $post_cal
}
$result .= traverse_and_serialize_block( $block, $pre_callback, $post_callback );
- $result .= isset( $post_markup ) ? $post_markup : '';
+ $result .= $post_markup ?? '';
}
return $result;
@@ -2598,7 +2593,7 @@ function wp_migrate_old_typography_shape( $metadata ) {
);
foreach ( $typography_keys as $typography_key ) {
- $support_for_key = isset( $metadata['supports'][ $typography_key ] ) ? $metadata['supports'][ $typography_key ] : null;
+ $support_for_key = $metadata['supports'][ $typography_key ] ?? null;
if ( null !== $support_for_key ) {
_doing_it_wrong(
diff --git a/wp-includes/class-wp-block-metadata-registry.php b/wp-includes/class-wp-block-metadata-registry.php
index cba8193b7e..b6d0416d5f 100644
--- a/wp-includes/class-wp-block-metadata-registry.php
+++ b/wp-includes/class-wp-block-metadata-registry.php
@@ -178,7 +178,7 @@ class WP_Block_Metadata_Registry {
// Get the block name from the path.
$block_name = self::default_identifier_callback( $file_or_folder );
- return isset( $collection['metadata'][ $block_name ] ) ? $collection['metadata'][ $block_name ] : null;
+ return $collection['metadata'][ $block_name ] ?? null;
}
/**
diff --git a/wp-includes/class-wp-block-templates-registry.php b/wp-includes/class-wp-block-templates-registry.php
index eff23ccf03..6605e97237 100644
--- a/wp-includes/class-wp-block-templates-registry.php
+++ b/wp-includes/class-wp-block-templates-registry.php
@@ -75,16 +75,16 @@ final class WP_Block_Templates_Registry {
$template->theme = $theme_name;
$template->plugin = $plugin;
$template->author = null;
- $template->content = isset( $args['content'] ) ? $args['content'] : '';
+ $template->content = $args['content'] ?? '';
$template->source = 'plugin';
$template->slug = $slug;
$template->type = 'wp_template';
- $template->title = isset( $args['title'] ) ? $args['title'] : $template_name;
- $template->description = isset( $args['description'] ) ? $args['description'] : '';
+ $template->title = $args['title'] ?? $template_name;
+ $template->description = $args['description'] ?? '';
$template->status = 'publish';
$template->origin = 'plugin';
$template->is_custom = ! isset( $default_template_types[ $template_name ] );
- $template->post_types = isset( $args['post_types'] ) ? $args['post_types'] : array();
+ $template->post_types = $args['post_types'] ?? array();
}
$this->registered_templates[ $template_name ] = $template;
diff --git a/wp-includes/class-wp-block-type.php b/wp-includes/class-wp-block-type.php
index 6916f6a462..461efbcc20 100644
--- a/wp-includes/class-wp-block-type.php
+++ b/wp-includes/class-wp-block-type.php
@@ -383,7 +383,7 @@ class WP_Block_Type {
if ( count( $this->{$new_name} ) > 1 ) {
return $this->{$new_name};
}
- return isset( $this->{$new_name}[0] ) ? $this->{$new_name}[0] : null;
+ return $this->{$new_name}[0] ?? null;
}
/**
diff --git a/wp-includes/class-wp-block.php b/wp-includes/class-wp-block.php
index 5188246180..f59b770d93 100644
--- a/wp-includes/class-wp-block.php
+++ b/wp-includes/class-wp-block.php
@@ -222,8 +222,7 @@ class WP_Block {
*/
public function __get( $name ) {
if ( 'attributes' === $name ) {
- $this->attributes = isset( $this->parsed_block['attrs'] ) ?
- $this->parsed_block['attrs'] :
+ $this->attributes = $this->parsed_block['attrs'] ??
array();
if ( ! is_null( $this->block_type ) ) {
@@ -312,9 +311,7 @@ class WP_Block {
*/
foreach ( $supported_block_attributes as $attribute_name ) {
// Retain any non-pattern override bindings that might be present.
- $updated_bindings[ $attribute_name ] = isset( $bindings[ $attribute_name ] )
- ? $bindings[ $attribute_name ]
- : array( 'source' => 'core/pattern-overrides' );
+ $updated_bindings[ $attribute_name ] = $bindings[ $attribute_name ] ?? array( 'source' => 'core/pattern-overrides' );
}
$bindings = $updated_bindings;
/*
diff --git a/wp-includes/class-wp-classic-to-block-menu-converter.php b/wp-includes/class-wp-classic-to-block-menu-converter.php
index b3cc819904..a0b7d50756 100644
--- a/wp-includes/class-wp-classic-to-block-menu-converter.php
+++ b/wp-includes/class-wp-classic-to-block-menu-converter.php
@@ -44,9 +44,7 @@ class WP_Classic_To_Block_Menu_Converter {
$menu_items_by_parent_id = static::group_by_parent_id( $menu_items );
- $first_menu_item = isset( $menu_items_by_parent_id[0] )
- ? $menu_items_by_parent_id[0]
- : array();
+ $first_menu_item = $menu_items_by_parent_id[0] ?? array();
$inner_blocks = static::to_blocks(
$first_menu_item,
diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php
index e48bdfa154..ba2020813a 100644
--- a/wp-includes/class-wp-theme-json.php
+++ b/wp-includes/class-wp-theme-json.php
@@ -1204,9 +1204,7 @@ class WP_Theme_JSON {
// Keep backwards compatibility for support.color.__experimentalDuotone.
if ( null === $duotone_selector ) {
- $duotone_support = isset( $block_type->supports['color']['__experimentalDuotone'] )
- ? $block_type->supports['color']['__experimentalDuotone']
- : null;
+ $duotone_support = $block_type->supports['color']['__experimentalDuotone'] ?? null;
if ( $duotone_support ) {
$root_selector = wp_get_block_css_selector( $block_type );
@@ -1520,14 +1518,12 @@ class WP_Theme_JSON {
public function get_custom_css() {
_deprecated_function( __METHOD__, '6.7.0', 'get_stylesheet' );
// Add the global styles root CSS.
- $stylesheet = isset( $this->theme_json['styles']['css'] ) ? $this->theme_json['styles']['css'] : '';
+ $stylesheet = $this->theme_json['styles']['css'] ?? '';
// Add the global styles block CSS.
if ( isset( $this->theme_json['styles']['blocks'] ) ) {
foreach ( $this->theme_json['styles']['blocks'] as $name => $node ) {
- $custom_block_css = isset( $this->theme_json['styles']['blocks'][ $name ]['css'] )
- ? $this->theme_json['styles']['blocks'][ $name ]['css']
- : null;
+ $custom_block_css = $this->theme_json['styles']['blocks'][ $name ]['css'] ?? null;
if ( $custom_block_css ) {
$selector = static::$blocks_metadata[ $name ]['selector'];
$stylesheet .= $this->process_blocks_custom_css( $custom_block_css, $selector );
@@ -1554,8 +1550,8 @@ class WP_Theme_JSON {
foreach ( $this->theme_json['customTemplates'] as $item ) {
if ( isset( $item['name'] ) ) {
$custom_templates[ $item['name'] ] = array(
- 'title' => isset( $item['title'] ) ? $item['title'] : '',
- 'postTypes' => isset( $item['postTypes'] ) ? $item['postTypes'] : array( 'page' ),
+ 'title' => $item['title'] ?? '',
+ 'postTypes' => $item['postTypes'] ?? array( 'page' ),
);
}
}
@@ -1578,8 +1574,8 @@ class WP_Theme_JSON {
foreach ( $this->theme_json['templateParts'] as $item ) {
if ( isset( $item['name'] ) ) {
$template_parts[ $item['name'] ] = array(
- 'title' => isset( $item['title'] ) ? $item['title'] : '',
- 'area' => isset( $item['area'] ) ? $item['area'] : '',
+ 'title' => $item['title'] ?? '',
+ 'area' => $item['area'] ?? '',
);
}
}
@@ -1649,7 +1645,7 @@ class WP_Theme_JSON {
}
}
- $selector = isset( $block_metadata['selector'] ) ? $block_metadata['selector'] : '';
+ $selector = $block_metadata['selector'] ?? '';
$has_block_gap_support = isset( $this->theme_json['settings']['spacing']['blockGap'] );
$has_fallback_gap_support = ! $has_block_gap_support; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback gap styles support.
$node = _wp_array_get( $this->theme_json, $block_metadata['path'], array() );
@@ -1666,9 +1662,7 @@ class WP_Theme_JSON {
if ( ! $has_block_gap_support ) {
$block_gap_value = static::ROOT_BLOCK_SELECTOR === $selector ? '0.5em' : null;
if ( ! empty( $block_type ) ) {
- $block_gap_value = isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] )
- ? $block_type->supports['spacing']['blockGap']['__experimentalDefault']
- : null;
+ $block_gap_value = $block_type->supports['spacing']['blockGap']['__experimentalDefault'] ?? null;
}
} else {
$block_gap_value = static::get_property_value( $node, array( 'spacing', 'blockGap' ) );
@@ -1694,8 +1688,8 @@ class WP_Theme_JSON {
continue;
}
- $class_name = isset( $layout_definition['className'] ) ? $layout_definition['className'] : false;
- $spacing_rules = isset( $layout_definition['spacingStyles'] ) ? $layout_definition['spacingStyles'] : array();
+ $class_name = $layout_definition['className'] ?? false;
+ $spacing_rules = $layout_definition['spacingStyles'] ?? array();
if (
! empty( $class_name ) &&
@@ -1751,8 +1745,8 @@ class WP_Theme_JSON {
) {
$valid_display_modes = array( 'block', 'flex', 'grid' );
foreach ( $layout_definitions as $layout_definition ) {
- $class_name = isset( $layout_definition['className'] ) ? $layout_definition['className'] : false;
- $base_style_rules = isset( $layout_definition['baseStyles'] ) ? $layout_definition['baseStyles'] : array();
+ $class_name = $layout_definition['className'] ?? false;
+ $base_style_rules = $layout_definition['baseStyles'] ?? array();
if (
! empty( $class_name ) &&
@@ -2234,7 +2228,7 @@ class WP_Theme_JSON {
*/
protected static function compute_theme_vars( $settings ) {
$declarations = array();
- $custom_values = isset( $settings['custom'] ) ? $settings['custom'] : array();
+ $custom_values = $settings['custom'] ?? array();
$css_vars = static::flatten_tree( $custom_values );
foreach ( $css_vars as $key => $value ) {
$declarations[] = array(
@@ -2844,7 +2838,7 @@ class WP_Theme_JSON {
$node = _wp_array_get( $this->theme_json, $block_metadata['path'], array() );
$use_root_padding = isset( $this->theme_json['settings']['useRootPaddingAwareAlignments'] ) && true === $this->theme_json['settings']['useRootPaddingAwareAlignments'];
$selector = $block_metadata['selector'];
- $settings = isset( $this->theme_json['settings'] ) ? $this->theme_json['settings'] : array();
+ $settings = $this->theme_json['settings'] ?? array();
$feature_declarations = static::get_feature_declarations_for_node( $block_metadata, $node );
$is_root_selector = static::ROOT_BLOCK_SELECTOR === $selector;
@@ -2925,7 +2919,7 @@ class WP_Theme_JSON {
)
);
- $pseudo_selector = isset( $pseudo_matches[0] ) ? $pseudo_matches[0] : null;
+ $pseudo_selector = $pseudo_matches[0] ?? null;
/*
* If the current selector is a pseudo selector that's defined in the allow list for the current
@@ -3068,7 +3062,7 @@ class WP_Theme_JSON {
*/
public function get_root_layout_rules( $selector, $block_metadata ) {
$css = '';
- $settings = isset( $this->theme_json['settings'] ) ? $this->theme_json['settings'] : array();
+ $settings = $this->theme_json['settings'] ?? array();
$use_root_padding = isset( $this->theme_json['settings']['useRootPaddingAwareAlignments'] ) && true === $this->theme_json['settings']['useRootPaddingAwareAlignments'];
/*
@@ -3076,9 +3070,9 @@ class WP_Theme_JSON {
* as custom properties on the body element so all blocks can use them.
*/
if ( isset( $settings['layout']['contentSize'] ) || isset( $settings['layout']['wideSize'] ) ) {
- $content_size = isset( $settings['layout']['contentSize'] ) ? $settings['layout']['contentSize'] : $settings['layout']['wideSize'];
+ $content_size = $settings['layout']['contentSize'] ?? $settings['layout']['wideSize'];
$content_size = static::is_safe_css_declaration( 'max-width', $content_size ) ? $content_size : 'initial';
- $wide_size = isset( $settings['layout']['wideSize'] ) ? $settings['layout']['wideSize'] : $settings['layout']['contentSize'];
+ $wide_size = $settings['layout']['wideSize'] ?? $settings['layout']['contentSize'];
$wide_size = static::is_safe_css_declaration( 'max-width', $wide_size ) ? $wide_size : 'initial';
$css .= static::ROOT_CSS_PROPERTIES_SELECTOR . ' { --wp--style--global--content-size: ' . $content_size . ';';
$css .= '--wp--style--global--wide-size: ' . $wide_size . '; }';
@@ -4065,9 +4059,7 @@ class WP_Theme_JSON {
public function set_spacing_sizes() {
_deprecated_function( __METHOD__, '6.6.0' );
- $spacing_scale = isset( $this->theme_json['settings']['spacing']['spacingScale'] )
- ? $this->theme_json['settings']['spacing']['spacingScale']
- : array();
+ $spacing_scale = $this->theme_json['settings']['spacing']['spacingScale'] ?? array();
if ( ! isset( $spacing_scale['steps'] )
|| ! is_numeric( $spacing_scale['steps'] )
@@ -4401,9 +4393,7 @@ class WP_Theme_JSON {
return $declarations;
}
- $settings = isset( $this->theme_json['settings'] )
- ? $this->theme_json['settings']
- : array();
+ $settings = $this->theme_json['settings'] ?? array();
foreach ( $metadata['selectors'] as $feature => $feature_selectors ) {
/*
@@ -4532,8 +4522,8 @@ class WP_Theme_JSON {
$fallback,
),
array(
- isset( $values[ $key_in_values ] ) ? $values[ $key_in_values ] : $rule_to_replace,
- isset( $values[ $fallback ] ) ? $values[ $fallback ] : $fallback,
+ $values[ $key_in_values ] ?? $rule_to_replace,
+ $values[ $fallback ] ?? $fallback,
),
$resolved_style
);
diff --git a/wp-includes/version.php b/wp-includes/version.php
index f73e3045d9..0a895c8816 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61430';
+$wp_version = '7.0-alpha-61431';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.