Page MenuHomePhabricator

Add global $wgUser to DeprecatedGlobalVariablesSniff
Closed, ResolvedPublic

Description

Once $wgUser is no longer used as much in WMF deployed code, it should be added to DeprecatedGlobalVariablesSniff::$deprecated with version 1.35.
This will need to be suppressed in mediawiki core while deprecated fallbacks still exist.

This mirrors the current suppression in phpcs.xml of the Deprecated$wgContLang and Deprecated$wgTitle sniffs

Event Timeline

DannyS712 changed the task status from Open to Stalled.Feb 6 2020, 7:53 AM
DannyS712 triaged this task as Medium priority.
DannyS712 created this task.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

See T50963 as well. I think we can add it anyway, but I'm unsure what the benefits would be.

DannyS712 changed the task status from Stalled to Open.Mar 26 2020, 2:40 PM

Now that it is officially being marked as deprecated it should be added for the next release of codesniffer

Change 583607 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/tools/codesniffer@master] Add global $wgUser to DeprecatedGlobalVariablesSniff

https://gerrit.wikimedia.org/r/583607

Change 583610 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Preemptively disable Deprecated$wgUser sniff

https://gerrit.wikimedia.org/r/583610

{{ping}} now that wgUser is officially deprecated in MW 1.35, can the sniff be added for the next release of codesniffer?

Change 583607 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Add global $wgUser to DeprecatedGlobalVariablesSniff

https://gerrit.wikimedia.org/r/583607

Personally, I veto this idea. The variable still exists in a ton of code: https://codesearch.wmflabs.org/search/?q=%5C%24wgUser%5Cb. Let's please give the developers some time to notice the deprecation warnings, before we make a sniff yell at them.

Personally, I veto this idea. The variable still exists in a ton of code: https://codesearch.wmflabs.org/search/?q=%5C%24wgUser%5Cb. Let's please give the developers some time to notice the deprecation warnings, before we make a sniff yell at them.

There aren't any deprecation warnings as far as I know?
The rule will be automatically disabled by Libraryupgrader when it rolls out, I believe

Change 583610 abandoned by DannyS712:
Preemptively disable Deprecated$wgUser sniff

Reason:
Per comments and task

https://gerrit.wikimedia.org/r/583610

DannyS712 removed a project: Patch-For-Review.

Will go live with the next release