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:
parent
e7cb95d61e
commit
ed6450374b
3 changed files with 4 additions and 4 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1107,7 +1107,7 @@ class Parser {
|
|||
*
|
||||
* @since 1.19
|
||||
*
|
||||
* @return Language
|
||||
* @return Language|StubUserLang
|
||||
*/
|
||||
public function getTargetLanguage() {
|
||||
$target = $this->mOptions->getTargetLanguage();
|
||||
|
|
|
|||
Loading…
Reference in a new issue