Commit 56076b1bc4 for wordpress.org
commit 56076b1bc4c650edac0718f6d8710f6ed3124e8e
Author: Weston Ruter <weston@xwp.co>
Date: Tue Jan 6 05:14:55 2026 +0000
Code Modernization: Script Loader: 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 [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403].
Props costdev, westonruter.
See #58874, #63430.
Built from https://develop.svn.wordpress.org/trunk@61442
git-svn-id: http://core.svn.wordpress.org/trunk@60754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp-scripts.php b/wp-includes/class-wp-scripts.php
index 7628db0a87..8c02c5af98 100644
--- a/wp-includes/class-wp-scripts.php
+++ b/wp-includes/class-wp-scripts.php
@@ -450,7 +450,7 @@ class WP_Scripts extends WP_Dependencies {
}
// Determine fetchpriority.
- $original_fetchpriority = isset( $obj->extra['fetchpriority'] ) ? $obj->extra['fetchpriority'] : null;
+ $original_fetchpriority = $obj->extra['fetchpriority'] ?? null;
if ( null === $original_fetchpriority || ! $this->is_valid_fetchpriority( $original_fetchpriority ) ) {
$original_fetchpriority = 'auto';
}
diff --git a/wp-includes/class-wp-styles.php b/wp-includes/class-wp-styles.php
index 72af6c29b0..b41ba10239 100644
--- a/wp-includes/class-wp-styles.php
+++ b/wp-includes/class-wp-styles.php
@@ -203,7 +203,7 @@ class WP_Styles extends WP_Dependencies {
}
$rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
- $title = isset( $obj->extra['title'] ) ? $obj->extra['title'] : '';
+ $title = $obj->extra['title'] ?? '';
$tag = sprintf(
"<link rel='%s' id='%s-css'%s href='%s' media='%s' />\n",
@@ -230,7 +230,7 @@ class WP_Styles extends WP_Dependencies {
if ( 'rtl' === $this->text_direction && isset( $obj->extra['rtl'] ) && $obj->extra['rtl'] ) {
if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $obj->extra['rtl'] ) {
- $suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : '';
+ $suffix = $obj->extra['suffix'] ?? '';
$rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $src, $ver, "$handle-rtl" ) );
} else {
$rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" );
diff --git a/wp-includes/css/dist/index.php b/wp-includes/css/dist/index.php
index ba2153739d..518cd0892f 100644
--- a/wp-includes/css/dist/index.php
+++ b/wp-includes/css/dist/index.php
@@ -7,11 +7,6 @@
*/
return array(
- array(
- 'handle' => 'wp-preferences',
- 'path' => 'preferences/style',
- 'dependencies' => array('wp-components'),
- ),
array(
'handle' => 'wp-nux',
'path' => 'nux/style',
@@ -23,8 +18,8 @@ return array(
'dependencies' => array('wp-components'),
),
array(
- 'handle' => 'wp-commands',
- 'path' => 'commands/style',
+ 'handle' => 'wp-preferences',
+ 'path' => 'preferences/style',
'dependencies' => array('wp-components'),
),
array(
@@ -33,13 +28,18 @@ return array(
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
- 'handle' => 'wp-widgets',
- 'path' => 'widgets/style',
+ 'handle' => 'wp-patterns',
+ 'path' => 'patterns/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
- 'handle' => 'wp-patterns',
- 'path' => 'patterns/style',
+ 'handle' => 'wp-commands',
+ 'path' => 'commands/style',
+ 'dependencies' => array('wp-components'),
+ ),
+ array(
+ 'handle' => 'wp-widgets',
+ 'path' => 'widgets/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
diff --git a/wp-includes/global-styles-and-settings.php b/wp-includes/global-styles-and-settings.php
index 1ca81d4f08..9027856763 100644
--- a/wp-includes/global-styles-and-settings.php
+++ b/wp-includes/global-styles-and-settings.php
@@ -283,7 +283,7 @@ function wp_add_global_styles_for_blocks() {
if ( $can_use_cached ) {
// Use the block name as the key for cached CSS data. Otherwise, use a hash of the metadata.
- $cache_node_key = isset( $metadata['name'] ) ? $metadata['name'] : md5( wp_json_encode( $metadata ) );
+ $cache_node_key = $metadata['name'] ?? md5( wp_json_encode( $metadata ) );
if ( isset( $cached['blocks'][ $cache_node_key ] ) ) {
$block_css = $cached['blocks'][ $cache_node_key ];
diff --git a/wp-includes/js/dist/script-modules/index.php b/wp-includes/js/dist/script-modules/index.php
index 56766df7ae..1c77da20bf 100644
--- a/wp-includes/js/dist/script-modules/index.php
+++ b/wp-includes/js/dist/script-modules/index.php
@@ -7,11 +7,26 @@
*/
return array(
+ array(
+ 'id' => '@wordpress/interactivity-router',
+ 'path' => 'interactivity-router/index',
+ 'asset' => 'interactivity-router/index.min.asset.php',
+ ),
+ array(
+ 'id' => '@wordpress/interactivity-router/full-page',
+ 'path' => 'interactivity-router/full-page',
+ 'asset' => 'interactivity-router/full-page.min.asset.php',
+ ),
array(
'id' => '@wordpress/interactivity',
'path' => 'interactivity/index',
'asset' => 'interactivity/index.min.asset.php',
),
+ array(
+ 'id' => '@wordpress/abilities',
+ 'path' => 'abilities/index',
+ 'asset' => 'abilities/index.min.asset.php',
+ ),
array(
'id' => '@wordpress/latex-to-mathml',
'path' => 'latex-to-mathml/index',
@@ -22,16 +37,6 @@ return array(
'path' => 'latex-to-mathml/loader',
'asset' => 'latex-to-mathml/loader.min.asset.php',
),
- array(
- 'id' => '@wordpress/interactivity-router',
- 'path' => 'interactivity-router/index',
- 'asset' => 'interactivity-router/index.min.asset.php',
- ),
- array(
- 'id' => '@wordpress/interactivity-router/full-page',
- 'path' => 'interactivity-router/full-page',
- 'asset' => 'interactivity-router/full-page.min.asset.php',
- ),
array(
'id' => '@wordpress/a11y',
'path' => 'a11y/index',
@@ -42,11 +47,6 @@ return array(
'path' => 'core-abilities/index',
'asset' => 'core-abilities/index.min.asset.php',
),
- array(
- 'id' => '@wordpress/abilities',
- 'path' => 'abilities/index',
- 'asset' => 'abilities/index.min.asset.php',
- ),
array(
'id' => '@wordpress/route',
'path' => 'route/index',
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 89ef4acf73..2d1f49ff95 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -1984,7 +1984,7 @@ function wp_localize_community_events() {
$user_id = get_current_user_id();
$saved_location = get_user_option( 'community-events-location', $user_id );
- $saved_ip_address = isset( $saved_location['ip'] ) ? $saved_location['ip'] : false;
+ $saved_ip_address = $saved_location['ip'] ?? false;
$current_ip_address = WP_Community_Events::get_unsafe_client_ip();
/*
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 675cd924c9..7993ce98e6 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61441';
+$wp_version = '7.0-alpha-61442';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.