Services should not depend on the entire site configuration when they only need a few specific settings.
To avoid this, a ServiceOptions class should be created that is similar to the Config class, but designed to only hold a specific set of options, and provides utility methods for ensuring the required set of option was passed.
This change additionally means that these services no longer see a live version of the settings, but rather a copy.In a way, This means in tests you really do have to call overrideMwServices() if you want services to pick up your config changesthis just works around PHP's lack of named parameters.
In a wayThis change means that these services no longer see a live version of the settings in global variables, but get a copy when they are created. This means in tests you have to call overrideMwServices() if you want services to pick up your config changes, e.g.
$this just works around PHP's lack of ->overrideMwServices( new HashConfig( [ 'Sitenamed parameters.' => 'TestMediaWiki' ] ) );
NOTE: This ticket was filed retroactively for reference. ServiceOptions was implemented in [[https://gerrit.wikimedia.org/r/c/mediawiki/core/+/502818|I1a3f358e8659b]].