Code Modernization: Bootstrap/Load: 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 [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@61443


git-svn-id: http://core.svn.wordpress.org/trunk@60755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter
2026-01-06 05:36:58 +00:00
parent 56076b1bc4
commit 00674c45be
6 changed files with 41 additions and 41 deletions

View File

@@ -161,7 +161,7 @@ class WP_Paused_Extensions_Storage {
$paused_extensions = (array) get_option( $option_name, array() );
return isset( $paused_extensions[ $this->type ] ) ? $paused_extensions[ $this->type ] : array();
return $paused_extensions[ $this->type ] ?? array();
}
/**

View File

@@ -7,14 +7,19 @@
*/
return array(
array(
'handle' => 'wp-list-reusable-blocks',
'path' => 'list-reusable-blocks/style',
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-nux',
'path' => 'nux/style',
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-list-reusable-blocks',
'path' => 'list-reusable-blocks/style',
'handle' => 'wp-commands',
'path' => 'commands/style',
'dependencies' => array('wp-components'),
),
array(
@@ -28,18 +33,13 @@ return array(
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
'handle' => 'wp-patterns',
'path' => 'patterns/style',
'handle' => 'wp-widgets',
'path' => 'widgets/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
'handle' => 'wp-commands',
'path' => 'commands/style',
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-widgets',
'path' => 'widgets/style',
'handle' => 'wp-patterns',
'path' => 'patterns/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
@@ -52,31 +52,31 @@ return array(
'path' => 'format-library/style',
'dependencies' => array('wp-block-editor', 'wp-components'),
),
array(
'handle' => 'wp-block-directory',
'path' => 'block-directory/style',
'dependencies' => array('wp-block-editor', 'wp-components', 'wp-editor'),
),
array(
'handle' => 'wp-media-utils',
'path' => 'media-utils/style',
'dependencies' => array('wp-components'),
),
array(
'handle' => 'wp-block-directory',
'path' => 'block-directory/style',
'dependencies' => array('wp-block-editor', 'wp-components', 'wp-editor'),
),
array(
'handle' => 'wp-customize-widgets',
'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-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',

View File

@@ -46,7 +46,7 @@ function wp_paused_themes() {
*/
function wp_get_extension_error_description( $error ) {
$constants = get_defined_constants( true );
$constants = isset( $constants['Core'] ) ? $constants['Core'] : $constants['internal'];
$constants = $constants['Core'] ?? $constants['internal'];
$core_errors = array();
foreach ( $constants as $constant => $value ) {

View File

@@ -7,6 +7,21 @@
*/
return array(
array(
'id' => '@wordpress/interactivity',
'path' => 'interactivity/index',
'asset' => 'interactivity/index.min.asset.php',
),
array(
'id' => '@wordpress/latex-to-mathml',
'path' => 'latex-to-mathml/index',
'asset' => 'latex-to-mathml/index.min.asset.php',
),
array(
'id' => '@wordpress/latex-to-mathml/loader',
'path' => 'latex-to-mathml/loader',
'asset' => 'latex-to-mathml/loader.min.asset.php',
),
array(
'id' => '@wordpress/interactivity-router',
'path' => 'interactivity-router/index',
@@ -17,26 +32,11 @@ return array(
'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',
'asset' => 'latex-to-mathml/index.min.asset.php',
),
array(
'id' => '@wordpress/latex-to-mathml/loader',
'path' => 'latex-to-mathml/loader',
'asset' => 'latex-to-mathml/loader.min.asset.php',
),
array(
'id' => '@wordpress/a11y',
'path' => 'a11y/index',

View File

@@ -13,7 +13,7 @@
* @return string The HTTP protocol. Default: HTTP/1.0.
*/
function wp_get_server_protocol() {
$protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : '';
$protocol = $_SERVER['SERVER_PROTOCOL'] ?? '';
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
$protocol = 'HTTP/1.0';
@@ -115,7 +115,7 @@ function wp_populate_basic_auth_from_authorization_header() {
}
// From our prior conditional, one of these must be set.
$header = isset( $_SERVER['HTTP_AUTHORIZATION'] ) ? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
$header = $_SERVER['HTTP_AUTHORIZATION'] ?? $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
// Test to make sure the pattern matches expected.
if ( ! preg_match( '%^Basic [a-z\d/+]*={0,2}$%i', $header ) ) {

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '7.0-alpha-61442';
$wp_version = '7.0-alpha-61443';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.