The same result as in the example, but without using the global
keyword:
class VisualEditorHooks {
public static function onResourceLoaderGetConfigVars( array &$vars ) {
$config = MediaWikiServices::getInstance()->getMainConfig();
$vars['wgVisualEditor'] = [
'disableForAnons' => $config->get( 'VisualEditorDisableForAnons' ),
'enableExperimentalCode' => $config->get( 'VisualEditorEnableExperimentalCode '),
];
return true;
}
}
This would get rid of the global variables, which might be deprecated in the future.