From bc1c6d2a6b1ff26249ba2a77f504f281a60fbb8f Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Mon, 25 Apr 2011 22:41:54 +0000 Subject: [PATCH] More parameter and return type hints --- includes/Cdb.php | 10 ++++++ includes/SquidPurgeClient.php | 5 +++ includes/cache/LinkCache.php | 2 ++ includes/cache/MessageCache.php | 2 ++ includes/cache/SquidUpdate.php | 33 +++++++++++++++---- .../objectcache/MemcachedPhpBagOStuff.php | 2 ++ 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/includes/Cdb.php b/includes/Cdb.php index 604774853c..8f93560bed 100644 --- a/includes/Cdb.php +++ b/includes/Cdb.php @@ -13,6 +13,10 @@ abstract class CdbReader { /** * Open a file and return a subclass instance + * + * @param $fileName string + * + * @return CdbReader */ public static function open( $fileName ) { if ( self::haveExtension() ) { @@ -25,6 +29,8 @@ abstract class CdbReader { /** * Returns true if the native extension is available + * + * @return bool */ public static function haveExtension() { if ( !function_exists( 'dba_handlers' ) ) { @@ -61,6 +67,10 @@ abstract class CdbWriter { /** * Open a writer and return a subclass instance. * The user must have write access to the directory, for temporary file creation. + * + * @param $fileName string + * + * @return bool */ public static function open( $fileName ) { if ( CdbReader::haveExtension() ) { diff --git a/includes/SquidPurgeClient.php b/includes/SquidPurgeClient.php index d439b58121..664f59a047 100644 --- a/includes/SquidPurgeClient.php +++ b/includes/SquidPurgeClient.php @@ -139,6 +139,8 @@ class SquidPurgeClient { /** * Queue a purge operation + * + * @param $url string */ public function queuePurge( $url ) { $url = str_replace( "\n", '', $url ); @@ -151,6 +153,9 @@ class SquidPurgeClient { } } + /** + * @return bool + */ public function isIdle() { return strlen( $this->writeBuffer ) == 0 && $this->readState == 'idle'; } diff --git a/includes/cache/LinkCache.php b/includes/cache/LinkCache.php index f3dea93e56..0e1029e554 100644 --- a/includes/cache/LinkCache.php +++ b/includes/cache/LinkCache.php @@ -14,6 +14,8 @@ class LinkCache { /** * Get an instance of this class + * + * @return LinkCache */ static function &singleton() { static $instance; diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index a498fca0a9..3e0668c807 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -64,6 +64,8 @@ class MessageCache { /** * Singleton instance + * + * @var MessageCache */ private static $instance; diff --git a/includes/cache/SquidUpdate.php b/includes/cache/SquidUpdate.php index 91f1d283fa..dddc7b8ff1 100644 --- a/includes/cache/SquidUpdate.php +++ b/includes/cache/SquidUpdate.php @@ -25,6 +25,11 @@ class SquidUpdate { $this->urlArr = $urlArr; } + /** + * @param $title Title + * + * @return SquidUpdate + */ static function newFromLinksTo( &$title ) { global $wgMaxSquidPurgeTitles; wfProfileIn( __METHOD__ ); @@ -52,6 +57,11 @@ class SquidUpdate { /** * Create a SquidUpdate from an array of Title objects, or a TitleArray object + * + * @param $titles array + * @param $urlArr array + * + * @return SquidUpdate */ static function newFromTitles( $titles, $urlArr = array() ) { global $wgMaxSquidPurgeTitles; @@ -65,6 +75,11 @@ class SquidUpdate { return new SquidUpdate( $urlArr ); } + /** + * @param $title Title + * + * @return SquidUpdate + */ static function newSimplePurge( &$title ) { $urlArr = $title->getSquidURLs(); return new SquidUpdate( $urlArr ); @@ -74,11 +89,15 @@ class SquidUpdate { SquidUpdate::purge( $this->urlArr ); } - /* Purges a list of Squids defined in $wgSquidServers. - $urlArr should contain the full URLs to purge as values - (example: $urlArr[] = 'http://my.host/something') - XXX report broken Squids per mail or log */ - + /** + * Purges a list of Squids defined in $wgSquidServers. + * $urlArr should contain the full URLs to purge as values + * (example: $urlArr[] = 'http://my.host/something') + * XXX report broken Squids per mail or log + * + * @param $urlArr array + * @return void + */ static function purge( $urlArr ) { global $wgSquidServers, $wgHTCPMulticastAddress, $wgHTCPPort; @@ -124,7 +143,7 @@ class SquidUpdate { global $wgHTCPMulticastAddress, $wgHTCPMulticastTTL, $wgHTCPPort; wfProfileIn( __METHOD__ ); - $htcpOpCLR = 4; // HTCP CLR + $htcpOpCLR = 4; // HTCP CLR // FIXME PHP doesn't support these socket constants (include/linux/in.h) if( !defined( "IPPROTO_IP" ) ) { @@ -190,6 +209,8 @@ class SquidUpdate { * * Client functions should not need to call this. * + * @param $url string + * * @return string */ static function expand( $url ) { diff --git a/includes/objectcache/MemcachedPhpBagOStuff.php b/includes/objectcache/MemcachedPhpBagOStuff.php index 73281c816f..17d1292e35 100644 --- a/includes/objectcache/MemcachedPhpBagOStuff.php +++ b/includes/objectcache/MemcachedPhpBagOStuff.php @@ -20,6 +20,8 @@ class MemcachedPhpBagOStuff extends BagOStuff { * - compress_threshold: The minimum size an object must be before it is compressed * - timeout: The read timeout in microseconds * - connect_timeout: The connect timeout in seconds + * + * @params $params array */ function __construct( $params ) { if ( !isset( $params['servers'] ) ) { -- 2.20.1