Page MenuHomePhabricator

MessageCache::getParserOptions should be private
Closed, ResolvedPublic


The method[1] currently has no scope defined. It uses $wgUser, and will eventually need to have its signature changed to require a user parameter. Until then, it should be made private. says

Mark new code with proper visibility modifiers, including public if appropriate, but do not add visibility to existing code without first checking, testing and refactoring as required. It's generally a good idea to avoid visibility changes unless you're making changes to the function which would break old uses of it anyway.

Looking through every known use of getParserOptions[2] shows no calls outside of the class.

Since the plan is to make breaking changes (require a user parameter), I suggest it be made private now to avoid the introduction of any uses that will then need to be changed (i.e. to ensure that it only remains used within the class)


Event Timeline

DannyS712 triaged this task as Medium priority.Mar 8 2020, 7:58 AM
DannyS712 created this task.
DannyS712 moved this task from Unsorted to Next on the User-DannyS712 board.

Tagging CPT to review the proposal

What section of the release notes should this be? Breaking changes in 1.35 or Other changes in 1.35?

Change 579457 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Make MessageCache::getParserOptions private

Change 579457 merged by jenkins-bot:
[mediawiki/core@master] Make MessageCache::getParserOptions private