Skip to content

64643 Remove some obsolete return by refs#10941

Draft
nirav7707 wants to merge 1 commit intoWordPress:trunkfrom
nirav7707:64643-remove-some-obsolete-return-by-refs
Draft

64643 Remove some obsolete return by refs#10941
nirav7707 wants to merge 1 commit intoWordPress:trunkfrom
nirav7707:64643-remove-some-obsolete-return-by-refs

Conversation

@nirav7707
Copy link

@nirav7707 nirav7707 changed the title Update the function's reference passed parameter 64643 Remove some obsolete return by refs Feb 16, 2026
@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@westonruter
Copy link
Member

Take it or leave it, but Gemini CLI found some additional possibilities:

diff --git a/src/wp-admin/includes/class-wp-upgrader-skin.php b/src/wp-admin/includes/class-wp-upgrader-skin.php
index 831da3aeba..4c1615cdd2 100644
--- a/src/wp-admin/includes/class-wp-upgrader-skin.php
+++ b/src/wp-admin/includes/class-wp-upgrader-skin.php
@@ -83,9 +83,9 @@ class WP_Upgrader_Skin {
 	 *
 	 * @param WP_Upgrader $upgrader
 	 */
-	public function set_upgrader( &$upgrader ) {
+	public function set_upgrader( $upgrader ) {
 		if ( is_object( $upgrader ) ) {
-			$this->upgrader =& $upgrader;
+			$this->upgrader = $upgrader;
 		}
 		$this->add_strings();
 	}
diff --git a/src/wp-includes/class-wp-hook.php b/src/wp-includes/class-wp-hook.php
index cd6860c0f8..cf6f5aeaca 100644
--- a/src/wp-includes/class-wp-hook.php
+++ b/src/wp-includes/class-wp-hook.php
@@ -375,9 +375,9 @@ final class WP_Hook implements Iterator, ArrayAccess {
 	 *
 	 * @since 4.7.0
 	 *
-	 * @param array $args Arguments to pass to the hook callbacks. Passed by reference.
+	 * @param array $args Arguments to pass to the hook callbacks.
 	 */
-	public function do_all_hook( &$args ) {
+	public function do_all_hook( $args ) {
 		$nesting_level                      = $this->nesting_level++;
 		$this->iterations[ $nesting_level ] = $this->priorities;
 
diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php
index 390d632492..897b1a48a3 100644
--- a/src/wp-includes/deprecated.php
+++ b/src/wp-includes/deprecated.php
@@ -3111,7 +3111,7 @@ function get_theme_data( $theme_file ) {
  *
  * @param array $pages list of page objects
  */
-function update_page_cache( &$pages ) {
+function update_page_cache( $pages ) {
 	_deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' );
 
 	update_post_cache( $pages );
@@ -3177,9 +3177,9 @@ function sticky_class( $post_id = null ) {
  * @deprecated 3.5.0 Use get_post_ancestors()
  * @see get_post_ancestors()
  *
- * @param WP_Post $post Post object, passed by reference (unused).
+ * @param WP_Post $post Post object (unused).
  */
-function _get_post_ancestors( &$post ) {
+function _get_post_ancestors( $post ) {
 	_deprecated_function( __FUNCTION__, '3.5.0' );
 }
 
diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php
index d90fdfa806..29d8a03944 100644
--- a/src/wp-includes/nav-menu-template.php
+++ b/src/wp-includes/nav-menu-template.php
@@ -324,7 +324,7 @@ function wp_nav_menu( $args = array() ) {
  *
  * @param array $menu_items The current menu item objects to which to add the class property information.
  */
-function _wp_menu_item_classes_by_context( &$menu_items ) {
+function _wp_menu_item_classes_by_context( $menu_items ) {
 	global $wp_query, $wp_rewrite;
 
 	$queried_object    = $wp_query->get_queried_object();
diff --git a/src/wp-includes/pomo/entry.php b/src/wp-includes/pomo/entry.php
index e1b1c8f8c8..48c52384b1 100644
--- a/src/wp-includes/pomo/entry.php
+++ b/src/wp-includes/pomo/entry.php
@@ -114,7 +114,7 @@ if ( ! class_exists( 'Translation_Entry', false ) ) :
 		 *
 		 * @param Translation_Entry $other Other translation entry.
 		 */
-		public function merge_with( &$other ) {
+		public function merge_with( $other ) {
 			$this->flags      = array_unique( array_merge( $this->flags, $other->flags ) );
 			$this->references = array_unique( array_merge( $this->references, $other->references ) );
 			if ( $this->extracted_comments !== $other->extracted_comments ) {
diff --git a/src/wp-includes/pomo/po.php b/src/wp-includes/pomo/po.php
index de1bc92064..594ad80f4e 100644
--- a/src/wp-includes/pomo/po.php
+++ b/src/wp-includes/pomo/po.php
@@ -486,7 +486,7 @@ if ( ! class_exists( 'PO', false ) ) :
 		 * @param Translation_Entry $entry
 		 * @param string            $po_comment_line
 		 */
-		public function add_comment_to_entry( &$entry, $po_comment_line ) {
+		public function add_comment_to_entry( $entry, $po_comment_line ) {
 			$first_two = substr( $po_comment_line, 0, 2 );
 			$comment   = trim( substr( $po_comment_line, 2 ) );
 			if ( '#:' === $first_two ) {
diff --git a/src/wp-includes/pomo/translations.php b/src/wp-includes/pomo/translations.php
index c4a9ba72d6..8d1a2183b9 100644
--- a/src/wp-includes/pomo/translations.php
+++ b/src/wp-includes/pomo/translations.php
@@ -130,7 +130,7 @@ if ( ! class_exists( 'Translations', false ) ) :
 		 * @param Translation_Entry $entry Translation entry.
 		 * @return Translation_Entry|false Translation entry if it exists, false otherwise.
 		 */
-		public function translate_entry( &$entry ) {
+		public function translate_entry( $entry ) {
 			$key = $entry->key();
 			return $this->entries[ $key ] ?? false;
 		}
@@ -220,9 +220,9 @@ if ( ! class_exists( 'Translations', false ) ) :
 		 *
 		 * @since 2.8.0
 		 *
-		 * @param Translations $other Another Translation object, whose translations will be merged in this one (passed by reference).
+		 * @param Translations $other Another Translation object, whose translations will be merged in this one.
 		 */
-		public function merge_with( &$other ) {
+		public function merge_with( $other ) {
 			foreach ( $other->entries as $entry ) {
 				$this->entries[ $entry->key() ] = $entry;
 			}
@@ -235,7 +235,7 @@ if ( ! class_exists( 'Translations', false ) ) :
 		 *
 		 * @param Translations $other
 		 */
-		public function merge_originals_with( &$other ) {
+		public function merge_originals_with( $other ) {
 			foreach ( $other->entries as $entry ) {
 				if ( ! isset( $this->entries[ $entry->key() ] ) ) {
 					$this->entries[ $entry->key() ] = $entry;
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index f4b06958e0..cb7a91d56c 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -6309,10 +6309,10 @@ function get_page_hierarchy( $pages, $page_id = 0 ) {
  * @see _page_traverse_name()
  *
  * @param int      $page_id  Page ID.
- * @param array    $children Parent-children relations (passed by reference).
+ * @param array    $children Parent-children relations.
  * @param string[] $result   Array of page names keyed by ID (passed by reference).
  */
-function _page_traverse_name( $page_id, &$children, &$result ) {
+function _page_traverse_name( $page_id, $children, &$result ) {
 	if ( isset( $children[ $page_id ] ) ) {
 		foreach ( (array) $children[ $page_id ] as $child ) {
 			$result[ $child->ID ] = $child->post_name;
@@ -7678,9 +7678,9 @@ function _get_last_post_time( $timezone, $field, $post_type = 'any' ) {
  *
  * @since 1.5.1
  *
- * @param WP_Post[] $posts Array of post objects (passed by reference).
+ * @param WP_Post[] $posts Array of post objects.
  */
-function update_post_cache( &$posts ) {
+function update_post_cache( $posts ) {
 	if ( ! $posts ) {
 		return;
 	}
@@ -7762,12 +7762,12 @@ function clean_post_cache( $post ) {
  *
  * @since 1.5.0
  *
- * @param WP_Post[] $posts             Array of post objects (passed by reference).
+ * @param WP_Post[] $posts             Array of post objects.
  * @param string    $post_type         Optional. Post type. Default 'post'.
  * @param bool      $update_term_cache Optional. Whether to update the term cache. Default true.
  * @param bool      $update_meta_cache Optional. Whether to update the meta cache. Default true.
  */
-function update_post_caches( &$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true ) {
+function update_post_caches( $posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true ) {
 	// No point in doing all this work if we didn't match any posts.
 	if ( ! $posts ) {
 		return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants