Coding Standards: Remove duplicate assignment from a ternary operator in `WP_MS_Sites_List_Table::site_states()`.

Adjust similar code in `_post_states()` and `_media_states()` for consistency.

Follow-up to:
* [12897], [15491], [32755], [46153], [48424] for `WP_MS_Sites_List_Table::site_states()`.
* [17793], [47775], [49223] for `_media_states()`.
* [9153], [46309] for `_post_states()`.

Props joelcj91, audrasjb, desrosj.
Fixes #38296.
Built from https://develop.svn.wordpress.org/trunk@51873


git-svn-id: http://core.svn.wordpress.org/trunk@51466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-09-27 00:37:01 +00:00
parent e85dab2fa8
commit 8c52bfe712
3 changed files with 18 additions and 7 deletions

View File

@ -643,11 +643,16 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
if ( ! empty( $site_states ) ) {
$state_count = count( $site_states );
$i = 0;
echo ' — ';
foreach ( $site_states as $state ) {
++$i;
( $i == $state_count ) ? $sep = '' : $sep = ', ';
$sep = ( $i < $state_count ) ? ', ' : '';
echo "<span class='post-state'>{$state}{$sep}</span>";
}
}

View File

@ -2145,12 +2145,15 @@ function _post_states( $post, $echo = true ) {
if ( ! empty( $post_states ) ) {
$state_count = count( $post_states );
$i = 0;
$post_states_string .= ' &mdash; ';
foreach ( $post_states as $state ) {
$sep = ( ++$i === $state_count ) ? '' : ', ';
++$i;
$sep = ( $i < $state_count ) ? ', ' : '';
$post_states_string .= "<span class='post-state'>$state$sep</span>";
}
@ -2255,12 +2258,15 @@ function _media_states( $post, $echo = true ) {
if ( ! empty( $media_states ) ) {
$state_count = count( $media_states );
$i = 0;
$media_states_string .= ' &mdash; ';
foreach ( $media_states as $state ) {
$sep = ( ++$i === $state_count ) ? '' : ', ';
++$i;
$sep = ( $i < $state_count ) ? ', ' : '';
$media_states_string .= "<span class='post-state'>$state$sep</span>";
}

View File

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