From b29a96da645aaeed12c631eb151abe27705396a6 Mon Sep 17 00:00:00 2001 From: Callum Bridgford-Whittick Date: Fri, 7 Aug 2026 18:05:23 +0100 Subject: [PATCH] I18N: Correct the case of the MO class in a WP_Locale_Switcher docblock. The `@global` tag for `$l10n` in `WP_Locale_Switcher::load_translations()` documented the array as `Mo[]`. The class is `MO`, defined in `wp-includes/pomo/mo.php`; no class named `Mo` exists. Every other `@global` annotation for `$l10n` in core already uses `MO[]`, so this was the sole outlier. The description is also clarified to note that the array is keyed by text domain. This empties the `class.nameCase` PHPStan baseline, so the file is removed along with its `includes` entry in `phpstan.neon.dist`. Props CallumBW95. See #65817. --- phpstan.neon.dist | 1 - src/wp-includes/class-wp-locale-switcher.php | 2 +- tests/phpstan/baselines/class.nameCase.neon | 25 -------------------- 3 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 tests/phpstan/baselines/class.nameCase.neon diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3dcf0f6c2c0de..3258c2d9c73e8 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -39,7 +39,6 @@ includes: - tests/phpstan/baselines/booleanOr.alwaysTrue.neon - tests/phpstan/baselines/booleanOr.rightAlwaysTrue.neon - tests/phpstan/baselines/catch.neverThrown.neon - - tests/phpstan/baselines/class.nameCase.neon - tests/phpstan/baselines/class.notFound.neon - tests/phpstan/baselines/deadCode.unreachable.neon - tests/phpstan/baselines/empty.offset.neon diff --git a/src/wp-includes/class-wp-locale-switcher.php b/src/wp-includes/class-wp-locale-switcher.php index 55edef3c9c055..05fbc07a903df 100644 --- a/src/wp-includes/class-wp-locale-switcher.php +++ b/src/wp-includes/class-wp-locale-switcher.php @@ -238,7 +238,7 @@ public function filter_locale( $locale ) { * * @since 4.7.0 * - * @global Mo[] $l10n An array of all currently loaded text domains. + * @global MO[] $l10n An array of all currently loaded text domains, keyed by text domain. * * @param string $locale The locale to load translations for. */ diff --git a/tests/phpstan/baselines/class.nameCase.neon b/tests/phpstan/baselines/class.nameCase.neon deleted file mode 100644 index dd88c5b677aa8..0000000000000 --- a/tests/phpstan/baselines/class.nameCase.neon +++ /dev/null @@ -1,25 +0,0 @@ -# PHPStan baseline for the `class.nameCase` errors in WordPress core. -# -# https://phpstan.org/error-identifiers/class.nameCase -# -# Each entry is scoped to a single file and carries an exact occurrence count, -# so that a new instance is reported as a new error rather than being absorbed -# silently. Fixing an occurrence therefore means decrementing or removing its -# entry here as part of the same change. -# -# The goal is to empty this file and delete it, along with the `includes` entry -# for it in phpstan.neon.dist. -# -# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with -# -# composer phpstan:baselines -- --identifier=class.nameCase -# -# which reruns the analysis with this file suppressed so the errors surface again. - -parameters: - ignoreErrors: - - - message: '#^Class MO referenced with incorrect case\: Mo\.$#' - identifier: class.nameCase - count: 1 - path: ../../../src/wp-includes/class-wp-locale-switcher.php