From: Sam Reed Date: Mon, 25 Apr 2011 21:25:45 +0000 (+0000) Subject: Type hinting X-Git-Tag: 1.31.0-rc.0~30556 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=8775ac3b20b03b1b446217d637b3aad3019f1cad;p=lhc%2Fweb%2Fwiklou.git Type hinting Braces Remove extra whitespace --- diff --git a/includes/BacklinkCache.php b/includes/BacklinkCache.php index 0ebbdc39cf..6715d256e2 100644 --- a/includes/BacklinkCache.php +++ b/includes/BacklinkCache.php @@ -114,7 +114,7 @@ class BacklinkCache { * @param $table String * @param $startId Integer or false * @param $endId Integer or false - * @return TitleArray + * @return TitleArrayFromResult */ public function getLinks( $table, $startId = false, $endId = false ) { wfProfileIn( __METHOD__ ); @@ -272,7 +272,6 @@ class BacklinkCache { $this->partitionCache[$table][$batchSize] = false; $cacheEntry =& $this->partitionCache[$table][$batchSize]; - // 2) try full result cache if ( isset( $this->fullResultCache[$table] ) ) { @@ -282,7 +281,6 @@ class BacklinkCache { return $cacheEntry['batches']; } - // 3) ... fallback to memcached ... global $wgMemc; @@ -317,7 +315,7 @@ class BacklinkCache { /** * Partition a DB result with backlinks in it into batches - * @param $res database result + * @param $res ResultWrapper database result * @param $batchSize integer * @return array @see */ diff --git a/includes/GenderCache.php b/includes/GenderCache.php index f7537a2e84..a8b32ccb69 100644 --- a/includes/GenderCache.php +++ b/includes/GenderCache.php @@ -91,7 +91,9 @@ class GenderCache { * @param $caller String: the calling method */ public function doQuery( $users, $caller = '' ) { - if ( count( $users ) === 0 ) return false; + if ( count( $users ) === 0 ) { + return false; + } foreach ( (array) $users as $index => $value ) { $users[$index] = strtr( $value, '_', ' ' ); diff --git a/includes/HTMLFileCache.php b/includes/HTMLFileCache.php index 20224b0633..949ed36f5c 100644 --- a/includes/HTMLFileCache.php +++ b/includes/HTMLFileCache.php @@ -69,7 +69,9 @@ class HTMLFileCache { } public function isFileCached() { - if( $this->mType === false ) return false; + if( $this->mType === false ) { + return false; + } return file_exists( $this->fileCacheName() ); } @@ -83,20 +85,28 @@ class HTMLFileCache { */ public static function useFileCache() { global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest, $wgLang, $wgContLang; - if( !$wgUseFileCache ) return false; + if( !$wgUseFileCache ) { + return false; + } // Get all query values $queryVals = $wgRequest->getValues(); foreach( $queryVals as $query => $val ) { - if( $query == 'title' || $query == 'curid' ) continue; + if( $query == 'title' || $query == 'curid' ) { + continue; + } // Normal page view in query form can have action=view. // Raw hits for pages also stored, like .css pages for example. - else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) continue; - else if( $query == 'usemsgcache' && $val == 'yes' ) continue; + else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) { + continue; + } else if( $query == 'usemsgcache' && $val == 'yes' ) { + continue; + } // Below are header setting params - else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) + else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) { continue; - else + } else { return false; + } } // Check for non-standard user language; this covers uselang, // and extensions for auto-detecting user language. @@ -113,7 +123,9 @@ class HTMLFileCache { public function isFileCacheGood( $timestamp = '' ) { global $wgCacheEpoch; - if( !$this->isFileCached() ) return false; + if( !$this->isFileCached() ) { + return false; + } $cachetime = $this->fileCacheTime(); $good = $timestamp <= $cachetime && $wgCacheEpoch <= $cachetime; diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index c09403ab2f..c45caf07ef 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -15,7 +15,7 @@ function wfGetForwardedFor() { $apacheHeaders = function_exists( 'apache_request_headers' ) ? apache_request_headers() : null; if( is_array( $apacheHeaders ) ) { // More reliable than $_SERVER due to case and -/_ folding - $set = array (); + $set = array(); foreach ( $apacheHeaders as $tempName => $tempValue ) { $set[ strtoupper( $tempName ) ] = $tempValue; } @@ -46,7 +46,7 @@ function wfGetForwardedFor() { function wfGetAgent() { if( function_exists( 'apache_request_headers' ) ) { // More reliable than $_SERVER due to case and -/_ folding - $set = array (); + $set = array(); foreach ( apache_request_headers() as $tempName => $tempValue ) { $set[ strtoupper( $tempName ) ] = $tempValue; } @@ -134,13 +134,8 @@ function wfGetIP() { function wfIsTrustedProxy( $ip ) { global $wgSquidServers, $wgSquidServersNoPurge; - if ( in_array( $ip, $wgSquidServers ) || - in_array( $ip, $wgSquidServersNoPurge ) - ) { - $trusted = true; - } else { - $trusted = false; - } + $trusted = in_array( $ip, $wgSquidServers ) || + in_array( $ip, $wgSquidServersNoPurge ); wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) ); return $trusted; } diff --git a/includes/TitleArray.php b/includes/TitleArray.php index f7a9e1dc64..7274a19d0b 100644 --- a/includes/TitleArray.php +++ b/includes/TitleArray.php @@ -14,7 +14,7 @@ abstract class TitleArray implements Iterator { * @param $res result A MySQL result including at least page_namespace and * page_title -- also can have page_id, page_len, page_is_redirect, * page_latest (if those will be used). See Title::newFromRow. - * @return TitleArray + * @return TitleArrayFromResult */ static function newFromResult( $res ) { $array = null; @@ -27,6 +27,10 @@ abstract class TitleArray implements Iterator { return $array; } + /** + * @param $res + * @return TitleArrayFromResult + */ protected static function newFromResult_internal( $res ) { $array = new TitleArrayFromResult( $res ); return $array; diff --git a/maintenance/importImages.inc b/maintenance/importImages.inc index 8c4bdc08ec..5d35e2c02d 100644 --- a/maintenance/importImages.inc +++ b/maintenance/importImages.inc @@ -54,7 +54,7 @@ function findFiles( $dir, $exts ) { /** * Split a filename into filename and extension * - * @param $filename Filename + * @param $filename string Filename * @return array */ function splitFilename( $filename ) {