Commit 8d213732fb for wordpress.org

commit 8d213732fbbc264166555a1aa5ec07e5db6dfb81
Author: westonruter <westonruter@git.wordpress.org>
Date:   Wed Oct 7 20:45:52 2026 +0000

    I18N: Resolve new PHPStan errors for nooped plurals.

    Since r64232 the localization API requires literal strings, which surfaced five new PHPStan errors. The nooped plurals in the post mime types lost the literal types returned by `_n_noop()` before reaching `translate_nooped_plural()`, because `get_post_mime_types()` documented each one as a bare `array`. Their shape is now declared, including on the `post_mime_types` filter, whose documented type determines the type of the filtered return value.

    Two callers pass runtime values to `_n_noop()` for back-compat: the default `label_count` in `register_post_status()` and the old-style `single_text` and `multiple_text` arguments of `wp_generate_tag_cloud()`. There is nothing to extract for translation in either case, so the errors are ignored inline. Building the nooped plural by hand instead would duplicate its structure and only hide the runtime strings from static analysis.

    Developed in https://github.com/WordPress/wordpress-develop/pull/14088.
    Follow-up to r27376, r40516, r64232.

    See #65817.

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


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

diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index c391353169..a255673aad 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -1412,6 +1412,21 @@ function wp_edit_attachments_query_vars( $q = false ) {
  *     @type array<string, array{0: string, 1: string, 2: array}> $0 Post mime types. See get_post_mime_types().
  *     @type string[]                                             $1 Available post mime types.
  * }
+ *
+ * @phpstan-return array{
+ *     0: array<string, array{
+ *         0: string,
+ *         1: string,
+ *         2: array{
+ *             singular: literal-string,
+ *             plural: literal-string,
+ *             context: literal-string|null,
+ *             domain: literal-string|null,
+ *             ...
+ *         },
+ *     }>,
+ *     1: string[],
+ * }
  */
 function wp_edit_attachments_query( $q = false ) {
 	wp( wp_edit_attachments_query_vars( $q ) );
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index b4c40d2ac9..dbb1ff8ab0 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -896,7 +896,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
 	} elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
 		// If no callback exists, look for the old-style single_text and multiple_text arguments.
 		// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingular,WordPress.WP.I18n.NonSingularStringLiteralPlural
-		$translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] );
+		$translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] ); // @phpstan-ignore argument.type, argument.type (These are runtime values, so there is nothing to extract for translation.)
 	} else {
 		// This is the default for when no callback, plural, or argument is passed in.
 		/* translators: %s: Number of items (tags). */
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 10bb778bbd..3708c578ea 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -1503,7 +1503,7 @@ function register_post_status( $post_status, $args = array() ) {

 	if ( false === $args->label_count ) {
 		// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingular,WordPress.WP.I18n.NonSingularStringLiteralPlural
-		$args->label_count = _n_noop( $args->label, $args->label );
+		$args->label_count = _n_noop( $args->label, $args->label ); // @phpstan-ignore argument.type, argument.type (The label is a runtime value, so there is nothing to extract for translation.)
 	}

 	$wp_post_statuses[ $post_status ] = $args;
@@ -3654,6 +3654,18 @@ function wp_count_attachments( $mime_type = '' ) {
  *                                                              value is a three-item array: the plural name of the
  *                                                              group, the label for its "Manage" screen, and the
  *                                                              translatable count strings returned by _n_noop().
+ *
+ * @phpstan-return array<string, array{
+ *     0: string,
+ *     1: string,
+ *     2: array{
+ *         singular: literal-string,
+ *         plural: literal-string,
+ *         context: literal-string|null,
+ *         domain: literal-string|null,
+ *         ...
+ *     },
+ * }>
  */
 function get_post_mime_types() {
 	$post_mime_types = array(   // array( adj, noun )
@@ -3748,6 +3760,18 @@ function get_post_mime_types() {
 	 *
 	 * @param array<string, array{0: string, 1: string, 2: array}> $post_mime_types Default list of post mime types.
 	 *                                                                              See {@see get_post_mime_types()}.
+	 *
+	 * @phpstan-param array<string, array{
+	 *     0: string,
+	 *     1: string,
+	 *     2: array{
+	 *         singular: literal-string,
+	 *         plural: literal-string,
+	 *         context: literal-string|null,
+	 *         domain: literal-string|null,
+	 *         ...
+	 *     },
+	 * }> $post_mime_types
 	 */
 	return apply_filters( 'post_mime_types', $post_mime_types );
 }
diff --git a/wp-includes/version.php b/wp-includes/version.php
index aca486e651..4d9f1df09e 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64233';
+$wp_version = '7.2-alpha-64234';

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