r105205 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105204‎ | r105205 | r105206 >
Date:18:56, 5 December 2011
Author:dantman
Status:ok
Tags:
Comment:
Add missing @since tags for getLanguage and deal with this sanitizeLangCode fatal that no-one bothered to fix.
Modified paths:
  • /trunk/phase3/includes/context/ContextSource.php (modified) (history)
  • /trunk/phase3/includes/context/DerivativeContext.php (modified) (history)
  • /trunk/phase3/includes/context/IContextSource.php (modified) (history)
  • /trunk/phase3/includes/context/RequestContext.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/context/RequestContext.php
@@ -146,8 +146,9 @@
147147 /**
148148 * Accepts a language code and ensures it's sane. Outputs a cleaned up language
149149 * code and replaces with $wgLanguageCode if not sane.
 150+ * @private
150151 */
151 - private static function sanitizeLangCode( $code ) {
 152+ static function sanitizeLangCode( $code ) {
152153 global $wgLanguageCode;
153154
154155 // BCP 47 - letter case MUST NOT carry meaning
@@ -176,6 +177,7 @@
177178 * Set the Language object
178179 *
179180 * @param $l Mixed Language instance or language code
 181+ * @since 1.19
180182 */
181183 public function setLanguage( $l ) {
182184 if ( $l instanceof Language ) {
@@ -201,6 +203,7 @@
202204 * Get the Language object
203205 *
204206 * @return Language
 207+ * @since 1.19
205208 */
206209 public function getLanguage() {
207210 if ( $this->lang === null ) {
Index: trunk/phase3/includes/context/IContextSource.php
@@ -68,6 +68,7 @@
6969 * Get the Language object
7070 *
7171 * @return Language
 72+ * @since 1.19
7273 */
7374 public function getLanguage();
7475
Index: trunk/phase3/includes/context/ContextSource.php
@@ -107,6 +107,7 @@
108108 * Get the Language object
109109 *
110110 * @return Language
 111+ * @since 1.19
111112 */
112113 public function getLanguage() {
113114 return $this->getContext()->getLanguage();
Index: trunk/phase3/includes/context/DerivativeContext.php
@@ -169,12 +169,13 @@
170170 * Set the Language object
171171 *
172172 * @param $l Mixed Language instance or language code
 173+ * @since 1.19
173174 */
174175 public function setLanguage( $l ) {
175176 if ( $l instanceof Language ) {
176177 $this->lang = $l;
177178 } elseif ( is_string( $l ) ) {
178 - $l = self::sanitizeLangCode( $l ); // FIXME: Undefined method, is at RequestContext::sanitizeLangCode()
 179+ $l = RequestContext::sanitizeLangCode( $l );
179180 $obj = Language::factory( $l );
180181 $this->lang = $obj;
181182 } else {
@@ -194,6 +195,7 @@
195196 * Get the Language object
196197 *
197198 * @return Language
 199+ * @since 1.19
198200 */
199201 public function getLanguage() {
200202 if ( !is_null( $this->lang ) ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103817Bug 29524 - Rename RequestContext::getLang to getLanguage...johnduhart16:13, 21 November 2011

Status & tagging log