What needs to be prioritized:
Update the Translate extension code to use PHP language features from versions 8.0 to 8.3. The extension now requires MediaWiki 1.46, which requires PHP 8.3, so all these features are safe to use.
A quick code review shows constructor property promotion and readonly properties are already widely used. The remaining work is:
- Replace class constants that act as fixed value sets with enums (only 1 enum exists today)
- Use match instead of switch where it fits, and ?-> instead of null checks (both barely used today)
- Add types to class constants (~200 constants are untyped)
- Add #[\Override] to methods that override a parent method (not used today)
- Replace doc-comment-only types (@param, @return unions) with native types
- Use first-class callable syntax instead of string/array callables
This work is complete when the features above are used consistently in src/, PHPCS/phan rules enforce them where sniffs exist, and CI passes on PHP 8.3 without warnings.
Why this is essential:
- Native types let phan catch bugs that doc-comment types cannot
- Enums and match make state handling type-safe instead of string-based
- #[\Override] and typed constants catch silent breakage when MediaWiki core classes change
- Less boilerplate makes the code easier to read and review
What happens if we do not do it now:
- The code stays split between old and new styles, which makes reviews inconsistent
- Bugs that native types would catch stay invisible to static analysis
- The modernization backlog grows with each PHP version bump, so the eventual cleanup gets bigger and riskier
- PHP 8.2/8.3 deprecation warnings surface as production log spam later
Dependencies / constraints:
- Turning constants into enums changes the public interface.
Quick review by Claude:
- Mostly done: constructor property promotion (~445 promoted parameters, from the January 2026 patch) and readonly properties (116 files)
- Barely started: enums (1 file), match (1 file), nullsafe ?-> (5 files)
- Not started: typed class constants (206 constants untyped), #[\Override], first-class callable syntax