Merge "Linker: Use RequestContext::getMain()->getLanguage() instead of $wgLang"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 11 Mar 2019 18:30:56 +0000 (18:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 11 Mar 2019 18:30:56 +0000 (18:30 +0000)
includes/Linker.php

index 2c7f44c..3e50ac6 100644 (file)
@@ -1607,9 +1607,8 @@ class Linker {
         * @return string Full html of the TOC
         */
        public static function tocList( $toc, $lang = null ) {
-               global $wgLang;
-               $lang = $lang ?? $wgLang;
-               if ( !is_object( $lang ) ) {
+               $lang = $lang ?? RequestContext::getMain()->getLanguage();
+               if ( !$lang instanceof Language ) {
                        wfDeprecated( __METHOD__ . ' with type other than Language for $lang', '1.33' );
                        $lang = wfGetLangObj( $lang );
                }