Use type Language instead of string for $lang of doEditSectionLink
authorFomafix <fomafix@googlemail.com>
Wed, 30 May 2018 04:33:01 +0000 (06:33 +0200)
committerFomafix <fomafix@googlemail.com>
Sun, 17 Jun 2018 20:36:35 +0000 (22:36 +0200)
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
includes/parser/ParserOutput.php
includes/skins/Skin.php

index 731f874..6e82321 100644 (file)
@@ -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
index 265d151..ed1dd19 100644 (file)
@@ -314,7 +314,7 @@ class ParserOutput extends CacheTime {
                                        return $skin->doEditSectionLink( $editsectionPage,
                                                $editsectionSection,
                                                $editsectionContent,
-                                               $wgLang->getCode()
+                                               $wgLang
                                        );
                                },
                                $text
index 8384ca0..60b7022 100644 (file)
@@ -1612,14 +1612,15 @@ abstract class Skin extends ContextSource {
         *   to be included in the link, like "&section=$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 ) ) {