wp/wp-admin/includes/class-wp-ms-sites-list-table.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
--- a/wp/wp-admin/includes/class-wp-ms-sites-list-table.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-admin/includes/class-wp-ms-sites-list-table.php	Tue Sep 27 16:37:53 2022 +0200
@@ -396,10 +396,14 @@
 	 * Handles the checkbox column output.
 	 *
 	 * @since 4.3.0
+	 * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
 	 *
-	 * @param array $blog Current site.
+	 * @param array $item Current site.
 	 */
-	public function column_cb( $blog ) {
+	public function column_cb( $item ) {
+		// Restores the more descriptive, specific name for use within this method.
+		$blog = $item;
+
 		if ( ! is_main_site( $blog['blog_id'] ) ) :
 			$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
 			?>
@@ -560,11 +564,12 @@
 	 * Handles output for the default column.
 	 *
 	 * @since 4.3.0
+	 * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
 	 *
-	 * @param array  $blog        Current site.
+	 * @param array  $item        Current site.
 	 * @param string $column_name Current column name.
 	 */
-	public function column_default( $blog, $column_name ) {
+	public function column_default( $item, $column_name ) {
 		/**
 		 * Fires for each registered custom column in the Sites list table.
 		 *
@@ -573,7 +578,7 @@
 		 * @param string $column_name The name of the column to display.
 		 * @param int    $blog_id     The site ID.
 		 */
-		do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
+		do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] );
 	}
 
 	/**
@@ -630,19 +635,24 @@
 		 *
 		 * @since 5.3.0
 		 *
-		 * @param array $site_states An array of site states. Default 'Main',
-		 *                           'Archived', 'Mature', 'Spam', 'Deleted'.
-		 * @param WP_Site $site The current site object.
+		 * @param string[] $site_states An array of site states. Default 'Main',
+		 *                              'Archived', 'Mature', 'Spam', 'Deleted'.
+		 * @param WP_Site  $site        The current site object.
 		 */
 		$site_states = apply_filters( 'display_site_states', $site_states, $_site );
 
 		if ( ! empty( $site_states ) ) {
 			$state_count = count( $site_states );
-			$i           = 0;
+
+			$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>";
 			}
 		}
@@ -663,18 +673,21 @@
 	 * Generates and displays row action links.
 	 *
 	 * @since 4.3.0
+	 * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
 	 *
-	 * @param array  $blog        Site being acted upon.
+	 * @param array  $item        Site being acted upon.
 	 * @param string $column_name Current column name.
 	 * @param string $primary     Primary column name.
 	 * @return string Row actions output for sites in Multisite, or an empty string
 	 *                if the current column is not the primary column.
 	 */
-	protected function handle_row_actions( $blog, $column_name, $primary ) {
+	protected function handle_row_actions( $item, $column_name, $primary ) {
 		if ( $primary !== $column_name ) {
 			return '';
 		}
 
+		// Restores the more descriptive, specific name for use within this method.
+		$blog     = $item;
 		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
 
 		// Preordered.