Commit f6cb67e746 for wordpress.org

commit f6cb67e74654245a5c31befdf75153809847e29c
Author: Weston Ruter <weston@xwp.co>
Date:   Fri Jan 9 02:48:51 2026 +0000

    Code Modernization: Upgrade/Install: 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 [61454], [61453], [61445], [61444], [61443], [61442], [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@61455


    git-svn-id: http://core.svn.wordpress.org/trunk@60767 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php
index 5cb818cd59..1843766542 100644
--- a/wp-admin/includes/class-core-upgrader.php
+++ b/wp-admin/includes/class-core-upgrader.php
@@ -403,7 +403,7 @@ class Core_Upgrader extends WP_Upgrader {
 	public function check_files() {
 		global $wp_version, $wp_local_package;

-		$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
+		$checksums = get_core_checksums( $wp_version, $wp_local_package ?? 'en_US' );

 		if ( ! is_array( $checksums ) ) {
 			return false;
diff --git a/wp-admin/includes/class-language-pack-upgrader.php b/wp-admin/includes/class-language-pack-upgrader.php
index 89b9f9ac87..733b109183 100644
--- a/wp-admin/includes/class-language-pack-upgrader.php
+++ b/wp-admin/includes/class-language-pack-upgrader.php
@@ -265,7 +265,7 @@ class Language_Pack_Upgrader extends WP_Upgrader {
 			$language_updates_results[] = array(
 				'language' => $language_update->language,
 				'type'     => $language_update->type,
-				'slug'     => isset( $language_update->slug ) ? $language_update->slug : 'default',
+				'slug'     => $language_update->slug ?? 'default',
 				'version'  => $language_update->version,
 			);
 		}
diff --git a/wp-admin/includes/class-plugin-installer-skin.php b/wp-admin/includes/class-plugin-installer-skin.php
index aa97833c59..13b4dd7097 100644
--- a/wp-admin/includes/class-plugin-installer-skin.php
+++ b/wp-admin/includes/class-plugin-installer-skin.php
@@ -45,7 +45,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {

 		$this->type      = $args['type'];
 		$this->url       = $args['url'];
-		$this->api       = isset( $args['api'] ) ? $args['api'] : array();
+		$this->api       = $args['api'] ?? array();
 		$this->overwrite = $args['overwrite'];

 		parent::__construct( $args );
@@ -265,8 +265,8 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
 		$blocked_message  = '<p>' . esc_html__( 'The plugin cannot be updated due to the following:' ) . '</p>';
 		$blocked_message .= '<ul class="ul-disc">';

-		$requires_php = isset( $new_plugin_data['RequiresPHP'] ) ? $new_plugin_data['RequiresPHP'] : null;
-		$requires_wp  = isset( $new_plugin_data['RequiresWP'] ) ? $new_plugin_data['RequiresWP'] : null;
+		$requires_php = $new_plugin_data['RequiresPHP'] ?? null;
+		$requires_wp  = $new_plugin_data['RequiresWP'] ?? null;

 		if ( ! is_php_version_compatible( $requires_php ) ) {
 			$error = sprintf(
diff --git a/wp-admin/includes/class-plugin-upgrader.php b/wp-admin/includes/class-plugin-upgrader.php
index 2f059b7e05..f5290ff525 100644
--- a/wp-admin/includes/class-plugin-upgrader.php
+++ b/wp-admin/includes/class-plugin-upgrader.php
@@ -490,8 +490,8 @@ class Plugin_Upgrader extends WP_Upgrader {
 			return new WP_Error( 'incompatible_archive_no_plugins', $this->strings['incompatible_archive'], __( 'No valid plugins were found.' ) );
 		}

-		$requires_php = isset( $new_plugin_data['RequiresPHP'] ) ? $new_plugin_data['RequiresPHP'] : null;
-		$requires_wp  = isset( $new_plugin_data['RequiresWP'] ) ? $new_plugin_data['RequiresWP'] : null;
+		$requires_php = $new_plugin_data['RequiresPHP'] ?? null;
+		$requires_wp  = $new_plugin_data['RequiresWP'] ?? null;

 		if ( ! is_php_version_compatible( $requires_php ) ) {
 			$error = sprintf(
@@ -570,7 +570,7 @@ class Plugin_Upgrader extends WP_Upgrader {
 			return $response;
 		}

-		$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
+		$plugin = $plugin['plugin'] ?? '';
 		if ( empty( $plugin ) ) {
 			return new WP_Error( 'bad_request', $this->strings['bad_request'] );
 		}
@@ -604,7 +604,7 @@ class Plugin_Upgrader extends WP_Upgrader {
 			return $response;
 		}

-		$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
+		$plugin = $plugin['plugin'] ?? '';

 		// Only run if plugin is active.
 		if ( ! is_plugin_active( $plugin ) ) {
@@ -640,7 +640,7 @@ class Plugin_Upgrader extends WP_Upgrader {
 			return $response;
 		}

-		$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
+		$plugin = $plugin['plugin'] ?? '';

 		// Only run if plugin is active.
 		if ( ! is_plugin_active( $plugin ) ) {
@@ -679,7 +679,7 @@ class Plugin_Upgrader extends WP_Upgrader {
 			return $removed; // Pass errors through.
 		}

-		$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
+		$plugin = $plugin['plugin'] ?? '';
 		if ( empty( $plugin ) ) {
 			return new WP_Error( 'bad_request', $this->strings['bad_request'] );
 		}
diff --git a/wp-admin/includes/class-theme-installer-skin.php b/wp-admin/includes/class-theme-installer-skin.php
index 7e734fce2f..81e40122d5 100644
--- a/wp-admin/includes/class-theme-installer-skin.php
+++ b/wp-admin/includes/class-theme-installer-skin.php
@@ -45,7 +45,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {

 		$this->type      = $args['type'];
 		$this->url       = $args['url'];
-		$this->api       = isset( $args['api'] ) ? $args['api'] : array();
+		$this->api       = $args['api'] ?? array();
 		$this->overwrite = $args['overwrite'];

 		parent::__construct( $args );
@@ -310,8 +310,8 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
 		$blocked_message  = '<p>' . esc_html__( 'The theme cannot be updated due to the following:' ) . '</p>';
 		$blocked_message .= '<ul class="ul-disc">';

-		$requires_php = isset( $new_theme_data['RequiresPHP'] ) ? $new_theme_data['RequiresPHP'] : null;
-		$requires_wp  = isset( $new_theme_data['RequiresWP'] ) ? $new_theme_data['RequiresWP'] : null;
+		$requires_php = $new_theme_data['RequiresPHP'] ?? null;
+		$requires_wp  = $new_theme_data['RequiresWP'] ?? null;

 		if ( ! is_php_version_compatible( $requires_php ) ) {
 			$error = sprintf(
diff --git a/wp-admin/includes/class-theme-upgrader.php b/wp-admin/includes/class-theme-upgrader.php
index 119f3c20f1..47062d3fd6 100644
--- a/wp-admin/includes/class-theme-upgrader.php
+++ b/wp-admin/includes/class-theme-upgrader.php
@@ -639,8 +639,8 @@ class Theme_Upgrader extends WP_Upgrader {
 			);
 		}

-		$requires_php = isset( $new_theme_data['RequiresPHP'] ) ? $new_theme_data['RequiresPHP'] : null;
-		$requires_wp  = isset( $new_theme_data['RequiresWP'] ) ? $new_theme_data['RequiresWP'] : null;
+		$requires_php = $new_theme_data['RequiresPHP'] ?? null;
+		$requires_wp  = $new_theme_data['RequiresWP'] ?? null;

 		if ( ! is_php_version_compatible( $requires_php ) ) {
 			$error = sprintf(
@@ -685,7 +685,7 @@ class Theme_Upgrader extends WP_Upgrader {
 			return $response;
 		}

-		$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
+		$theme = $theme['theme'] ?? '';

 		// Only run if active theme.
 		if ( get_stylesheet() !== $theme ) {
@@ -717,7 +717,7 @@ class Theme_Upgrader extends WP_Upgrader {
 			return $response;
 		}

-		$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
+		$theme = $theme['theme'] ?? '';

 		// Only run if active theme.
 		if ( get_stylesheet() !== $theme ) {
diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php
index 8c00c80da1..2f8045e8d1 100644
--- a/wp-admin/includes/update-core.php
+++ b/wp-admin/includes/update-core.php
@@ -1238,7 +1238,7 @@ function update_core( $from, $to ) {
 		// Find the local version of the working directory.
 		$working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro;

-		$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
+		$checksums = get_core_checksums( $wp_version, $wp_local_package ?? 'en_US' );

 		if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) {
 			$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2.
diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php
index 33325236e3..0fd9b3c79a 100644
--- a/wp-admin/includes/update.php
+++ b/wp-admin/includes/update.php
@@ -470,7 +470,7 @@ function wp_plugin_update_row( $file, $plugin_data ) {
 	);

 	$plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
-	$plugin_slug = isset( $response->slug ) ? $response->slug : $response->id;
+	$plugin_slug = $response->slug ?? $response->id;

 	if ( isset( $response->slug ) ) {
 		$details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '&section=changelog' );
@@ -504,7 +504,7 @@ function wp_plugin_update_row( $file, $plugin_data ) {
 			$active_class = is_plugin_active( $file ) ? ' active' : '';
 		}

-		$requires_php   = isset( $response->requires_php ) ? $response->requires_php : null;
+		$requires_php   = $response->requires_php ?? null;
 		$compatible_php = is_php_version_compatible( $requires_php );
 		$notice_type    = $compatible_php ? 'notice-warning' : 'notice-error';

@@ -696,8 +696,8 @@ function wp_theme_update_row( $theme_key, $theme ) {

 	$active = $theme->is_allowed( 'network' ) ? ' active' : '';

-	$requires_wp  = isset( $response['requires'] ) ? $response['requires'] : null;
-	$requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null;
+	$requires_wp  = $response['requires'] ?? null;
+	$requires_php = $response['requires_php'] ?? null;

 	$compatible_wp  = is_wp_version_compatible( $requires_wp );
 	$compatible_php = is_php_version_compatible( $requires_php );
diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php
index 17094849a1..513aa1498a 100644
--- a/wp-admin/update-core.php
+++ b/wp-admin/update-core.php
@@ -542,7 +542,7 @@ function list_plugin_updates() {
 			}
 		}

-		$requires_php   = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null;
+		$requires_php   = $plugin_data->update->requires_php ?? null;
 		$compatible_php = is_php_version_compatible( $requires_php );

 		if ( ! $compatible_php && current_user_can( 'update_php' ) ) {
@@ -687,8 +687,8 @@ function list_theme_updates() {
 	}

 	foreach ( $themes as $stylesheet => $theme ) {
-		$requires_wp  = isset( $theme->update['requires'] ) ? $theme->update['requires'] : null;
-		$requires_php = isset( $theme->update['requires_php'] ) ? $theme->update['requires_php'] : null;
+		$requires_wp  = $theme->update['requires'] ?? null;
+		$requires_php = $theme->update['requires_php'] ?? null;

 		$compatible_wp  = is_wp_version_compatible( $requires_wp );
 		$compatible_php = is_php_version_compatible( $requires_php );
@@ -854,8 +854,8 @@ function do_core_upgrade( $reinstall = false ) {
 	}
 	$url = wp_nonce_url( $url, 'upgrade-core' );

-	$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
-	$locale  = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
+	$version = $_POST['version'] ?? false;
+	$locale  = $_POST['locale'] ?? 'en_US';
 	$update  = find_core_update( $version, $locale );
 	if ( ! $update ) {
 		return;
@@ -947,8 +947,8 @@ function do_core_upgrade( $reinstall = false ) {
  * @since 2.7.0
  */
 function do_dismiss_core_update() {
-	$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
-	$locale  = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
+	$version = $_POST['version'] ?? false;
+	$locale  = $_POST['locale'] ?? 'en_US';
 	$update  = find_core_update( $version, $locale );
 	if ( ! $update ) {
 		return;
@@ -964,8 +964,8 @@ function do_dismiss_core_update() {
  * @since 2.7.0
  */
 function do_undismiss_core_update() {
-	$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
-	$locale  = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
+	$version = $_POST['version'] ?? false;
+	$locale  = $_POST['locale'] ?? 'en_US';
 	$update  = find_core_update( $version, $locale );
 	if ( ! $update ) {
 		return;
@@ -975,7 +975,7 @@ function do_undismiss_core_update() {
 	exit;
 }

-$action = isset( $_GET['action'] ) ? $_GET['action'] : 'upgrade-core';
+$action = $_GET['action'] ?? 'upgrade-core';

 $upgrade_error = false;
 if ( ( 'do-theme-upgrade' === $action || ( 'do-plugin-upgrade' === $action && ! isset( $_GET['plugins'] ) ) )
diff --git a/wp-admin/update.php b/wp-admin/update.php
index 090c37cfc4..a6c59ec06d 100644
--- a/wp-admin/update.php
+++ b/wp-admin/update.php
@@ -22,7 +22,7 @@ wp_enqueue_script( 'wp-a11y' );
 if ( isset( $_GET['action'] ) ) {
 	$plugin = isset( $_REQUEST['plugin'] ) ? trim( $_REQUEST['plugin'] ) : '';
 	$theme  = isset( $_REQUEST['theme'] ) ? urldecode( $_REQUEST['theme'] ) : '';
-	$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
+	$action = $_REQUEST['action'] ?? '';

 	if ( 'update-selected' === $action ) {
 		if ( ! current_user_can( 'update_plugins' ) ) {
diff --git a/wp-includes/css/dist/index.php b/wp-includes/css/dist/index.php
index 8225275629..a46f5aeeb9 100644
--- a/wp-includes/css/dist/index.php
+++ b/wp-includes/css/dist/index.php
@@ -33,24 +33,29 @@ return array(
 		'dependencies' => array('wp-block-editor', 'wp-components'),
 	),
 	array(
-		'handle' => 'wp-widgets',
-		'path' => 'widgets/style',
-		'dependencies' => array('wp-block-editor', 'wp-components'),
+		'handle' => 'wp-components',
+		'path' => 'components/style',
+		'dependencies' => array(),
 	),
 	array(
 		'handle' => 'wp-patterns',
 		'path' => 'patterns/style',
 		'dependencies' => array('wp-block-editor', 'wp-components'),
 	),
+	array(
+		'handle' => 'wp-widgets',
+		'path' => 'widgets/style',
+		'dependencies' => array('wp-block-editor', 'wp-components'),
+	),
 	array(
 		'handle' => 'wp-format-library',
 		'path' => 'format-library/style',
 		'dependencies' => array('wp-block-editor', 'wp-components'),
 	),
 	array(
-		'handle' => 'wp-components',
-		'path' => 'components/style',
-		'dependencies' => array(),
+		'handle' => 'wp-media-utils',
+		'path' => 'media-utils/style',
+		'dependencies' => array('wp-components'),
 	),
 	array(
 		'handle' => 'wp-block-directory',
@@ -62,21 +67,16 @@ return array(
 		'path' => 'customize-widgets/style',
 		'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-components', 'wp-media-utils', 'wp-preferences', 'wp-widgets'),
 	),
-	array(
-		'handle' => 'wp-edit-post',
-		'path' => 'edit-post/style',
-		'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-commands', 'wp-components', 'wp-editor', 'wp-preferences', 'wp-widgets'),
-	),
-	array(
-		'handle' => 'wp-media-utils',
-		'path' => 'media-utils/style',
-		'dependencies' => array('wp-components'),
-	),
 	array(
 		'handle' => 'wp-edit-widgets',
 		'path' => 'edit-widgets/style',
 		'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-components', 'wp-media-utils', 'wp-patterns', 'wp-preferences', 'wp-widgets'),
 	),
+	array(
+		'handle' => 'wp-edit-post',
+		'path' => 'edit-post/style',
+		'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-commands', 'wp-components', 'wp-editor', 'wp-preferences', 'wp-widgets'),
+	),
 	array(
 		'handle' => 'wp-block-library',
 		'path' => 'block-library/style',
@@ -87,14 +87,14 @@ return array(
 		'path' => 'editor/style',
 		'dependencies' => array('wp-block-editor', 'wp-commands', 'wp-components', 'wp-media-utils', 'wp-patterns', 'wp-preferences'),
 	),
-	array(
-		'handle' => 'wp-edit-site',
-		'path' => 'edit-site/style',
-		'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-commands', 'wp-components', 'wp-editor', 'wp-patterns', 'wp-preferences', 'wp-widgets'),
-	),
 	array(
 		'handle' => 'wp-block-editor',
 		'path' => 'block-editor/style',
 		'dependencies' => array('wp-commands', 'wp-components', 'wp-preferences'),
 	),
+	array(
+		'handle' => 'wp-edit-site',
+		'path' => 'edit-site/style',
+		'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-commands', 'wp-components', 'wp-editor', 'wp-patterns', 'wp-preferences', 'wp-widgets'),
+	),
 );
diff --git a/wp-includes/js/dist/script-modules/index.php b/wp-includes/js/dist/script-modules/index.php
index d1589d51ab..eda5e9a72c 100644
--- a/wp-includes/js/dist/script-modules/index.php
+++ b/wp-includes/js/dist/script-modules/index.php
@@ -12,36 +12,16 @@ return array(
 		'path' => 'a11y/index',
 		'asset' => 'a11y/index.min.asset.php',
 	),
-	array(
-		'id' => '@wordpress/core-abilities',
-		'path' => 'core-abilities/index',
-		'asset' => 'core-abilities/index.min.asset.php',
-	),
 	array(
 		'id' => '@wordpress/interactivity',
 		'path' => 'interactivity/index',
 		'asset' => 'interactivity/index.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/abilities',
 		'path' => 'abilities/index',
 		'asset' => 'abilities/index.min.asset.php',
 	),
-	array(
-		'id' => '@wordpress/route',
-		'path' => 'route/index',
-		'asset' => 'route/index.min.asset.php',
-	),
 	array(
 		'id' => '@wordpress/latex-to-mathml',
 		'path' => 'latex-to-mathml/index',
@@ -52,6 +32,26 @@ return array(
 		'path' => 'latex-to-mathml/loader',
 		'asset' => 'latex-to-mathml/loader.min.asset.php',
 	),
+	array(
+		'id' => '@wordpress/core-abilities',
+		'path' => 'core-abilities/index',
+		'asset' => 'core-abilities/index.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/route',
+		'path' => 'route/index',
+		'asset' => 'route/index.min.asset.php',
+	),
 	array(
 		'id' => '@wordpress/edit-site-init',
 		'path' => 'edit-site-init/index',
diff --git a/wp-includes/update.php b/wp-includes/update.php
index 4ab8f5a4e4..b7bf5a0378 100644
--- a/wp-includes/update.php
+++ b/wp-includes/update.php
@@ -101,7 +101,7 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
 		'php'                => $php_version,
 		'locale'             => $locale,
 		'mysql'              => $mysql_version,
-		'local_package'      => isset( $wp_local_package ) ? $wp_local_package : '',
+		'local_package'      => $wp_local_package ?? '',
 		'blogs'              => $num_blogs,
 		'users'              => get_user_count(),
 		'multisite_enabled'  => $multisite_enabled,
@@ -579,7 +579,7 @@ function wp_update_plugins( $extra_stats = array() ) {
 			foreach ( $update->translations as $translation ) {
 				if ( isset( $translation['language'], $translation['package'] ) ) {
 					$translation['type'] = 'plugin';
-					$translation['slug'] = isset( $update->slug ) ? $update->slug : $update->id;
+					$translation['slug'] = $update->slug ?? $update->id;

 					$updates->translations[] = $translation;
 				}
@@ -856,7 +856,7 @@ function wp_update_themes( $extra_stats = array() ) {
 			foreach ( $update->translations as $translation ) {
 				if ( isset( $translation['language'], $translation['package'] ) ) {
 					$translation['type'] = 'theme';
-					$translation['slug'] = isset( $update->theme ) ? $update->theme : $update->id;
+					$translation['slug'] = $update->theme ?? $update->id;

 					$new_update->translations[] = $translation;
 				}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 14d8fe1244..95c7b25cd7 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.0-alpha-61454';
+$wp_version = '7.0-alpha-61455';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.