Coding Standards: Use strict comparison for static strings in `wp-admin/includes/class-wp-list-table.php`.

Follow-up to [55971], [56004].

See #32170, #57839.
Built from https://develop.svn.wordpress.org/trunk@56260


git-svn-id: http://core.svn.wordpress.org/trunk@55772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-07-18 14:05:29 +00:00
parent 944c46e091
commit c0adc40452
2 changed files with 11 additions and 8 deletions

View File

@ -1115,7 +1115,7 @@ class WP_List_Table {
* *
* In the second format, passing true as second parameter will make the initial * In the second format, passing true as second parameter will make the initial
* sorting order be descending. Following parameters add a short column name to * sorting order be descending. Following parameters add a short column name to
* be used as 'abbr' attribute, a translatable string for the current sorting * be used as 'abbr' attribute, a translatable string for the current sorting,
* and the initial order for the initial sorted column, 'asc' or 'desc' (default: false). * and the initial order for the initial sorted column, 'asc' or 'desc' (default: false).
* *
* @since 3.1.0 * @since 3.1.0
@ -1325,10 +1325,10 @@ class WP_List_Table {
} }
// Not in the initial view and descending order. // Not in the initial view and descending order.
if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) { if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
$current_order = 'desc'; $current_order = 'desc';
} else { } else {
// The initial view is not always 'asc' we'll take care of this below. // The initial view is not always 'asc', we'll take care of this below.
$current_order = 'asc'; $current_order = 'asc';
} }
@ -1388,13 +1388,14 @@ class WP_List_Table {
*/ */
if ( $current_orderby === $orderby ) { if ( $current_orderby === $orderby ) {
// The sorted column. The `aria-sort` attribute must be set only on the sorted column. // The sorted column. The `aria-sort` attribute must be set only on the sorted column.
if ( 'asc' == $current_order ) { if ( 'asc' === $current_order ) {
$order = 'desc'; $order = 'desc';
$aria_sort_attr = ' aria-sort="ascending"'; $aria_sort_attr = ' aria-sort="ascending"';
} else { } else {
$order = 'asc'; $order = 'asc';
$aria_sort_attr = ' aria-sort="descending"'; $aria_sort_attr = ' aria-sort="descending"';
} }
$class[] = 'sorted'; $class[] = 'sorted';
$class[] = $current_order; $class[] = $current_order;
} else { } else {
@ -1407,12 +1408,14 @@ class WP_List_Table {
$class[] = 'sortable'; $class[] = 'sortable';
$class[] = 'desc' === $order ? 'asc' : 'desc'; $class[] = 'desc' === $order ? 'asc' : 'desc';
/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
$asc_text = __( 'Sort ascending.' ); $asc_text = __( 'Sort ascending.' );
/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
$desc_text = __( 'Sort descending.' ); $desc_text = __( 'Sort descending.' );
$order_text = 'asc' === $order ? $asc_text : $desc_text; $order_text = 'asc' === $order ? $asc_text : $desc_text;
} }
if ( '' !== $order_text ) { if ( '' !== $order_text ) {
$order_text = ' <span class="screen-reader-text">' . $order_text . '</span>'; $order_text = ' <span class="screen-reader-text">' . $order_text . '</span>';
} }
@ -1459,10 +1462,10 @@ class WP_List_Table {
} }
// Not in the initial view and descending order. // Not in the initial view and descending order.
if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) { if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
$current_order = 'desc'; $current_order = 'desc';
} else { } else {
// The initial view is not always 'asc' we'll take care of this below. // The initial view is not always 'asc', we'll take care of this below.
$current_order = 'asc'; $current_order = 'asc';
} }
@ -1493,7 +1496,7 @@ class WP_List_Table {
* True in the initial view when an initial orderby is set via get_sortable_columns() * True in the initial view when an initial orderby is set via get_sortable_columns()
* and true in the sorted views when the actual $_GET['orderby'] is equal to $orderby. * and true in the sorted views when the actual $_GET['orderby'] is equal to $orderby.
*/ */
if ( $current_orderby == $orderby ) { if ( $current_orderby === $orderby ) {
/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
$asc_text = __( 'Ascending.' ); $asc_text = __( 'Ascending.' );
/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.3-beta4-56259'; $wp_version = '6.3-beta4-56260';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.