Commit 96df03189d for wordpress.org

commit 96df03189d31bb559ecf89367f48ff496eccf3b2
Author: westonruter <westonruter@git.wordpress.org>
Date:   Mon Sep 7 05:34:50 2026 +0000

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

    The `@param` and `@return` tags have documented a bare `array` since the function was introduced in r15574, so nothing was known about the slice it returns. They now describe the string-keyed arrays the function accepts, PHPStan generics bind the returned key set to the `$keys` argument so that a call passing a known list of keys resolves to those keys rather than to `string`. The signature also gains a native `array` return type.

    Developed in https://github.com/WordPress/wordpress-develop/pull/13417.
    Follow-up to r15574.

    See #65817, #65860.

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


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

diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index e9256bf0a1..3d9cedb7ec 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -5127,11 +5127,17 @@ function wp_parse_slug_list( $input_list ): array {
  *
  * @since 3.1.0
  *
- * @param array $input_array The original array.
- * @param array $keys        The list of keys.
- * @return array The array slice.
+ * @param array<string, mixed> $input_array The original array.
+ * @param string[]             $keys        The list of keys.
+ * @return array<string, mixed> The array slice.
+ *
+ * @phpstan-template TKey of string
+ * @phpstan-template TValue
+ * @phpstan-param array<string, TValue> $input_array
+ * @phpstan-param array<TKey> $keys
+ * @phpstan-return array<TKey, TValue>
  */
-function wp_array_slice_assoc( $input_array, $keys ) {
+function wp_array_slice_assoc( $input_array, $keys ): array {
 	$slice = array();

 	foreach ( $keys as $key ) {
diff --git a/wp-includes/version.php b/wp-includes/version.php
index a4b332e594..d5a5fecdc7 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-63510';
+$wp_version = '7.2-alpha-63511';

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