docs/hooks.txt says
```
'MediaWikiServices': Called when a global MediaWikiServices instance is
initialized. Extensions may use this to define, replace, or wrap services.
However, the preferred way to define a new service is
the $wgServiceWiringFiles array.
$services: MediaWikiServices
```
However, if I try to do redefine existing servie, it does not work. With some debugging I get this:
```
New container is constructed as 675773727
Service is defined in 675773727
New container is constructed as 974431285
Service is defined in 974431285
My hook on MediaWikiServices is called on 974431285
Service is redefined on 974431285
ServiceContainer::importWiring is ran on 974431285
Wrong (original) service is returned on 974431285
```
Looking at the code:
```
/**
* Imports all wiring defined in $container. Wiring defined in $container
* will override any wiring already defined locally. However, already
* existing service instances will be preserved.
*
* @since 1.28
*
* @param ServiceContainer $container
* @param string[] $skip A list of service names to skip during import
*/
public function importWiring( ServiceContainer $container, $skip = [] ) {
$newInstantiators = array_diff_key(
$container->serviceInstantiators,
array_flip( $skip )
);
error_log( "importWiring is ran on " . $this->id );
$this->serviceInstantiators = array_merge(
$this->serviceInstantiators,
$newInstantiators
);
}
```
For array merge:
```
If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended.
```
Based on the documentation, I think the parameters for array_merge are in wrong order.