https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114088

Revision: 114088
Author:   reedy
Date:     2012-03-17 22:52:54 +0000 (Sat, 17 Mar 2012)
Log Message:
-----------
Trim trailing whitespace

Add/improve documentation

Explicitly define a few variables

Modified Paths:
--------------
    trunk/phase3/includes/objectcache/MemcachedClient.php
    trunk/phase3/languages/Language.php
    trunk/phase3/languages/classes/LanguageKaa.php
    trunk/phase3/tests/phpunit/languages/LanguageTest.php

Modified: trunk/phase3/includes/objectcache/MemcachedClient.php
===================================================================
--- trunk/phase3/includes/objectcache/MemcachedClient.php       2012-03-17 
22:50:52 UTC (rev 114087)
+++ trunk/phase3/includes/objectcache/MemcachedClient.php       2012-03-17 
22:52:54 UTC (rev 114088)
@@ -344,11 +344,20 @@
                return false;
        }
 
+       /**
+        * @param $key
+        * @param $timeout int
+        * @return bool
+        */
        public function lock( $key, $timeout = 0 ) {
                /* stub */
                return true;
        }
 
+       /**
+        * @param $key
+        * @return bool
+        */
        public function unlock( $key ) {
                /* stub */
                return true;
@@ -471,7 +480,7 @@
                        $this->stats['get_multi'] = 1;
                }
                $sock_keys = array();
-
+               $socks = array();
                foreach ( $keys as $key ) {
                        $sock = $this->get_sock( $key );
                        if ( !is_resource( $sock ) ) {
@@ -485,6 +494,7 @@
                        $sock_keys[$sock][] = $key;
                }
 
+               $gather = array();
                // Send out the requests
                foreach ( $socks as $sock ) {
                        $cmd = 'get';
@@ -579,6 +589,7 @@
                        return array();
                }
 
+               $ret = array();
                while ( true ) {
                        $res = fgets( $sock );
                        $ret[] = $res;
@@ -744,6 +755,9 @@
                $this->_dead_host( $host );
        }
 
+       /**
+        * @param $host
+        */
        function _dead_host( $host ) {
                $parts = explode( ':', $host );
                $ip = $parts[0];
@@ -774,8 +788,8 @@
                }
 
                $hv = is_array( $key ) ? intval( $key[0] ) : $this->_hashfunc( 
$key );
-
                if ( $this->_buckets === null ) {
+                       $bu = array();
                        foreach ( $this->_servers as $v ) {
                                if ( is_array( $v ) ) {
                                        for( $i = 0; $i < $v[1]; $i++ ) {
@@ -851,7 +865,8 @@
                        $this->stats[$cmd] = 1;
                }
                if ( !$this->_safe_fwrite( $sock, "$cmd $key $amt\r\n" ) ) {
-                       return $this->_dead_sock( $sock );
+                       $this->_dead_sock( $sock );
+                       return null;
                }
 
                $line = fgets( $sock );
@@ -998,7 +1013,8 @@
                        }
                }
                if ( !$this->_safe_fwrite( $sock, "$cmd $key $flags $exp 
$len\r\n$val\r\n" ) ) {
-                       return $this->_dead_sock( $sock );
+                       $this->_dead_sock( $sock );
+                       return false;
                }
 
                $line = trim( fgets( $sock ) );
@@ -1038,7 +1054,8 @@
                }
 
                if ( !$this->_connect_sock( $sock, $host ) ) {
-                       return $this->_dead_host( $host );
+                       $this->_dead_host( $host );
+                       return null;
                }
 
                // Do not buffer writes
@@ -1049,6 +1066,9 @@
                return $this->_cache_sock[$host];
        }
 
+       /**
+        * @param $str string
+        */
        function _debugprint( $str ) {
                print( $str );
        }
@@ -1080,6 +1100,9 @@
 
        /**
         * Original behaviour
+        * @param $f
+        * @param $buf
+        * @param $len bool
         * @return int
         */
        function _safe_fwrite( $f, $buf, $len = false ) {
@@ -1093,6 +1116,7 @@
 
        /**
         * Flush the read buffer of a stream
+        * @param $f Resource
         */
        function _flush_read_buffer( $f ) {
                if ( !is_resource( $f ) ) {

Modified: trunk/phase3/languages/Language.php
===================================================================
--- trunk/phase3/languages/Language.php 2012-03-17 22:50:52 UTC (rev 114087)
+++ trunk/phase3/languages/Language.php 2012-03-17 22:52:54 UTC (rev 114088)
@@ -3800,7 +3800,7 @@
 
        /**
         * Decode an expiry (block, protection, etc) which has come from the DB
-        * 
+        *
         * @FIXME: why are we returnings DBMS-dependent strings???
         *
         * @param $expiry String: Database expiry String

Modified: trunk/phase3/languages/classes/LanguageKaa.php
===================================================================
--- trunk/phase3/languages/classes/LanguageKaa.php      2012-03-17 22:50:52 UTC 
(rev 114087)
+++ trunk/phase3/languages/classes/LanguageKaa.php      2012-03-17 22:52:54 UTC 
(rev 114088)
@@ -41,11 +41,11 @@
        }
 
        /**
-        * It fixes issue with  lcfirst for transforming 'I' to 'ı'
+        * It fixes issue with lcfirst for transforming 'I' to 'ı'
         *
         * @param $string string
         *
-        * @return string
+        * @return mixed|string
         */
        function lcfirst ( $string ) {
                if ( substr( $string, 0, 1 ) === 'I' ) {

Modified: trunk/phase3/tests/phpunit/languages/LanguageTest.php
===================================================================
--- trunk/phase3/tests/phpunit/languages/LanguageTest.php       2012-03-17 
22:50:52 UTC (rev 114087)
+++ trunk/phase3/tests/phpunit/languages/LanguageTest.php       2012-03-17 
22:52:54 UTC (rev 114088)
@@ -23,12 +23,12 @@
                        'convertDoubleWidth() with the full alphabet and digits'
                );
        }
-       
+
        /** @dataProvider provideFormattableTimes */
        function testFormatTimePeriod( $seconds, $format, $expected, $desc ) {
                $this->assertEquals( $expected, $this->lang->formatTimePeriod( 
$seconds, $format ), $desc );
        }
-       
+
        function provideFormattableTimes() {
                return array(
                        array( 9.45, array(), '9.5s', 'formatTimePeriod() 
rounding (<10s)' ),
@@ -62,7 +62,7 @@
                        array( 176460.55, array(), '2d 1h 1m 1s', 
'formatTimePeriod() rounding, recursion, (>48h)' ),
                        array( 176460.55, array( 'noabbrevs' => true ), '2 days 
1 hour 1 minute 1 second', 'formatTimePeriod() rounding, recursion, (>48h)' ),
                );
-               
+
        }
 
        function testTruncate() {
@@ -224,7 +224,7 @@
                        "sprintfDate('$format', '$ts'): $msg"
                );
 
-               date_default_timezone_set( $oldTZ );            
+               date_default_timezone_set( $oldTZ );
        }
 
        function provideSprintfDateSamples() {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to