Roadmap: lock §5a locale design; reflect shipped work#20
Merged
Conversation
Convert the §5a "Open design questions" into resolved decisions so implementation can start without a round-trip: - Locale is an abstract class holding rule tables as protected instance state, with a concrete regex-rule engine shared across subclasses. Bare Locale interface deferred to a later revision if needed for exotic morphologies. - Rule-table visibility: protected (not private — subclasses seed them; not public — we moved away from mutable shared state in 2.0). Defaults come from protected const class constants on subclasses. - Caching: per-instance, not global. Extension methods mutate instance state and invalidate the instance cache. - Default locale: the static API always uses En. No global setDefaultLocale — avoids action-at-a-distance. - Instance API: new Inflect(Locale|string $locale = 'en'). Inflect::registerLocale(name, LocaleOrClassString) for third parties. Resolution is lazy. - Back-compat: static methods keep signatures; internally delegate to a lazily-initialized shared En instance. Proxy extension methods mutate that shared instance. Also reflect ship state: - §6 docs: largely shipped in #19. - §7 tooling: phpstan + cs-fixer shipped in #18; infection/phpbench deferred. - §8: v2.0.0 tagged 2026-04-13. - Phasing: v2.1 now merges items 5 + 5a (they share the same API surface); v2.2 becomes "add a non-English locale"; v3.x remains the conditional Path B split. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #20 +/- ##
=========================================
Coverage 98.07% 98.07%
Complexity 27 27
=========================================
Files 1 1
Lines 52 52
=========================================
Hits 51 51
Misses 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2 tasks
Captures the design space past the Path B package split so future decisions sit against an explicit menu rather than getting invented ad hoc: - §9 CLDR plural categories — lifts the English-binary assumption, rides on ext-intl / Unicode CLDR. One new method, locales delegate category resolution to MessageFormatter/NumberFormatter. - §10 Morphology expansion — verb conjugation, indefinite articles, ordinals, case/gender. Scope creep; would change the product's identity. - §11 Locale data quality — test corpora (Wiktionary/UniMorph) with CI accuracy metrics; optional ML fallback via ONNX/FFI. - §12 Ecosystem — Symfony/Laravel bridges, composer-plugin locale discovery, benchmark-as-identity against Doctrine/Symfony. Headline recommendation: §9 if we pick one — scoped, ext-intl-based, doesn't change the library's identity but makes the current product genuinely multilingual. Explicitly framed as "not commitments — captured so the decision space is explicit when we get there." Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Converts the §5a "Open design questions" into resolved decisions so implementation of v2.1 (locale support + extension APIs) can start without another round-trip.
Key design decisions locked
protectedinstance rule tables + shared regex engine. Bare interface deferred.protectedrule tables; defaults come fromprotected constclass constants on subclasses. No reintroduction ofpublic staticmutable state.En. No `setDefaultLocale` footgun.Phasing tightened
Ship-state annotations
Test plan
🤖 Generated with Claude Code