Commit cf140bc634 for wordpress.org

commit cf140bc6342811f2b7b03a44f0b07b9677ea1bc7
Author: SergeyBiryukov <sergeybiryukov@git.wordpress.org>
Date:   Sat Nov 14 23:49:09 2026 +0000

    Code Modernization: Use the null coalescing assignment operator for installer API arguments.

    Replaces verbose `! isset()` guard blocks that assign default values in `plugins_api()` and `themes_api()` with the null coalescing assignment operator (`??=`):

    {{{#!php
    <?php
    // Before
    if ( 'query_plugins' === $action ) {
            if ( ! isset( $args->per_page ) ) {
                    $args->per_page = 24;
            }
    }

    if ( ! isset( $args->locale ) ) {
            $args->locale = get_user_locale();
    }

    if ( ! isset( $args->wp_version ) ) {
            $args->wp_version = substr( wp_get_wp_version(), 0, 3 );
    }

    // After
    if ( 'query_plugins' === $action ) {
            $args->per_page ??= 24;
    }

    $args->locale     ??= get_user_locale();
    $args->wp_version ??= substr( wp_get_wp_version(), 0, 3 );
    }}}

    Both installer API functions normalize their arguments using the same idiom, so the two functions now read identically. 6 guard blocks replaced, 20 lines removed for 6 added.

    **Scope**

    This covers `plugins_api()` in `src/wp-admin/includes/plugin-install.php` and `themes_api()` in `src/wp-admin/includes/theme.php` completely: every guard in those two functions that `??=` can express is converted, so the two installer API functions are internally consistent rather than half-modernized.

    **Why this is safe**

    - `??=` requires PHP 7.4, which is already the minimum supported version.
    - `??=` and `! isset()` test the same condition, so the default is applied in exactly the same cases.
    - Assignment order is preserved.
    - No behavior change; this is a purely internal syntax simplification.

    Props noruzzaman.
    See #65823.
    Built from https://develop.svn.wordpress.org/trunk@65529


    git-svn-id: http://core.svn.wordpress.org/trunk@64602 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php
index 496b7ffd36..0a93e4cc75 100644
--- a/wp-admin/includes/plugin-install.php
+++ b/wp-admin/includes/plugin-install.php
@@ -103,18 +103,11 @@ function plugins_api( $action, $args = array() ) {
 	}

 	if ( 'query_plugins' === $action ) {
-		if ( ! isset( $args->per_page ) ) {
-			$args->per_page = 24;
-		}
-	}
-
-	if ( ! isset( $args->locale ) ) {
-		$args->locale = get_user_locale();
+		$args->per_page ??= 24;
 	}

-	if ( ! isset( $args->wp_version ) ) {
-		$args->wp_version = substr( wp_get_wp_version(), 0, 3 ); // x.y
-	}
+	$args->locale     ??= get_user_locale();
+	$args->wp_version ??= substr( wp_get_wp_version(), 0, 3 ); // x.y

 	/**
 	 * Filters the WordPress.org Plugin Installation API arguments.
diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php
index 7f92fed1b2..44e6651f09 100644
--- a/wp-admin/includes/theme.php
+++ b/wp-admin/includes/theme.php
@@ -494,18 +494,11 @@ function themes_api( $action, $args = array() ) {
 	}

 	if ( 'query_themes' === $action ) {
-		if ( ! isset( $args->per_page ) ) {
-			$args->per_page = 24;
-		}
-	}
-
-	if ( ! isset( $args->locale ) ) {
-		$args->locale = get_user_locale();
+		$args->per_page ??= 24;
 	}

-	if ( ! isset( $args->wp_version ) ) {
-		$args->wp_version = substr( wp_get_wp_version(), 0, 3 ); // x.y
-	}
+	$args->locale     ??= get_user_locale();
+	$args->wp_version ??= substr( wp_get_wp_version(), 0, 3 ); // x.y

 	/**
 	 * Filters arguments used to query for installer pages from the WordPress.org Themes API.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index a0c3c6970f..5e5a6ca522 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-beta5-65528';
+$wp_version = '7.2-beta5-65529';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.