From 531e71acdab55df6f567ef43ffaccf4615fe5e66 Mon Sep 17 00:00:00 2001 From: Fomafix Date: Wed, 30 May 2018 06:33:01 +0200 Subject: [PATCH 1/1] Use type Language instead of string for $lang of doEditSectionLink The call of wfGetLangObj( $lang ) is not necessary anymore. Keep $lang as optional parameter to avoid the coding style check error Required argument follows optional Depends-On: Ibe295e7020e995eea52e319feaf59c635f8bb4dc Change-Id: Id49201957e716ef8a2ea930b3616ca4fe6e35633 --- RELEASE-NOTES-1.32 | 1 + includes/parser/ParserOutput.php | 2 +- includes/skins/Skin.php | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 731f874d16..6e823216cf 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -165,6 +165,7 @@ because of Phabricator reports. use 'EditPageGetCheckboxesDefinition' instead. * Linker::getLinkColour() and DummyLinker::getLinkColour(), deprecated since 1.28, were removed. LinkRenderer::getLinkClasses() should be used instead. +* Skin::doEditSectionLink requires type Language for optional parameter $lang. === Deprecations in 1.32 === * Use of a StartProfiler.php file is deprecated in favour of placing diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 265d1516a6..ed1dd192eb 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -314,7 +314,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 8384ca0c25..60b702232c 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -1612,14 +1612,15 @@ abstract class Skin extends ContextSource { * to be included in the link, like "§ion=$section" * @param string $tooltip The tooltip to use for the link: will be escaped * and wrapped in the 'editsectionhint' message - * @param string $lang Language code + * @param Language|null $lang Language object, defaults to user interface language * @return string HTML to use for edit link */ - public function doEditSectionLink( Title $nt, $section, $tooltip = null, $lang = false ) { + public function doEditSectionLink( Title $nt, $section, $tooltip = null, Language $lang = null ) { // HTML generated here should probably have userlangattributes // added to it for LTR text on RTL pages - $lang = wfGetLangObj( $lang ); + global $wgLang; + $lang = $lang ?: $wgLang; $attribs = []; if ( !is_null( $tooltip ) ) { -- 2.20.1