$wgLang can be an StubUserLang object. This change allows to force a
Language object.
Change-Id: I93c79b985a2ee49648c678844eef189126a4d765
* @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 );
}