Page MenuHomePhabricator

Reduce amount of static code in FlaggedRevs codebase
Open, Needs TriagePublic

Description

  • There are 214 public static functions in this codebase.
  • 12 more are private static, 37 protected static.
  • 353 are public but not static.
  • 13 are private but not static, 155 protected.

In total there are 738 named functions (excluding magic functions like __construct). In other words, about 3/4 of all the the stuff in this codebase is public. And more than 1/3 of the public stuff is static.

All this is essentially Technical-Debt. Priorities are:

  • Make as much code as possible private. When a method is only public to be able to test it, use TestingAccessWrapper.
  • Split large classes up into smaller ones. E.g. it might be worth to move all hook handlers into separate classes.
  • Make as much code as possible non-static.
  • Avoid global $wg… as much as possible. Inject Config objects instead.

Event Timeline

State as of 2020-09-01:

  • 194 public static
  • 52 private static, 0 protected static
  • 299 public
  • 130 private, 86 protected

Which means not much was removed, but a lot was made private.