Skip to content

Commit fd35afa

Browse files
committed
Code Modernization: Use null coalescing operator in additional isset() ternaries.
These had been missed previously due to additional parentheses around the `isset()` expressions. Developed in #10704 Follow-up to [61463], [61457], [61456], [61455], [61454], [61453], [61445], [61444], [61443], [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403]. Props soean. See #58874, #63430. git-svn-id: https://develop.svn.wordpress.org/trunk@61464 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a8f43c5 commit fd35afa

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/wp-admin/includes/class-wp-comments-list-table.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ public function prepare_items() {
105105
$comment_type = $_REQUEST['comment_type'];
106106
}
107107

108-
$search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : '';
108+
$search = $_REQUEST['s'] ?? '';
109109

110110
$post_type = ( isset( $_REQUEST['post_type'] ) ) ? sanitize_key( $_REQUEST['post_type'] ) : '';
111111

112-
$user_id = ( isset( $_REQUEST['user_id'] ) ) ? $_REQUEST['user_id'] : '';
112+
$user_id = $_REQUEST['user_id'] ?? '';
113113

114-
$orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : '';
115-
$order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : '';
114+
$orderby = $_REQUEST['orderby'] ?? '';
115+
$order = $_REQUEST['order'] ?? '';
116116

117117
$comments_per_page = $this->get_per_page( $comment_status );
118118

src/wp-admin/network/edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/** Load WordPress Administration Bootstrap */
1111
require_once __DIR__ . '/admin.php';
1212

13-
$action = ( isset( $_GET['action'] ) ) ? $_GET['action'] : '';
13+
$action = $_GET['action'] ?? '';
1414

1515
if ( empty( $action ) ) {
1616
wp_redirect( network_admin_url() );

src/wp-includes/class-wp-xmlrpc-server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4449,7 +4449,7 @@ public function wp_getMediaLibrary( $args ) {
44494449
do_action( 'xmlrpc_call', 'wp.getMediaLibrary', $args, $this );
44504450

44514451
$parent_id = ( isset( $struct['parent_id'] ) ) ? absint( $struct['parent_id'] ) : '';
4452-
$mime_type = ( isset( $struct['mime_type'] ) ) ? $struct['mime_type'] : '';
4452+
$mime_type = $struct['mime_type'] ?? '';
44534453
$offset = ( isset( $struct['offset'] ) ) ? absint( $struct['offset'] ) : 0;
44544454
$number = ( isset( $struct['number'] ) ) ? absint( $struct['number'] ) : -1;
44554455

src/wp-includes/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3351,7 +3351,7 @@ function wp_get_image_mime( $file ) {
33513351
$imagesize = @getimagesize( $file );
33523352
}
33533353

3354-
$mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false;
3354+
$mime = $imagesize['mime'] ?? false;
33553355
} else {
33563356
$mime = false;
33573357
}

src/wp-includes/post-formats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function get_post_format_string( $slug ) {
134134
if ( ! $slug ) {
135135
return $strings['standard'];
136136
} else {
137-
return ( isset( $strings[ $slug ] ) ) ? $strings[ $slug ] : '';
137+
return $strings[ $slug ] ?? '';
138138
}
139139
}
140140

0 commit comments

Comments
 (0)