Document methods that may return StubUserLang instead of Language

Typehinting parameters that take the return value of these methods
with Language is not safe as they may return global $wgLang which
may or may not be instance of Language.

Bug: T278429
Change-Id: Ia5a71e4c39124f4427bd816e6e19207bb371cc6b
This commit is contained in:
Ammarpad 2021-03-25 21:37:28 +01:00
parent e7cb95d61e
commit ed6450374b
3 changed files with 4 additions and 4 deletions

View file

@ -1176,7 +1176,7 @@ function wfConfiguredReadOnlyReason() {
* the current user's language (as a fallback for the old parameter
* functionality), or if it is true then use global object
* for the wiki's content language.
* @return Language
* @return Language|StubUserLang
*/
function wfGetLangObj( $langcode = false ) {
# Identify which language to get or create a language object for.

View file

@ -4389,7 +4389,7 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
* e.g. $wgLang (such as special pages, which are in the user language).
*
* @since 1.18
* @return Language
* @return Language|StubUserLang
*/
public function getPageLanguage() {
global $wgLang, $wgLanguageCode;
@ -4430,7 +4430,7 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
* e.g. $wgLang (such as special pages, which are in the user language).
*
* @since 1.20
* @return Language
* @return Language|StubUserLang
*/
public function getPageViewLanguage() {
global $wgLang;

View file

@ -1107,7 +1107,7 @@ class Parser {
*
* @since 1.19
*
* @return Language
* @return Language|StubUserLang
*/
public function getTargetLanguage() {
$target = $this->mOptions->getTargetLanguage();