From b9e1326d3029f265b39f33aaa4bd27314dc169b3 Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Mon, 5 Dec 2011 18:56:09 +0000 Subject: [PATCH] Add missing @since tags for getLanguage and deal with this sanitizeLangCode fatal that no-one bothered to fix. --- includes/context/ContextSource.php | 1 + includes/context/DerivativeContext.php | 4 +++- includes/context/IContextSource.php | 1 + includes/context/RequestContext.php | 5 ++++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/context/ContextSource.php b/includes/context/ContextSource.php index 0eb5d3e339..5fc8eba54f 100644 --- a/includes/context/ContextSource.php +++ b/includes/context/ContextSource.php @@ -107,6 +107,7 @@ abstract class ContextSource implements IContextSource { * Get the Language object * * @return Language + * @since 1.19 */ public function getLanguage() { return $this->getContext()->getLanguage(); diff --git a/includes/context/DerivativeContext.php b/includes/context/DerivativeContext.php index e440575be3..cff827cf78 100644 --- a/includes/context/DerivativeContext.php +++ b/includes/context/DerivativeContext.php @@ -169,12 +169,13 @@ class DerivativeContext extends ContextSource { * Set the Language object * * @param $l Mixed Language instance or language code + * @since 1.19 */ public function setLanguage( $l ) { if ( $l instanceof Language ) { $this->lang = $l; } elseif ( is_string( $l ) ) { - $l = self::sanitizeLangCode( $l ); // FIXME: Undefined method, is at RequestContext::sanitizeLangCode() + $l = RequestContext::sanitizeLangCode( $l ); $obj = Language::factory( $l ); $this->lang = $obj; } else { @@ -194,6 +195,7 @@ class DerivativeContext extends ContextSource { * Get the Language object * * @return Language + * @since 1.19 */ public function getLanguage() { if ( !is_null( $this->lang ) ) { diff --git a/includes/context/IContextSource.php b/includes/context/IContextSource.php index 4a8e93b15d..446cb3f436 100644 --- a/includes/context/IContextSource.php +++ b/includes/context/IContextSource.php @@ -68,6 +68,7 @@ interface IContextSource { * Get the Language object * * @return Language + * @since 1.19 */ public function getLanguage(); diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 7ca184a7f1..b2568e4cc6 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -146,8 +146,9 @@ class RequestContext implements IContextSource { /** * Accepts a language code and ensures it's sane. Outputs a cleaned up language * code and replaces with $wgLanguageCode if not sane. + * @private */ - private static function sanitizeLangCode( $code ) { + static function sanitizeLangCode( $code ) { global $wgLanguageCode; // BCP 47 - letter case MUST NOT carry meaning @@ -176,6 +177,7 @@ class RequestContext implements IContextSource { * Set the Language object * * @param $l Mixed Language instance or language code + * @since 1.19 */ public function setLanguage( $l ) { if ( $l instanceof Language ) { @@ -201,6 +203,7 @@ class RequestContext implements IContextSource { * Get the Language object * * @return Language + * @since 1.19 */ public function getLanguage() { if ( $this->lang === null ) { -- 2.20.1