r108785 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108784‎ | r108785 | r108786 >
Date:02:27, 13 January 2012
Author:reedy
Status:resolved
Tags:
Comment:
Documentation

As we're using stuff from ContextSource everwhere, limiting stuff to a type hint of IContextSource isn't much use
Modified paths:
  • /trunk/phase3/includes/Preferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Preferences.php
@@ -38,10 +38,10 @@
3939 /**
4040 * @throws MWException
4141 * @param $user User
42 - * @param $context IContextSource
 42+ * @param $context ContextSource
4343 * @return array|null
4444 */
45 - static function getPreferences( $user, IContextSource $context ) {
 45+ public static function getPreferences( $user, ContextSource $context ) {
4646 if ( self::$defaultPreferences ) {
4747 return self::$defaultPreferences;
4848 }
@@ -127,11 +127,11 @@
128128
129129 /**
130130 * @param $user User
131 - * @param $context IContextSource
 131+ * @param $context ContextSource
132132 * @param $defaultPreferences
133133 * @return void
134134 */
135 - static function profilePreferences( $user, IContextSource $context, &$defaultPreferences ) {
 135+ static function profilePreferences( $user, ContextSource $context, &$defaultPreferences ) {
136136 global $wgAuth, $wgContLang, $wgParser, $wgCookieExpiration, $wgLanguageCode,
137137 $wgDisableTitleConversion, $wgDisableLangConversion, $wgMaxSigChars,
138138 $wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication,
@@ -454,11 +454,11 @@
455455
456456 /**
457457 * @param $user User
458 - * @param $context IContextSource
 458+ * @param $context ContextSource
459459 * @param $defaultPreferences
460460 * @return void
461461 */
462 - static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) {
 462+ static function skinPreferences( $user, ContextSource $context, &$defaultPreferences ) {
463463 ## Skin #####################################
464464 global $wgAllowUserCss, $wgAllowUserJs;
465465
@@ -603,10 +603,10 @@
604604
605605 /**
606606 * @param $user User
607 - * @param $context IContextSource
 607+ * @param $context ContextSource
608608 * @param $defaultPreferences Array
609609 */
610 - static function renderingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
 610+ static function renderingPreferences( $user, ContextSource $context, &$defaultPreferences ) {
611611 ## Page Rendering ##############################
612612 global $wgAllowUserCssPrefs;
613613 if ( $wgAllowUserCssPrefs ) {
@@ -681,10 +681,10 @@
682682
683683 /**
684684 * @param $user User
685 - * @param $context IContextSource
 685+ * @param $context ContextSource
686686 * @param $defaultPreferences Array
687687 */
688 - static function editingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
 688+ static function editingPreferences( $user, ContextSource $context, &$defaultPreferences ) {
689689 global $wgUseExternalEditor, $wgAllowUserCssPrefs;
690690
691691 ## Editing #####################################
@@ -781,10 +781,10 @@
782782
783783 /**
784784 * @param $user User
785 - * @param $context IContextSource
 785+ * @param $context ContextSource
786786 * @param $defaultPreferences Array
787787 */
788 - static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) {
 788+ static function rcPreferences( $user, ContextSource $context, &$defaultPreferences ) {
789789 global $wgRCMaxAge, $wgRCShowWatchingUsers;
790790
791791 ## RecentChanges #####################################
@@ -838,10 +838,10 @@
839839
840840 /**
841841 * @param $user User
842 - * @param $context IContextSource
 842+ * @param $context ContextSource
843843 * @param $defaultPreferences
844844 */
845 - static function watchlistPreferences( $user, IContextSource $context, &$defaultPreferences ) {
 845+ static function watchlistPreferences( $user, ContextSource $context, &$defaultPreferences ) {
846846 global $wgUseRCPatrol, $wgEnableAPI, $wgRCMaxAge;
847847
848848 $watchlistdaysMax = ceil( $wgRCMaxAge / ( 3600 * 24 ) );
@@ -939,10 +939,10 @@
940940
941941 /**
942942 * @param $user User
943 - * @param $context IContextSource
 943+ * @param $context ContextSource
944944 * @param $defaultPreferences Array
945945 */
946 - static function searchPreferences( $user, IContextSource $context, &$defaultPreferences ) {
 946+ static function searchPreferences( $user, ContextSource $context, &$defaultPreferences ) {
947947 global $wgContLang, $wgEnableMWSuggest, $wgVectorUseSimpleSearch;
948948
949949 ## Search #####################################
@@ -1003,10 +1003,10 @@
10041004
10051005 /**
10061006 * @param $user User
1007 - * @param $context IContextSource
 1007+ * @param $context ContextSource
10081008 * @param $defaultPreferences Array
10091009 */
1010 - static function miscPreferences( $user, IContextSource $context, &$defaultPreferences ) {
 1010+ static function miscPreferences( $user, ContextSource $context, &$defaultPreferences ) {
10111011 global $wgContLang;
10121012
10131013 ## Misc #####################################
@@ -1035,10 +1035,10 @@
10361036
10371037 /**
10381038 * @param $user User The User object
1039 - * @param $context IContextSource
 1039+ * @param $context ContextSource
10401040 * @return Array: text/links to display as key; $skinkey as value
10411041 */
1042 - static function generateSkinOptions( $user, IContextSource $context ) {
 1042+ static function generateSkinOptions( $user, ContextSource $context ) {
10431043 global $wgDefaultSkin, $wgAllowUserCss, $wgAllowUserJs;
10441044 $ret = array();
10451045
@@ -1090,10 +1090,10 @@
10911091 }
10921092
10931093 /**
1094 - * @param $context IContextSource
 1094+ * @param $context ContextSource
10951095 * @return array
10961096 */
1097 - static function getDateOptions( IContextSource $context ) {
 1097+ static function getDateOptions( ContextSource $context ) {
10981098 $lang = $context->getLanguage();
10991099 $dateopts = $lang->getDatePreferences();
11001100
@@ -1125,10 +1125,10 @@
11261126 }
11271127
11281128 /**
1129 - * @param $context IContextSource
 1129+ * @param $context ContextSource
11301130 * @return array
11311131 */
1132 - static function getImageSizes( IContextSource $context ) {
 1132+ static function getImageSizes( ContextSource $context ) {
11331133 global $wgImageLimits;
11341134
11351135 $ret = array();
@@ -1143,10 +1143,10 @@
11441144 }
11451145
11461146 /**
1147 - * @param $context IContextSource
 1147+ * @param $context ContextSource
11481148 * @return array
11491149 */
1150 - static function getThumbSizes( IContextSource $context ) {
 1150+ static function getThumbSizes( ContextSource $context ) {
11511151 global $wgThumbLimits;
11521152
11531153 $ret = array();
@@ -1200,17 +1200,21 @@
12011201
12021202 /**
12031203 * @param $user User
1204 - * @param $context IContextSource
 1204+ * @param $context ContextSource
12051205 * @param $formClass string
12061206 * @param $remove Array: array of items to remove
12071207 * @return HtmlForm
12081208 */
1209 - static function getFormObject( $user, IContextSource $context, $formClass = 'PreferencesForm', array $remove = array() ) {
 1209+ static function getFormObject( $user, ContextSource $context, $formClass = 'PreferencesForm', array $remove = array() ) {
12101210 $formDescriptor = Preferences::getPreferences( $user, $context );
12111211 if ( count( $remove ) ) {
12121212 $removeKeys = array_flip( $remove );
12131213 $formDescriptor = array_diff_key( $formDescriptor, $removeKeys );
12141214 }
 1215+
 1216+ /**
 1217+ * @var $htmlForm PreferencesForm
 1218+ */
12151219 $htmlForm = new $formClass( $formDescriptor, $context, 'prefs' );
12161220
12171221 $htmlForm->setModifiedUser( $user );
@@ -1225,9 +1229,10 @@
12261230 }
12271231
12281232 /**
 1233+ * @param $context ContextSource
12291234 * @return array
12301235 */
1231 - static function getTimezoneOptions( IContextSource $context ) {
 1236+ static function getTimezoneOptions( ContextSource $context ) {
12321237 $opt = array();
12331238
12341239 global $wgLocalTZoffset, $wgLocaltimezone;
@@ -1330,7 +1335,7 @@
13311336
13321337 /**
13331338 * @param $formData
1334 - * @param $form HTMLForm
 1339+ * @param $form PreferencesForm
13351340 * @param $entryPoint string
13361341 * @return bool|Status|string
13371342 */
@@ -1389,6 +1394,7 @@
13901395
13911396 /**
13921397 * @param $formData
 1398+ * @param $form PreferencesForm
13931399 * @return Status
13941400 */
13951401 public static function tryUISubmit( $formData, $form ) {
@@ -1476,10 +1482,16 @@
14771483
14781484 private $modifiedUser;
14791485
 1486+ /**
 1487+ * @param $user User
 1488+ */
14801489 public function setModifiedUser( $user ) {
14811490 $this->modifiedUser = $user;
14821491 }
14831492
 1493+ /**
 1494+ * @return User
 1495+ */
14841496 public function getModifiedUser() {
14851497 if ( $this->modifiedUser === null ) {
14861498 return $this->getUser();
@@ -1546,8 +1558,10 @@
15471559
15481560 return $data;
15491561 }
 1562+
15501563 /**
15511564 * Get the whole body of the form.
 1565+ * @return string
15521566 */
15531567 function getBody() {
15541568 return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
@@ -1556,6 +1570,8 @@
15571571 /**
15581572 * Get the <legend> for a given section key. Normally this is the
15591573 * prefs-$key message but we'll allow extensions to override it.
 1574+ * @param $key string
 1575+ * @return string
15601576 */
15611577 function getLegend( $key ) {
15621578 $legend = parent::getLegend( $key );

Follow-up revisions

RevisionCommit summaryAuthorDate
r108786A couple more for r108785...reedy02:30, 13 January 2012
r108788Partial revert ContextSource changes from r108785, r108786reedy02:40, 13 January 2012

Status & tagging log