From: Fomafix Date: Wed, 30 May 2018 04:33:01 +0000 (+0200) Subject: Allow and use type Language instead of string for $lang of doEditSectionLink X-Git-Tag: 1.34.0-rc.0~3805^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=35d1ea57e1f48b768bfe1af5fa325778949a4b64;p=lhc%2Fweb%2Fwiklou.git Allow and use type Language instead of string for $lang of doEditSectionLink Hard-deprecate that the parameters $tooltip and $lang are optional. Hard-deprecate other types than Language for parameter $lang. Change-Id: I3ce048e3d0de9a4e96e2aa05d75a4ce41c3ec964 Depends-On: Ibe295e7020e995eea52e319feaf59c635f8bb4dc --- diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 991708e89d..30dd96639d 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -514,6 +514,9 @@ because of Phabricator reports. as a string. They should be given as a OOUI\FieldLayout object instead. Notably, this affects fields defined in the 'GetPreferences' hook, because Special:Preferences uses an OOUI form now. (If possible, don't use 'rawrow'.) +* In Skin::doEditSectionLink omitting the parameters $tooltip and $lang is + deprecated. For the $lang parameter, types other than Language are + deprecated. === Other changes in 1.32 === * (T198811) The following tables have had their UNIQUE indexes turned into diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 445981bbc8..b507f2e67b 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -338,7 +338,7 @@ class ParserOutput extends CacheTime { return $skin->doEditSectionLink( $editsectionPage, $editsectionSection, $editsectionContent, - $wgLang->getCode() + $wgLang ); }, $text diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index ed4045d487..8a385a1003 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -1610,15 +1610,20 @@ abstract class Skin extends ContextSource { * @param string $section The designation of the section being pointed to, * to be included in the link, like "§ion=$section" * @param string|null $tooltip The tooltip to use for the link: will be escaped - * and wrapped in the 'editsectionhint' message - * @param string $lang Language code + * and wrapped in the 'editsectionhint' message. + * Not setting this parameter is deprecated. + * @param Language|string $lang Language object or language code string. + * Type string is deprecated. Not setting this parameter is deprecated. * @return string HTML to use for edit link */ public function doEditSectionLink( Title $nt, $section, $tooltip = null, $lang = false ) { // HTML generated here should probably have userlangattributes // added to it for LTR text on RTL pages - $lang = wfGetLangObj( $lang ); + if ( !$lang instanceof Language ) { + wfDeprecated( __METHOD__ . ' with other type than Language for $lang', '1.32' ); + $lang = wfGetLangObj( $lang ); + } $attribs = []; if ( !is_null( $tooltip ) ) {