mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 22:03:28 +00:00
Type hint &$defaultPreferences
& clean onResourceLoaderTestModules
* Per https://www.mediawiki.org/wiki/Manual:Hooks/GetPreferences, it is strict on $preferences being an array, so type hinted it to conform. * Remove legacy hook behavior for onResourceLoaderTestModules() hook in CodeMirrorHooks. See: https://w.wiki/3Az for more information. Also, added `@see` with link to the documentation of the hook used. Change-Id: I0a2fac4b4d491abf8d2f661be32bf2e0d791c90b
This commit is contained in:
parent
fdbf91ddeb
commit
4b17eb952c
|
@ -48,7 +48,7 @@ class CodeMirrorHooks {
|
|||
* @param User $user
|
||||
* @param array &$defaultPreferences
|
||||
*/
|
||||
public static function onGetPreferences( User $user, &$defaultPreferences ) {
|
||||
public static function onGetPreferences( User $user, array &$defaultPreferences ) {
|
||||
// CodeMirror is enabled by default for users. It can
|
||||
// be changed by adding '$wgDefaultUserOptions['usecodemirror'] = 0;' into LocalSettings.php
|
||||
$defaultPreferences['usecodemirror'] = [
|
||||
|
@ -59,9 +59,11 @@ class CodeMirrorHooks {
|
|||
|
||||
/**
|
||||
* Register test modules for CodeMirror.
|
||||
*
|
||||
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules
|
||||
*
|
||||
* @param array &$modules
|
||||
* @param ResourceLoader $rl
|
||||
* @return bool
|
||||
*/
|
||||
public static function onResourceLoaderTestModules( array &$modules, ResourceLoader $rl ) {
|
||||
$modules['qunit']['ext.CodeMirror.test'] = [
|
||||
|
@ -76,8 +78,6 @@ class CodeMirrorHooks {
|
|||
'localBasePath' => __DIR__ . '/../',
|
||||
'remoteExtPath' => 'CodeMirror',
|
||||
];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue