Skip to content

Commit f7bd33a

Browse files
committed
Code Modernization: Bootstrap/Load: Use null coalescing operator instead of isset() ternaries.
Developed as a subset of #10654 Initially developed in #4886 Follow-up to [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403]. Props costdev, westonruter. See #58874, #63430. git-svn-id: https://develop.svn.wordpress.org/trunk@61443 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 667cffa commit f7bd33a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/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
/**

src/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 ) {

src/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 ) ) {

0 commit comments

Comments
 (0)