r98970 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98969‎ | r98970 | r98971 >
Date:01:40, 5 October 2011
Author:reedy
Status:deferred (Comments)
Tags:
Comment:
More comment updates and tweaks
Modified paths:
  • /trunk/extensions/Translate/MessageCollection.php (modified) (history)
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/TranslateHooks.php (modified) (history)
  • /trunk/extensions/Translate/_autoload.php (modified) (history)
  • /trunk/extensions/Translate/scripts/magic-export.php (modified) (history)
  • /trunk/extensions/Translate/scripts/sync-group.php (modified) (history)
  • /trunk/extensions/Translate/tag/DeleteJob.php (modified) (history)
  • /trunk/extensions/Translate/tag/MoveJob.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageIndex.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageIndexRebuildJob.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationHelpers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageCollection.php
@@ -61,9 +61,9 @@
6262
6363 /**
6464 * Construct a new message collection from definitions.
65 - * @param $definitions \type{MessageDefinitions}
66 - * @param $code \string Language code.
67 - * @return \type{MessageCollection}
 65+ * @param $definitions MessageDefinitions
 66+ * @param $code string Language code.
 67+ * @return MessageCollection
6868 */
6969 public static function newFromDefinitions( MessageDefinitions $definitions, $code ) {
7070 $collection = new self( $code );
Index: trunk/extensions/Translate/scripts/magic-export.php
@@ -59,6 +59,7 @@
6060 $this->output( "Opening file handles and loading current data...\n" );
6161
6262 $groups = MessageGroups::singleton()->getGroups();
 63+ $filename = null;
6364 foreach ( $groups as $group ) {
6465 if ( !$group instanceof ExtensionMessageGroup ) {
6566 continue;
Index: trunk/extensions/Translate/scripts/sync-group.php
@@ -247,6 +247,7 @@
248248 $wikiDate = 'Unknown';
249249 }
250250
 251+ // TODO: $startDate is unused
251252 if ( $startTs ) {
252253 $startTs = wfTimestamp( TS_UNIX, $startTs );
253254 $startDate = $wgLang->sprintfDate( $iso, wfTimestamp( TS_MW, $startTs ) );
@@ -254,6 +255,7 @@
255256 $startDate = 'Unknown';
256257 }
257258
 259+ // TODO: $endDate is unused
258260 if ( $endTs ) {
259261 $endTs = wfTimestamp( TS_UNIX, $endTs );
260262 $endDate = $wgLang->sprintfDate( $iso, wfTimestamp( TS_MW, $endTs ) );
@@ -383,7 +385,7 @@
384386
385387 /**
386388 * Does the actual edit.
387 - * @param $title \type{Title}
 389+ * @param $title \Title
388390 * @param $translation \string
389391 * @param $comment \string Edit summary.
390392 */
Index: trunk/extensions/Translate/MessageGroups.php
@@ -199,7 +199,7 @@
200200 * @param $code \string Language code for this collection.
201201 * @param $unique \bool Whether to build collection for messages unique to this
202202 * group only.
203 - * @return \type
 203+ * @return MessageCollection
204204 */
205205 public function initCollection( $code, $unique = false ) {
206206 if ( !$unique ) {
@@ -253,6 +253,10 @@
254254 return isset( $tags[$type] ) ? $tags[$type] : array();
255255 }
256256
 257+ /**
 258+ * @param $code string
 259+ * @return bool
 260+ */
257261 protected function isSourceLanguage( $code ) {
258262 return $code === $this->getSourceLanguage();
259263 }
@@ -1000,6 +1004,10 @@
10011005 }
10021006 }
10031007
 1008+ /**
 1009+ * @param $id
 1010+ * @return bool
 1011+ */
10041012 public static function exists( $id ) {
10051013 return (bool) self::getGroup( $id );
10061014 }
@@ -1018,7 +1026,10 @@
10191027 self::init();
10201028 }
10211029
1022 - /// Constructor function.
 1030+ /**
 1031+ * Constructor function.
 1032+ * @return MessageGroups
 1033+ */
10231034 public static function singleton() {
10241035 static $instance;
10251036 if ( !$instance instanceof self ) {
Index: trunk/extensions/Translate/tag/DeleteJob.php
@@ -133,7 +133,7 @@
134134
135135 /**
136136 * Get a user object for doing edits.
137 - * @return \User
 137+ * @return User
138138 */
139139 public function getUser() {
140140 return User::newFromName( $this->params['user'], false );
Index: trunk/extensions/Translate/tag/MoveJob.php
@@ -140,7 +140,7 @@
141141
142142 /**
143143 * Get a user object for doing edits.
144 - * @return \User
 144+ * @return User
145145 */
146146 public function getUser() {
147147 return User::newFromName( $this->params['user'], false );
Index: trunk/extensions/Translate/TranslateHooks.php
@@ -161,7 +161,11 @@
162162 return true;
163163 }
164164
165 - /// Hook: LoadExtensionSchemaUpdates
 165+ /**
 166+ * Hook: LoadExtensionSchemaUpdates
 167+ * @param $updater DatabaseUpdater
 168+ * @return bool
 169+ */
166170 public static function schemaUpdates( $updater ) {
167171 $dir = dirname( __FILE__ ) . '/sql';
168172
Index: trunk/extensions/Translate/_autoload.php
@@ -37,6 +37,7 @@
3838
3939 $wgAutoloadClasses['MessageCollection'] = $dir . 'MessageCollection.php';
4040 $wgAutoloadClasses['MessageDefinitions'] = $dir . 'MessageCollection.php';
 41+
4142 $wgAutoloadClasses['TMessage'] = $dir . 'Message.php';
4243 $wgAutoloadClasses['ThinMessage'] = $dir . 'Message.php';
4344 $wgAutoloadClasses['FatMessage'] = $dir . 'Message.php';
Index: trunk/extensions/Translate/utils/MessageIndex.php
@@ -23,6 +23,9 @@
2424 /// @var array
2525 protected $index;
2626
 27+ /**
 28+ * @return MessageIndex
 29+ */
2730 public static function singleton() {
2831 if ( self::$instance === null ) {
2932 global $wgTranslateMessageIndex;
Index: trunk/extensions/Translate/utils/MessageIndexRebuildJob.php
@@ -14,6 +14,10 @@
1515 * @ingroup JobQueue
1616 */
1717 class MessageIndexRebuildJob extends Job {
 18+
 19+ /**
 20+ * @return MessageIndexRebuildJob
 21+ */
1822 public static function newJob() {
1923 $job = new self( Title::newMainPage() );
2024 return $job;
Index: trunk/extensions/Translate/utils/TranslationHelpers.php
@@ -964,15 +964,26 @@
965965 return $diff->getDiff( wfMsgHtml( 'tpt-diff-old' ), wfMsgHtml( 'tpt-diff-new' ) );
966966 }
967967
 968+ /**
 969+ * @param $label string
 970+ * @return string
 971+ */
968972 protected static function legend( $label ) {
969973 # Float it to the opposite direction
970974 return Html::rawElement( 'div', array( 'class' => 'mw-translate-legend' ), $label );
971975 }
972976
 977+ /**
 978+ * @return string
 979+ */
973980 protected static function clear() {
974981 return Html::element( 'div', array( 'style' => 'clear:both;' ) );
975982 }
976983
 984+ /**
 985+ * @param $code string
 986+ * @return array
 987+ */
977988 protected static function getFallbacks( $code ) {
978989 global $wgUser, $wgTranslateLanguageFallbacks;
979990
@@ -1010,6 +1021,13 @@
10111022 return array_unique( $fallbacks );
10121023 }
10131024
 1025+ /**
 1026+ * @param $msg string
 1027+ * @param $code string
 1028+ * @param $title Title
 1029+ * @param $makelink
 1030+ * @return string
 1031+ */
10141032 protected function doBox( $msg, $code, $title = false, $makelink = false ) {
10151033 global $wgUser, $wgLang;
10161034
@@ -1050,6 +1068,9 @@
10511069 return TranslateUtils::fieldset( $title, Html::element( 'span', null, $msg ), $attributes );
10521070 }
10531071
 1072+ /**
 1073+ * @return null|string
 1074+ */
10541075 public function getLazySuggestionBox() {
10551076 if ( $this->group === null || !$this->targetLanguage ) {
10561077 return null;
@@ -1070,11 +1091,19 @@
10711092 return Html::rawElement( 'div', array( 'id' => $id ), $script . $spinner );
10721093 }
10731094
 1095+ /**
 1096+ * @return string
 1097+ */
10741098 public function dialogID() {
10751099 $hash = sha1( $this->title->getPrefixedDbKey() );
10761100 return substr( $hash, 0, 4 );
10771101 }
10781102
 1103+ /**
 1104+ * @param $source
 1105+ * @param $lang
 1106+ * @return string
 1107+ */
10791108 public function adder( $source, $lang = null ) {
10801109 if ( !$this->editMode ) {
10811110 return '';
@@ -1092,10 +1121,19 @@
10931122 return Html::element( 'a', $params, '↓' );
10941123 }
10951124
 1125+ /**
 1126+ * @param $id string|int
 1127+ * @param $text string
 1128+ * @return string
 1129+ */
10961130 public function wrapInsert( $id, $text ) {
10971131 return Html::element( 'pre', array( 'id' => $id, 'style' => 'display: none;' ), $text );
10981132 }
10991133
 1134+ /**
 1135+ * @param $text string
 1136+ * @return string
 1137+ */
11001138 public function suggestionField( $text ) {
11011139 static $counter = 0;
11021140
@@ -1131,6 +1169,10 @@
11321170 return $wgUser->getSkin()->link( $target, $text, $jsEdit, $params );
11331171 }
11341172
 1173+ /**
 1174+ * @param $id string
 1175+ * @return string
 1176+ */
11351177 public static function jQueryPathId( $id ) {
11361178 return Xml::encodeJsVar( "#$id" );
11371179 }

Comments

#Comment by Reedy (talk | contribs)   01:42, 5 October 2011

Couple of TODO comments, whitespace and explicit variable definition

#Comment by Nikerabbit (talk | contribs)   06:01, 5 October 2011
+	 * @param $title \Title

Status & tagging log