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. In a way, this just works around PHP's lack of named parameters.
This 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->overrideMwServices( new HashConfig( [ 'Sitename' => 'TestMediaWiki' ] ) );