r88537 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88536‎ | r88537 | r88538 >
Date:19:36, 21 May 2011
Author:reedy
Status:ok
Tags:
Comment:
More comment updates, addition of some braces also
Modified paths:
  • /trunk/phase3/includes/UserArray.php (modified) (history)
  • /trunk/phase3/includes/UserMailer.php (modified) (history)
  • /trunk/phase3/includes/XmlTypeCheck.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/UserMailer.php
@@ -31,7 +31,7 @@
3232 */
3333 class MailAddress {
3434 /**
35 - * @param $address Mixed: string with an email address, or a User object
 35+ * @param $address string|User string with an email address, or a User object
3636 * @param $name String: human-readable name if a string address is given
3737 * @param $realName String: human-readable real name if a string address is given
3838 */
@@ -82,6 +82,13 @@
8383
8484 /**
8585 * Send mail using a PEAR mailer
 86+ *
 87+ * @param $mailer
 88+ * @param $dest
 89+ * @param $headers
 90+ * @param $body
 91+ *
 92+ * @return Status
8693 */
8794 protected static function sendWithPear( $mailer, $dest, $headers, $body ) {
8895 $mailResult = $mailer->send( $dest, $headers, $body );
@@ -138,15 +145,18 @@
139146 require_once( 'Mail.php' );
140147
141148 $msgid = str_replace( " ", "_", microtime() );
142 - if ( function_exists( 'posix_getpid' ) )
 149+ if ( function_exists( 'posix_getpid' ) ) {
143150 $msgid .= '.' . posix_getpid();
 151+ }
144152
145153 if ( is_array( $to ) ) {
146154 $dest = array();
147 - foreach ( $to as $u )
 155+ foreach ( $to as $u ) {
148156 $dest[] = $u->address;
149 - } else
 157+ }
 158+ } else {
150159 $dest = $to->address;
 160+ }
151161
152162 $headers['From'] = $from->toString();
153163
@@ -256,6 +266,8 @@
257267
258268 /**
259269 * Converts a string into a valid RFC 822 "phrase", such as is used for the sender name
 270+ * @param $phrase string
 271+ * @return string
260272 */
261273 public static function rfc822Phrase( $phrase ) {
262274 $phrase = strtr( $phrase, array( "\r" => '', "\n" => '', '"' => '' ) );
@@ -332,8 +344,9 @@
333345 public function notifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid = false ) {
334346 global $wgEnotifUseJobQ, $wgEnotifWatchlist, $wgShowUpdatedMarker;
335347
336 - if ( $title->getNamespace() < 0 )
 348+ if ( $title->getNamespace() < 0 ) {
337349 return;
 350+ }
338351
339352 // Build a list of users to notfiy
340353 $watchers = array();
@@ -385,7 +398,7 @@
386399
387400 }
388401
389 - /*
 402+ /**
390403 * Immediate version of notifyOnPageChange().
391404 *
392405 * Send emails corresponding to the user $editor editing the page $title.
@@ -505,7 +518,7 @@
506519 }
507520
508521 if ( $wgEnotifImpersonal && $this->oldid ) {
509 - /*
 522+ /**
510523 * For impersonal mail, show a diff link to the last
511524 * revision.
512525 */
Index: trunk/phase3/includes/XmlTypeCheck.php
@@ -34,11 +34,16 @@
3535
3636 /**
3737 * Get the root element. Simple accessor to $rootElement
 38+ *
 39+ * @return string
3840 */
3941 public function getRootElement() {
4042 return $this->rootElement;
4143 }
4244
 45+ /**
 46+ * @param $fname
 47+ */
4348 private function run( $fname ) {
4449 $parser = xml_parser_create_ns( 'UTF-8' );
4550
@@ -65,6 +70,11 @@
6671 xml_parser_free( $parser );
6772 }
6873
 74+ /**
 75+ * @param $parser
 76+ * @param $name
 77+ * @param $attribs
 78+ */
6979 private function rootElementOpen( $parser, $name, $attribs ) {
7080 $this->rootElement = $name;
7181
@@ -76,7 +86,12 @@
7787 xml_set_element_handler( $parser, false, false );
7888 }
7989 }
80 -
 90+
 91+ /**
 92+ * @param $parser
 93+ * @param $name
 94+ * @param $attribs
 95+ */
8196 private function elementOpen( $parser, $name, $attribs ) {
8297 if( call_user_func( $this->filterCallback, $name, $attribs ) ) {
8398 // Filter hit!
Index: trunk/phase3/includes/UserArray.php
@@ -1,6 +1,11 @@
22 <?php
33
44 abstract class UserArray implements Iterator {
 5+
 6+ /**
 7+ * @param $res
 8+ * @return UserArrayFromResult
 9+ */
510 static function newFromResult( $res ) {
611 $userArray = null;
712 if ( !wfRunHooks( 'UserArrayFromResult', array( &$userArray, $res ) ) ) {
@@ -12,11 +17,16 @@
1318 return $userArray;
1419 }
1520
 21+ /**
 22+ * @param $ids array
 23+ * @return UserArrayFromResult
 24+ */
1625 static function newFromIDs( $ids ) {
1726 $ids = array_map( 'intval', (array)$ids ); // paranoia
18 - if ( !$ids )
 27+ if ( !$ids ) {
1928 // Database::select() doesn't like empty arrays
2029 return new ArrayIterator(array());
 30+ }
2131 $dbr = wfGetDB( DB_SLAVE );
2232 $res = $dbr->select( 'user', '*', array( 'user_id' => $ids ),
2333 __METHOD__ );

Status & tagging log