Commit de8fe30e2f for wordpress.org

commit de8fe30e2feaead024c2a52ffe01743c07c52044
Author: westonruter <westonruter@git.wordpress.org>
Date:   Mon Sep 7 23:15:50 2026 +0000

    Code Quality: Improve typing for `wp_parse_args()`.

    Both the parameters and the return value have been documented as a bare `array` since the function entered trunk in r5234. They now describe the string-keyed arrays it is used with, and the signature gains a native `array` return type. Every caller treats those keys as strings, but the function cannot guarantee it, since `get_object_vars()` reports a numeric-string property under an integer key and `parse_str()` reads `0=a` as one, so the `@phpstan-return` records what can actually come back.

    Developed in https://github.com/WordPress/wordpress-develop/pull/13430.
    Follow-up to r5234, r47429.

    See #65817, #65860.

    Built from https://develop.svn.wordpress.org/trunk@63522


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

diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 3d9cedb7ec..4c32381299 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -5021,15 +5021,22 @@ function smilies_init() {
  * This function is used throughout WordPress to allow for both string or array
  * to be merged into another array.
  *
+ * The keys of the returned array are documented as strings, since that is what
+ * callers mean by them, but they are not promised as such to static analysis.
+ * Integer keys remain reachable through arguments that are perfectly valid:
+ * `json_decode( '{"0":"a"}' )` is an object whose properties `get_object_vars()`
+ * reports under an integer key, and `parse_str()` reads `0=a` as one as well.
+ *
  * @since 2.2.0
  * @since 2.3.0 `$args` can now also be an object.
  *
- * @param string|array|object $args     Value to merge with $defaults.
- * @param array               $defaults Optional. Array that serves as the defaults.
- *                                      Default empty array.
- * @return array Merged user defined values with defaults.
+ * @param string|array<string, mixed>|object $args     Value to merge with $defaults.
+ * @param array<string, mixed>               $defaults Optional. Array that serves as the defaults.
+ *                                                     Default empty array.
+ * @return array<string, mixed> Merged user defined values with defaults.
+ * @phpstan-return array<array-key, mixed>
  */
-function wp_parse_args( $args, $defaults = array() ) {
+function wp_parse_args( $args, $defaults = array() ): array {
 	if ( is_object( $args ) ) {
 		$parsed_args = get_object_vars( $args );
 	} elseif ( is_array( $args ) ) {
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 367cf1d1fd..8a1c40f6b0 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-63521';
+$wp_version = '7.2-alpha-63522';

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