r114088 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114087‎ | r114088 | r114089 >
Date:22:52, 17 March 2012
Author:reedy
Status:reverted
Tags:gerritmigration 
Comment:
Trim trailing whitespace

Add/improve documentation

Explicitly define a few variables
Modified paths:
  • /trunk/phase3/includes/objectcache/MemcachedClient.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)
  • /trunk/phase3/languages/classes/LanguageKaa.php (modified) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/languages/LanguageTest.php
@@ -23,12 +23,12 @@
2424 'convertDoubleWidth() with the full alphabet and digits'
2525 );
2626 }
27 -
 27+
2828 /** @dataProvider provideFormattableTimes */
2929 function testFormatTimePeriod( $seconds, $format, $expected, $desc ) {
3030 $this->assertEquals( $expected, $this->lang->formatTimePeriod( $seconds, $format ), $desc );
3131 }
32 -
 32+
3333 function provideFormattableTimes() {
3434 return array(
3535 array( 9.45, array(), '9.5s', 'formatTimePeriod() rounding (<10s)' ),
@@ -62,7 +62,7 @@
6363 array( 176460.55, array(), '2d 1h 1m 1s', 'formatTimePeriod() rounding, recursion, (>48h)' ),
6464 array( 176460.55, array( 'noabbrevs' => true ), '2 days 1 hour 1 minute 1 second', 'formatTimePeriod() rounding, recursion, (>48h)' ),
6565 );
66 -
 66+
6767 }
6868
6969 function testTruncate() {
@@ -224,7 +224,7 @@
225225 "sprintfDate('$format', '$ts'): $msg"
226226 );
227227
228 - date_default_timezone_set( $oldTZ );
 228+ date_default_timezone_set( $oldTZ );
229229 }
230230
231231 function provideSprintfDateSamples() {
Index: trunk/phase3/includes/objectcache/MemcachedClient.php
@@ -344,11 +344,20 @@
345345 return false;
346346 }
347347
 348+ /**
 349+ * @param $key
 350+ * @param $timeout int
 351+ * @return bool
 352+ */
348353 public function lock( $key, $timeout = 0 ) {
349354 /* stub */
350355 return true;
351356 }
352357
 358+ /**
 359+ * @param $key
 360+ * @return bool
 361+ */
353362 public function unlock( $key ) {
354363 /* stub */
355364 return true;
@@ -471,7 +480,7 @@
472481 $this->stats['get_multi'] = 1;
473482 }
474483 $sock_keys = array();
475 -
 484+ $socks = array();
476485 foreach ( $keys as $key ) {
477486 $sock = $this->get_sock( $key );
478487 if ( !is_resource( $sock ) ) {
@@ -485,6 +494,7 @@
486495 $sock_keys[$sock][] = $key;
487496 }
488497
 498+ $gather = array();
489499 // Send out the requests
490500 foreach ( $socks as $sock ) {
491501 $cmd = 'get';
@@ -579,6 +589,7 @@
580590 return array();
581591 }
582592
 593+ $ret = array();
583594 while ( true ) {
584595 $res = fgets( $sock );
585596 $ret[] = $res;
@@ -744,6 +755,9 @@
745756 $this->_dead_host( $host );
746757 }
747758
 759+ /**
 760+ * @param $host
 761+ */
748762 function _dead_host( $host ) {
749763 $parts = explode( ':', $host );
750764 $ip = $parts[0];
@@ -774,8 +788,8 @@
775789 }
776790
777791 $hv = is_array( $key ) ? intval( $key[0] ) : $this->_hashfunc( $key );
778 -
779792 if ( $this->_buckets === null ) {
 793+ $bu = array();
780794 foreach ( $this->_servers as $v ) {
781795 if ( is_array( $v ) ) {
782796 for( $i = 0; $i < $v[1]; $i++ ) {
@@ -851,7 +865,8 @@
852866 $this->stats[$cmd] = 1;
853867 }
854868 if ( !$this->_safe_fwrite( $sock, "$cmd $key $amt\r\n" ) ) {
855 - return $this->_dead_sock( $sock );
 869+ $this->_dead_sock( $sock );
 870+ return null;
856871 }
857872
858873 $line = fgets( $sock );
@@ -998,7 +1013,8 @@
9991014 }
10001015 }
10011016 if ( !$this->_safe_fwrite( $sock, "$cmd $key $flags $exp $len\r\n$val\r\n" ) ) {
1002 - return $this->_dead_sock( $sock );
 1017+ $this->_dead_sock( $sock );
 1018+ return false;
10031019 }
10041020
10051021 $line = trim( fgets( $sock ) );
@@ -1038,7 +1054,8 @@
10391055 }
10401056
10411057 if ( !$this->_connect_sock( $sock, $host ) ) {
1042 - return $this->_dead_host( $host );
 1058+ $this->_dead_host( $host );
 1059+ return null;
10431060 }
10441061
10451062 // Do not buffer writes
@@ -1049,6 +1066,9 @@
10501067 return $this->_cache_sock[$host];
10511068 }
10521069
 1070+ /**
 1071+ * @param $str string
 1072+ */
10531073 function _debugprint( $str ) {
10541074 print( $str );
10551075 }
@@ -1080,6 +1100,9 @@
10811101
10821102 /**
10831103 * Original behaviour
 1104+ * @param $f
 1105+ * @param $buf
 1106+ * @param $len bool
10841107 * @return int
10851108 */
10861109 function _safe_fwrite( $f, $buf, $len = false ) {
@@ -1093,6 +1116,7 @@
10941117
10951118 /**
10961119 * Flush the read buffer of a stream
 1120+ * @param $f Resource
10971121 */
10981122 function _flush_read_buffer( $f ) {
10991123 if ( !is_resource( $f ) ) {
Index: trunk/phase3/languages/Language.php
@@ -3800,7 +3800,7 @@
38013801
38023802 /**
38033803 * Decode an expiry (block, protection, etc) which has come from the DB
3804 - *
 3804+ *
38053805 * @FIXME: why are we returnings DBMS-dependent strings???
38063806 *
38073807 * @param $expiry String: Database expiry String
Index: trunk/phase3/languages/classes/LanguageKaa.php
@@ -41,11 +41,11 @@
4242 }
4343
4444 /**
45 - * It fixes issue with lcfirst for transforming 'I' to 'ı'
 45+ * It fixes issue with lcfirst for transforming 'I' to 'ı'
4646 *
4747 * @param $string string
4848 *
49 - * @return string
 49+ * @return mixed|string
5050 */
5151 function lcfirst ( $string ) {
5252 if ( substr( $string, 0, 1 ) === 'I' ) {

Sign-offs

UserFlagDate
Amire80inspected23:20, 18 March 2012
Krinkleinspected14:58, 19 March 2012

Follow-up revisions

RevisionCommit summaryAuthorDate
r114326Revert r114067, r114071, r114075, r114079, r114081, r114082, r114084, r114086......catrope23:03, 20 March 2012

Status & tagging log