I18N: Correct the case of the MO class in a WP_Locale_Switcher docblock - #12938
I18N: Correct the case of the MO class in a WP_Locale_Switcher docblock#12938CallumBW95 wants to merge 1 commit into
Conversation
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.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
This is what I'm talking about! 🎉 |
Corrects the
@globalannotation for$l10ninWP_Locale_Switcher::load_translations(), which documented the array asMo[].The class is
MO, defined inwp-includes/pomo/mo.php; no class namedMoexists. Every other
@globalannotation for$l10nin core already usesMO[], so this was the sole outlier. The description is also clarified to notethat the array is keyed by text domain.
This was the only remaining
class.nameCaseoccurrence, so the change emptiestests/phpstan/baselines/class.nameCase.neon. As the baseline header directs,the file is deleted along with its
includesentry inphpstan.neon.dist. Thebaseline was regenerated with
composer phpstan:baselines -- --identifier=class.nameCase, not edited by hand.Background
git blamedates the annotation to [38961] (2016-10-26), the changeset thatintroduced
WP_Locale_Switcher. It has been present in every revision of thefile since — roughly nine years — and was never copied elsewhere, which is why
the rest of core is already consistent.
Testing instructions
npm run typecheck:phpontrunkreports[OK] No errors, because theoccurrence is baselined.
tests/phpstan/baselines/class.nameCase.neonand itsincludesentry,then re-run: PHPStan reports
Class MO referenced with incorrect case: Mo.atsrc/wp-includes/class-wp-locale-switcher.php:241.npm run typecheck:phpreports[OK] No errorswith the baseline gone.
npm run test:phpis unchanged: 30774 tests, 4559286 assertions,86 warnings, 44 skipped, exit 0 — identical before and after.
Documentation-only change; no runtime behaviour is affected.
Trac ticket: https://core.trac.wordpress.org/ticket/65817
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: locating the occurrence via the PHPStan
class.nameCasebaseline,git blame/git log -Sarchaeology to date the annotation, and drafting thisdescription. The change itself, the baseline regeneration, and verification
against the full PHPUnit and PHPStan runs were reviewed and confirmed by me in a
local development environment.