wp/wp-includes/class-walker-comment.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
--- a/wp/wp-includes/class-walker-comment.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/class-walker-comment.php	Tue Sep 27 16:37:53 2022 +0200
@@ -30,7 +30,7 @@
 	 * Database fields to use.
 	 *
 	 * @since 2.7.0
-	 * @var array
+	 * @var string[]
 	 *
 	 * @see Walker::$db_fields
 	 * @todo Decouple this
@@ -157,19 +157,24 @@
 	 * Starts the element output.
 	 *
 	 * @since 2.7.0
+	 * @since 5.9.0 Renamed `$comment` to `$data_object` and `$id` to `$current_object_id`
+	 *              to match parent class for PHP 8 named parameter support.
 	 *
 	 * @see Walker::start_el()
 	 * @see wp_list_comments()
 	 * @global int        $comment_depth
 	 * @global WP_Comment $comment       Global comment object.
 	 *
-	 * @param string     $output  Used to append additional content. Passed by reference.
-	 * @param WP_Comment $comment Comment data object.
-	 * @param int        $depth   Optional. Depth of the current comment in reference to parents. Default 0.
-	 * @param array      $args    Optional. An array of arguments. Default empty array.
-	 * @param int        $id      Optional. ID of the current comment. Default 0 (unused).
+	 * @param string     $output            Used to append additional content. Passed by reference.
+	 * @param WP_Comment $data_object       Comment data object.
+	 * @param int        $depth             Optional. Depth of the current comment in reference to parents. Default 0.
+	 * @param array      $args              Optional. An array of arguments. Default empty array.
+	 * @param int        $current_object_id Optional. ID of the current comment. Default 0.
 	 */
-	public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
+	public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
+		// Restores the more descriptive, specific name for use within this method.
+		$comment = $data_object;
+
 		$depth++;
 		$GLOBALS['comment_depth'] = $depth;
 		$GLOBALS['comment']       = $comment;
@@ -208,19 +213,25 @@
 	 * Ends the element output, if needed.
 	 *
 	 * @since 2.7.0
+	 * @since 5.9.0 Renamed `$comment` to `$data_object` to match parent class for PHP 8 named parameter support.
 	 *
 	 * @see Walker::end_el()
 	 * @see wp_list_comments()
 	 *
-	 * @param string     $output  Used to append additional content. Passed by reference.
-	 * @param WP_Comment $comment The current comment object. Default current comment.
-	 * @param int        $depth   Optional. Depth of the current comment. Default 0.
-	 * @param array      $args    Optional. An array of arguments. Default empty array.
+	 * @param string     $output      Used to append additional content. Passed by reference.
+	 * @param WP_Comment $data_object Comment data object.
+	 * @param int        $depth       Optional. Depth of the current comment. Default 0.
+	 * @param array      $args        Optional. An array of arguments. Default empty array.
 	 */
-	public function end_el( &$output, $comment, $depth = 0, $args = array() ) {
+	public function end_el( &$output, $data_object, $depth = 0, $args = array() ) {
 		if ( ! empty( $args['end-callback'] ) ) {
 			ob_start();
-			call_user_func( $args['end-callback'], $comment, $args, $depth );
+			call_user_func(
+				$args['end-callback'],
+				$data_object, // The current comment object.
+				$args,
+				$depth
+			);
 			$output .= ob_get_clean();
 			return;
 		}