Skip to content

Commit c444544

Browse files
committed
Code Modernization: Bootstrap/Load: Use null coalescing operator instead of isset() ternaries.
Developed as a subset of WordPress/wordpress-develop#10654 Initially developed in WordPress/wordpress-develop#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: https://core.svn.wordpress.org/trunk@60755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 76eca31 commit c444544

File tree

6 files changed

+41
-41
lines changed

6 files changed

+41
-41
lines changed

wp-includes/class-wp-paused-extensions-storage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function get_all() {
161161

162162
$paused_extensions = (array) get_option( $option_name, array() );
163163

164-
return isset( $paused_extensions[ $this->type ] ) ? $paused_extensions[ $this->type ] : array();
164+
return $paused_extensions[ $this->type ] ?? array();
165165
}
166166

167167
/**

wp-includes/css/dist/index.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@
77
*/
88

99
return array(
10+
array(
11+
'handle' => 'wp-list-reusable-blocks',
12+
'path' => 'list-reusable-blocks/style',
13+
'dependencies' => array('wp-components'),
14+
),
1015
array(
1116
'handle' => 'wp-nux',
1217
'path' => 'nux/style',
1318
'dependencies' => array('wp-components'),
1419
),
1520
array(
16-
'handle' => 'wp-list-reusable-blocks',
17-
'path' => 'list-reusable-blocks/style',
21+
'handle' => 'wp-commands',
22+
'path' => 'commands/style',
1823
'dependencies' => array('wp-components'),
1924
),
2025
array(
@@ -28,18 +33,13 @@
2833
'dependencies' => array('wp-block-editor', 'wp-components'),
2934
),
3035
array(
31-
'handle' => 'wp-patterns',
32-
'path' => 'patterns/style',
36+
'handle' => 'wp-widgets',
37+
'path' => 'widgets/style',
3338
'dependencies' => array('wp-block-editor', 'wp-components'),
3439
),
3540
array(
36-
'handle' => 'wp-commands',
37-
'path' => 'commands/style',
38-
'dependencies' => array('wp-components'),
39-
),
40-
array(
41-
'handle' => 'wp-widgets',
42-
'path' => 'widgets/style',
41+
'handle' => 'wp-patterns',
42+
'path' => 'patterns/style',
4343
'dependencies' => array('wp-block-editor', 'wp-components'),
4444
),
4545
array(
@@ -52,31 +52,31 @@
5252
'path' => 'format-library/style',
5353
'dependencies' => array('wp-block-editor', 'wp-components'),
5454
),
55-
array(
56-
'handle' => 'wp-block-directory',
57-
'path' => 'block-directory/style',
58-
'dependencies' => array('wp-block-editor', 'wp-components', 'wp-editor'),
59-
),
6055
array(
6156
'handle' => 'wp-media-utils',
6257
'path' => 'media-utils/style',
6358
'dependencies' => array('wp-components'),
6459
),
60+
array(
61+
'handle' => 'wp-block-directory',
62+
'path' => 'block-directory/style',
63+
'dependencies' => array('wp-block-editor', 'wp-components', 'wp-editor'),
64+
),
6565
array(
6666
'handle' => 'wp-customize-widgets',
6767
'path' => 'customize-widgets/style',
6868
'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-components', 'wp-media-utils', 'wp-preferences', 'wp-widgets'),
6969
),
70-
array(
71-
'handle' => 'wp-edit-post',
72-
'path' => 'edit-post/style',
73-
'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-commands', 'wp-components', 'wp-editor', 'wp-preferences', 'wp-widgets'),
74-
),
7570
array(
7671
'handle' => 'wp-edit-widgets',
7772
'path' => 'edit-widgets/style',
7873
'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-components', 'wp-media-utils', 'wp-patterns', 'wp-preferences', 'wp-widgets'),
7974
),
75+
array(
76+
'handle' => 'wp-edit-post',
77+
'path' => 'edit-post/style',
78+
'dependencies' => array('wp-block-editor', 'wp-block-library', 'wp-commands', 'wp-components', 'wp-editor', 'wp-preferences', 'wp-widgets'),
79+
),
8080
array(
8181
'handle' => 'wp-block-library',
8282
'path' => 'block-library/style',

wp-includes/error-protection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function wp_paused_themes() {
4646
*/
4747
function wp_get_extension_error_description( $error ) {
4848
$constants = get_defined_constants( true );
49-
$constants = isset( $constants['Core'] ) ? $constants['Core'] : $constants['internal'];
49+
$constants = $constants['Core'] ?? $constants['internal'];
5050
$core_errors = array();
5151

5252
foreach ( $constants as $constant => $value ) {

wp-includes/js/dist/script-modules/index.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,11 @@
77
*/
88

99
return array(
10-
array(
11-
'id' => '@wordpress/interactivity-router',
12-
'path' => 'interactivity-router/index',
13-
'asset' => 'interactivity-router/index.min.asset.php',
14-
),
15-
array(
16-
'id' => '@wordpress/interactivity-router/full-page',
17-
'path' => 'interactivity-router/full-page',
18-
'asset' => 'interactivity-router/full-page.min.asset.php',
19-
),
2010
array(
2111
'id' => '@wordpress/interactivity',
2212
'path' => 'interactivity/index',
2313
'asset' => 'interactivity/index.min.asset.php',
2414
),
25-
array(
26-
'id' => '@wordpress/abilities',
27-
'path' => 'abilities/index',
28-
'asset' => 'abilities/index.min.asset.php',
29-
),
3015
array(
3116
'id' => '@wordpress/latex-to-mathml',
3217
'path' => 'latex-to-mathml/index',
@@ -37,6 +22,21 @@
3722
'path' => 'latex-to-mathml/loader',
3823
'asset' => 'latex-to-mathml/loader.min.asset.php',
3924
),
25+
array(
26+
'id' => '@wordpress/interactivity-router',
27+
'path' => 'interactivity-router/index',
28+
'asset' => 'interactivity-router/index.min.asset.php',
29+
),
30+
array(
31+
'id' => '@wordpress/interactivity-router/full-page',
32+
'path' => 'interactivity-router/full-page',
33+
'asset' => 'interactivity-router/full-page.min.asset.php',
34+
),
35+
array(
36+
'id' => '@wordpress/abilities',
37+
'path' => 'abilities/index',
38+
'asset' => 'abilities/index.min.asset.php',
39+
),
4040
array(
4141
'id' => '@wordpress/a11y',
4242
'path' => 'a11y/index',

wp-includes/load.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @return string The HTTP protocol. Default: HTTP/1.0.
1414
*/
1515
function wp_get_server_protocol() {
16-
$protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : '';
16+
$protocol = $_SERVER['SERVER_PROTOCOL'] ?? '';
1717

1818
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
1919
$protocol = 'HTTP/1.0';
@@ -115,7 +115,7 @@ function wp_populate_basic_auth_from_authorization_header() {
115115
}
116116

117117
// From our prior conditional, one of these must be set.
118-
$header = isset( $_SERVER['HTTP_AUTHORIZATION'] ) ? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
118+
$header = $_SERVER['HTTP_AUTHORIZATION'] ?? $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
119119

120120
// Test to make sure the pattern matches expected.
121121
if ( ! preg_match( '%^Basic [a-z\d/+]*={0,2}$%i', $header ) ) {

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '7.0-alpha-61442';
19+
$wp_version = '7.0-alpha-61443';
2020

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

0 commit comments

Comments
 (0)