Fixed some @params documentation (includes/utils)
authorumherirrender <umherirrender_de.wp@web.de>
Mon, 21 Jul 2014 18:58:14 +0000 (20:58 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Mon, 21 Jul 2014 18:58:14 +0000 (20:58 +0200)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: I9bd4ef370016cbbcce42d2612031a264eb3de61b

includes/utils/Cdb.php
includes/utils/CdbPHP.php
includes/utils/IP.php
includes/utils/MWCryptHKDF.php
includes/utils/MWCryptRand.php
includes/utils/MWFunction.php
includes/utils/StringUtils.php
includes/utils/UIDGenerator.php
includes/utils/ZipDirectoryReader.php

index b16d4a4..b97e2ad 100644 (file)
@@ -34,7 +34,7 @@ abstract class CdbReader {
        /**
         * Open a file and return a subclass instance
         *
-        * @param $fileName string
+        * @param string $fileName
         *
         * @return CdbReader
         */
@@ -64,7 +64,7 @@ abstract class CdbReader {
        /**
         * Create the object and open the file
         *
-        * @param $fileName string
+        * @param string $fileName
         */
        abstract public function __construct( $fileName );
 
@@ -76,7 +76,7 @@ abstract class CdbReader {
        /**
         * Get a value with a given key. Only string values are supported.
         *
-        * @param $key string
+        * @param string $key
         */
        abstract public function get( $key );
 }
@@ -107,7 +107,7 @@ 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
+        * @param string $fileName
         *
         * @return CdbWriterDBA|CdbWriterPHP
         */
@@ -120,14 +120,14 @@ abstract class CdbWriter {
        /**
         * Create the object and open the file
         *
-        * @param $fileName string
+        * @param string $fileName
         */
        abstract public function __construct( $fileName );
 
        /**
         * Set a key to a given value. The value will be converted to string.
-        * @param $key string
-        * @param $value string
+        * @param string $key
+        * @param string $value
         */
        abstract public function set( $key, $value );
 
index baba580..19d747a 100644 (file)
@@ -32,8 +32,8 @@ class CdbFunctions {
         * Take a modulo of a signed integer as if it were an unsigned integer.
         * $b must be less than 0x40000000 and greater than 0
         *
-        * @param $a
-        * @param $b
+        * @param int $a
+        * @param int $b
         *
         * @return int
         */
@@ -49,8 +49,8 @@ class CdbFunctions {
 
        /**
         * Shift a signed integer right as if it were unsigned
-        * @param $a
-        * @param $b
+        * @param int $a
+        * @param int $b
         * @return int
         */
        public static function unsignedShiftRight( $a, $b ) {
@@ -67,7 +67,7 @@ class CdbFunctions {
        /**
         * The CDB hash function.
         *
-        * @param $s string
+        * @param string $s
         *
         * @return int
         */
@@ -125,7 +125,7 @@ class CdbReaderPHP extends CdbReader {
        protected $dlen;
 
        /**
-        * @param $fileName string
+        * @param string $fileName
         * @throws CdbException
         */
        public function __construct( $fileName ) {
@@ -145,7 +145,7 @@ class CdbReaderPHP extends CdbReader {
        }
 
        /**
-        * @param $key
+        * @param mixed $key
         * @return bool|string
         */
        public function get( $key ) {
@@ -158,8 +158,8 @@ class CdbReaderPHP extends CdbReader {
        }
 
        /**
-        * @param $key
-        * @param $pos
+        * @param string $key
+        * @param int $pos
         * @return bool
         */
        protected function match( $key, $pos ) {
@@ -174,8 +174,8 @@ class CdbReaderPHP extends CdbReader {
 
        /**
         * @throws CdbException
-        * @param $length
-        * @param $pos
+        * @param int $length
+        * @param int $pos
         * @return string
         */
        protected function read( $length, $pos ) {
@@ -200,7 +200,7 @@ class CdbReaderPHP extends CdbReader {
 
        /**
         * Unpack an unsigned integer and throw an exception if it needs more than 31 bits
-        * @param $s
+        * @param string $s
         * @throws CdbException
         * @return mixed
         */
@@ -216,7 +216,7 @@ class CdbReaderPHP extends CdbReader {
 
        /**
         * Unpack a 32-bit signed integer
-        * @param $s
+        * @param string $s
         * @return int
         */
        protected function unpackSigned( $s ) {
@@ -226,7 +226,7 @@ class CdbReaderPHP extends CdbReader {
        }
 
        /**
-        * @param $key
+        * @param string $key
         * @return bool
         */
        protected function findNext( $key ) {
@@ -274,7 +274,7 @@ class CdbReaderPHP extends CdbReader {
        }
 
        /**
-        * @param $key
+        * @param mixed $key
         * @return bool
         */
        protected function find( $key ) {
@@ -295,7 +295,7 @@ class CdbWriterPHP extends CdbWriter {
        protected $pos;
 
        /**
-        * @param $fileName string
+        * @param string $fileName
         */
        public function __construct( $fileName ) {
                $this->realFileName = $fileName;
@@ -347,7 +347,7 @@ class CdbWriterPHP extends CdbWriter {
 
        /**
         * @throws CdbException
-        * @param $buf
+        * @param string $buf
         */
        protected function write( $buf ) {
                $len = fwrite( $this->handle, $buf );
@@ -358,7 +358,7 @@ class CdbWriterPHP extends CdbWriter {
 
        /**
         * @throws CdbException
-        * @param $len
+        * @param int $len
         */
        protected function posplus( $len ) {
                $newpos = $this->pos + $len;
@@ -370,9 +370,9 @@ class CdbWriterPHP extends CdbWriter {
        }
 
        /**
-        * @param $keylen
-        * @param $datalen
-        * @param $h
+        * @param int $keylen
+        * @param int $datalen
+        * @param int $h
         */
        protected function addend( $keylen, $datalen, $h ) {
                $this->hplist[] = array(
@@ -388,8 +388,8 @@ class CdbWriterPHP extends CdbWriter {
 
        /**
         * @throws CdbException
-        * @param $keylen
-        * @param $datalen
+        * @param int $keylen
+        * @param int $datalen
         */
        protected function addbegin( $keylen, $datalen ) {
                if ( $keylen > 0x7fffffff ) {
@@ -481,7 +481,7 @@ class CdbWriterPHP extends CdbWriter {
        /**
         * Clean up the temp file and throw an exception
         *
-        * @param $msg string
+        * @param string $msg
         * @throws CdbException
         */
        protected function throwException( $msg ) {
index e4e1cfd..0e2db8c 100644 (file)
@@ -73,8 +73,8 @@ class IP {
         * SIIT IPv4-translated addresses are rejected.
         * Note: canonicalize() tries to convert translated addresses to IPv4.
         *
-        * @param string $ip possible IP address
-        * @return Boolean
+        * @param string $ip Possible IP address
+        * @return bool
         */
        public static function isIPAddress( $ip ) {
                return (bool)preg_match( '/^' . IP_ADDRESS_STRING . '$/', $ip );
@@ -84,8 +84,8 @@ class IP {
         * Given a string, determine if it as valid IP in IPv6 only.
         * Note: Unlike isValid(), this looks for networks too.
         *
-        * @param string $ip possible IP address
-        * @return Boolean
+        * @param string $ip Possible IP address
+        * @return bool
         */
        public static function isIPv6( $ip ) {
                return (bool)preg_match( '/^' . RE_IPV6_ADD . '(?:\/' . RE_IPV6_PREFIX . ')?$/', $ip );
@@ -95,8 +95,8 @@ class IP {
         * Given a string, determine if it as valid IP in IPv4 only.
         * Note: Unlike isValid(), this looks for networks too.
         *
-        * @param string $ip possible IP address
-        * @return Boolean
+        * @param string $ip Possible IP address
+        * @return bool
         */
        public static function isIPv4( $ip ) {
                return (bool)preg_match( '/^' . RE_IP_ADD . '(?:\/' . RE_IP_PREFIX . ')?$/', $ip );
@@ -107,8 +107,8 @@ class IP {
         * SIIT IPv4-translated addresses are rejected.
         * Note: canonicalize() tries to convert translated addresses to IPv4.
         *
-        * @param $ip String
-        * @return Boolean: True if it is valid.
+        * @param string $ip
+        * @return bool True if it is valid
         */
        public static function isValid( $ip ) {
                return ( preg_match( '/^' . RE_IP_ADD . '$/', $ip )
@@ -120,8 +120,8 @@ class IP {
         * SIIT IPv4-translated addresses are rejected.
         * Note: canonicalize() tries to convert translated addresses to IPv4.
         *
-        * @param $ipblock String
-        * @return Boolean: True if it is valid.
+        * @param string $ipblock
+        * @return bool True if it is valid
         */
        public static function isValidBlock( $ipblock ) {
                return ( preg_match( '/^' . RE_IPV6_BLOCK . '$/', $ipblock )
@@ -134,7 +134,7 @@ class IP {
         * IPv4 addresses are just trimmed.
         *
         * @param string $ip IP address in quad or octet form (CIDR or not).
-        * @return String
+        * @return string
         */
        public static function sanitizeIP( $ip ) {
                $ip = trim( $ip );
@@ -186,7 +186,7 @@ class IP {
         * Prettify an IP for display to end users.
         * This will make it more compact and lower-case.
         *
-        * @param $ip string
+        * @param string $ip
         * @return string
         */
        public static function prettifyIP( $ip ) {
@@ -286,9 +286,9 @@ class IP {
         * brackets like in RFC 2732. If the port matches the default port, omit
         * the port specification
         *
-        * @param $host string
-        * @param $port int
-        * @param $defaultPort bool|int
+        * @param string $host
+        * @param int $port
+        * @param bool|int $defaultPort
         * @return string
         */
        public static function combineHostAndPort( $host, $port, $defaultPort = false ) {
@@ -305,8 +305,8 @@ class IP {
        /**
         * Convert an IPv4 or IPv6 hexadecimal representation back to readable format
         *
-        * @param string $hex number, with "v6-" prefix if it is IPv6
-        * @return String: quad-dotted (IPv4) or octet notation (IPv6)
+        * @param string $hex Number, with "v6-" prefix if it is IPv6
+        * @return string Quad-dotted (IPv4) or octet notation (IPv6)
         */
        public static function formatHex( $hex ) {
                if ( substr( $hex, 0, 3 ) == 'v6-' ) { // IPv6
@@ -319,8 +319,8 @@ class IP {
        /**
         * Converts a hexadecimal number to an IPv6 address in octet notation
         *
-        * @param $ip_hex String: pure hex (no v6- prefix)
-        * @return String (of format a:b:c:d:e:f:g:h)
+        * @param string $ip_hex Pure hex (no v6- prefix)
+        * @return string (of format a:b:c:d:e:f:g:h)
         */
        public static function hexToOctet( $ip_hex ) {
                // Pad hex to 32 chars (128 bits)
@@ -339,8 +339,8 @@ class IP {
        /**
         * Converts a hexadecimal number to an IPv4 address in quad-dotted notation
         *
-        * @param $ip_hex String: pure hex
-        * @return String (of format a.b.c.d)
+        * @param string $ip_hex Pure hex
+        * @return string (of format a.b.c.d)
         */
        public static function hexToQuad( $ip_hex ) {
                // Pad hex to 8 chars (32 bits)
@@ -361,8 +361,8 @@ class IP {
         * Determine if an IP address really is an IP address, and if it is public,
         * i.e. not RFC 1918 or similar
         *
-        * @param $ip String
-        * @return Boolean
+        * @param string $ip
+        * @return bool
         */
        public static function isPublic( $ip ) {
                static $privateSet = null;
@@ -388,8 +388,8 @@ class IP {
         * function for an IPv6 address will be prefixed with "v6-", a non-
         * hexadecimal string which sorts after the IPv4 addresses.
         *
-        * @param string $ip quad dotted/octet IP address.
-        * @return String|bool false on failure
+        * @param string $ip Quad dotted/octet IP address.
+        * @return string|bool False on failure
         */
        public static function toHex( $ip ) {
                if ( self::isIPv6( $ip ) ) {
@@ -420,8 +420,8 @@ class IP {
        /**
         * Given an IPv6 address in octet notation, returns a pure hex string.
         *
-        * @param string $ip octet ipv6 IP address.
-        * @return String|bool pure hex (uppercase); false on failure
+        * @param string $ip Octet ipv6 IP address.
+        * @return string|bool Pure hex (uppercase); false on failure
         */
        private static function IPv6ToRawHex( $ip ) {
                $ip = self::sanitizeIP( $ip );
@@ -529,7 +529,7 @@ class IP {
         * Convert a network specification in IPv6 CIDR notation to an
         * integer network and a number of bits
         *
-        * @param $range
+        * @param string $range
         *
         * @return array(string, int)
         */
@@ -570,7 +570,7 @@ class IP {
         *     2001:0db8:85a3::7344 - 2001:0db8:85a3::7344   Explicit range
         *     2001:0db8:85a3::7344/96                       Single IP
         *
-        * @param $range
+        * @param string $range
         *
         * @return array(string, string)
         */
@@ -616,9 +616,9 @@ class IP {
        /**
         * Determine if a given IPv4/IPv6 address is in a given CIDR network
         *
-        * @param string $addr the address to check against the given range.
-        * @param string $range the range to check the given address against.
-        * @return Boolean: whether or not the given address is in the given range.
+        * @param string $addr The address to check against the given range.
+        * @param string $range The range to check the given address against.
+        * @return bool Whether or not the given address is in the given range.
         */
        public static function isInRange( $addr, $range ) {
                $hexIP = self::toHex( $addr );
@@ -635,8 +635,8 @@ class IP {
         * This currently only checks a few IPV4-to-IPv6 related cases.  More
         * unusual representations may be added later.
         *
-        * @param string $addr something that might be an IP address
-        * @return String: valid dotted quad IPv4 address or null
+        * @param string $addr Something that might be an IP address
+        * @return string Valid dotted quad IPv4 address or null
         */
        public static function canonicalize( $addr ) {
                // remove zone info (bug 35738)
index aa86ea4..8610386 100644 (file)
@@ -101,7 +101,7 @@ class MWCryptHKDF {
        /**
         * @param string $hash Name of hashing algorithm
         * @param BagOStuff $cache
-        * @param string|array $context to mix into HKDF context
+        * @param string|array $context Context to mix into HKDF context
         */
        public function __construct( $secretKeyMaterial, $algorithm, $cache, $context ) {
                if ( strlen( $secretKeyMaterial ) < 16 ) {
@@ -133,7 +133,7 @@ class MWCryptHKDF {
 
        /**
         * MW specific salt, cached from last run
-        * @return string binary string
+        * @return string Binary string
         */
        protected function getSaltUsingCache() {
                if ( $this->salt == '' ) {
@@ -189,9 +189,9 @@ class MWCryptHKDF {
        /**
         * Produce $bytes of secure random data. As a side-effect,
         * $this->lastK is set to the last hashLen block of key material.
-        * @param int $bytes number of bytes of data
-        * @param string $context to mix into CTXinfo
-        * @return string binary string of length $bytes
+        * @param int $bytes Number of bytes of data
+        * @param string $context Context to mix into CTXinfo
+        * @return string Binary string of length $bytes
         */
        protected function realGenerate( $bytes, $context = '' ) {
 
@@ -237,13 +237,13 @@ class MWCryptHKDF {
         * N.B. http://eprint.iacr.org/2010/264.pdf seems to differ from RFC 5869 in that the test
         * vectors from RFC 5869 only work if K(0) = '' and K(1) = HMAC(PRK, K(0) || CTXinfo || 1)
         *
-        * @param string $hash the hashing function to use (e.g., sha256)
-        * @param string $ikm the input keying material
-        * @param string $salt the salt to add to the ikm, to get the prk
-        * @param string $info optional context (change the output without affecting
+        * @param string $hash The hashing function to use (e.g., sha256)
+        * @param string $ikm The input keying material
+        * @param string $salt The salt to add to the ikm, to get the prk
+        * @param string $info Optional context (change the output without affecting
         *      the randomness properties of the output)
-        * @param integer $L number of bytes to return
-        * @return string cryptographically secure pseudorandom binary string
+        * @param int $L Number of bytes to return
+        * @return string Cryptographically secure pseudorandom binary string
         */
        public static function HKDF( $hash, $ikm, $salt, $info, $L ) {
                $prk = self::HKDFExtract( $hash, $salt, $ikm );
@@ -256,10 +256,10 @@ class MWCryptHKDF {
         * Note that the hmac is keyed with XTS (the salt),
         * and the SKM (source key material) is the "data".
         *
-        * @param string $hash the hashing function to use (e.g., sha256)
-        * @param string $ikm the input keying material
-        * @param string $salt the salt to add to the ikm, to get the prk
-        * @return string binary string (pseudorandm key) used as input to HKDFExpand
+        * @param string $hash The hashing function to use (e.g., sha256)
+        * @param string $ikm The input keying material
+        * @param string $salt The salt to add to the ikm, to get the prk
+        * @return string Binary string (pseudorandm key) used as input to HKDFExpand
         */
        private static function HKDFExtract( $hash, $salt, $ikm ) {
                return hash_hmac( $hash, $ikm, $salt, true );
@@ -268,16 +268,16 @@ class MWCryptHKDF {
        /**
         * Expand the key with the given context
         *
-        * @param $hash Hashing Algorithm
-        * @param $prk a pseudorandom key of at least HashLen octets
-         *     (usually, the output from the extract step)
-        * @param $info optional context and application specific information
-         *     (can be a zero-length string)
-        * @param $bytes length of output keying material in bytes
-         *     (<= 255*HashLen)
-        * @param &$lastK set by this function to the last block of the expansion.
+        * @param string $hash Hashing Algorithm
+        * @param string $prk A pseudorandom key of at least HashLen octets
+             (usually, the output from the extract step)
+        * @param string $info Optional context and application specific information
+             (can be a zero-length string)
+        * @param int $bytes Length of output keying material in bytes
+             (<= 255*HashLen)
+        * @param string &$lastK Set by this function to the last block of the expansion.
         *      In MediaWiki, this is used to seed future Extractions.
-        * @return string cryptographically secure random string $bytes long
+        * @return string Cryptographically secure random string $bytes long
         */
        private static function HKDFExpand( $hash, $prk, $info, $bytes, &$lastK = '' ) {
                $hashLen = MWCryptHKDF::$hashLength[$hash];
@@ -306,9 +306,9 @@ class MWCryptHKDF {
        /**
         * Generate cryptographically random data and return it in raw binary form.
         *
-        * @param int $bytes the number of bytes of random data to generate
-        * @param string $context string to mix into HMAC context
-        * @return string binary string of length $bytes
+        * @param int $bytes The number of bytes of random data to generate
+        * @param string $context String to mix into HMAC context
+        * @return string Binary string of length $bytes
         */
        public static function generate( $bytes, $context ) {
                return self::singleton()->realGenerate( $bytes, $context );
@@ -318,9 +318,9 @@ class MWCryptHKDF {
         * Generate cryptographically random data and return it in hexadecimal string format.
         * See MWCryptRand::realGenerateHex for details of the char-to-byte conversion logic.
         *
-        * @param int $chars the number of hex chars of random data to generate
-        * @param string $context string to mix into HMAC context
-        * @return string random hex characters, $chars long
+        * @param int $chars The number of hex chars of random data to generate
+        * @param string $context String to mix into HMAC context
+        * @return string Random hex characters, $chars long
         */
        public static function generateHex( $chars, $context = '' ) {
                $bytes = ceil( $chars / 2 );
index eb74d12..31a71c4 100644 (file)
@@ -147,7 +147,7 @@ class MWCryptRand {
         * Randomly hash data while mixing in clock drift data for randomness
         *
         * @param string $data The data to randomly hash.
-        * @return String The hashed bytes
+        * @return string The hashed bytes
         * @author Tim Starling
         */
        protected function driftHash( $data ) {
@@ -214,7 +214,7 @@ class MWCryptRand {
        /**
         * Decide on the best acceptable hash algorithm we have available for hash()
         * @throws MWException
-        * @return String A hash algorithm
+        * @return string A hash algorithm
         */
        protected function hashAlgo() {
                if ( !is_null( $this->algo ) ) {
@@ -259,8 +259,8 @@ class MWCryptRand {
         * Generate an acceptably unstable one-way-hash of some text
         * making use of the best hash algorithm that we have available.
         *
-        * @param $data string
-        * @return String A raw hash of the data
+        * @param string $data
+        * @return string A raw hash of the data
         */
        protected function hash( $data ) {
                return hash( $this->hashAlgo(), $data, true );
@@ -270,9 +270,9 @@ class MWCryptRand {
         * Generate an acceptably unstable one-way-hmac of some text
         * making use of the best hash algorithm that we have available.
         *
-        * @param $data string
-        * @param $key string
-        * @return String A raw hash of the data
+        * @param string $data
+        * @param string $key
+        * @return string A raw hash of the data
         */
        protected function hmac( $data, $key ) {
                return hash_hmac( $this->hashAlgo(), $data, $key, true );
@@ -487,11 +487,11 @@ class MWCryptRand {
         * You can use MWCryptRand::wasStrong() if you wish to know if the source used
         * was cryptographically strong.
         *
-        * @param int $bytes the number of bytes of random data to generate
+        * @param int $bytes The number of bytes of random data to generate
         * @param bool $forceStrong Pass true if you want generate to prefer cryptographically
         *                          strong sources of entropy even if reading from them may steal
         *                          more entropy from the system than optimal.
-        * @return String Raw binary random data
+        * @return string Raw binary random data
         */
        public static function generate( $bytes, $forceStrong = false ) {
                return self::singleton()->realGenerate( $bytes, $forceStrong );
@@ -503,11 +503,11 @@ class MWCryptRand {
         * You can use MWCryptRand::wasStrong() if you wish to know if the source used
         * was cryptographically strong.
         *
-        * @param int $chars the number of hex chars of random data to generate
+        * @param int $chars The number of hex chars of random data to generate
         * @param bool $forceStrong Pass true if you want generate to prefer cryptographically
         *                          strong sources of entropy even if reading from them may steal
         *                          more entropy from the system than optimal.
-        * @return String Hexadecimal random data
+        * @return string Hexadecimal random data
         */
        public static function generateHex( $chars, $forceStrong = false ) {
                return self::singleton()->realGenerateHex( $chars, $forceStrong );
index 7105f6c..3a0492d 100644 (file)
@@ -24,7 +24,7 @@ class MWFunction {
 
        /**
         * @deprecated since 1.22; use call_user_func()
-        * @param $callback
+        * @param callable $callback
         * @return mixed
         */
        public static function call( $callback ) {
@@ -36,8 +36,8 @@ class MWFunction {
 
        /**
         * @deprecated since 1.22; use call_user_func_array()
-        * @param $callback
-        * @param $argsarams
+        * @param callable $callback
+        * @param array $argsarams
         * @return mixed
         */
        public static function callArray( $callback, $argsarams ) {
@@ -47,8 +47,8 @@ class MWFunction {
        }
 
        /**
-        * @param $class
-        * @param $args array
+        * @param string $class
+        * @param array $args
         * @return object
         */
        public static function newObj( $class, $args = array() ) {
index 9cd3d3f..86f4512 100644 (file)
@@ -42,11 +42,11 @@ class StringUtils {
         * Beware of this when backporting code to that version of MediaWiki.
         *
         * @param string $value String to check
-        * @param boolean $disableMbstring Whether to use the pure PHP
+        * @param bool $disableMbstring Whether to use the pure PHP
         * implementation instead of trying mb_check_encoding. Intended for unit
         * testing. Default: false
         *
-        * @return boolean Whether the given $value is a valid UTF-8 encoded string
+        * @return bool Whether the given $value is a valid UTF-8 encoded string
         */
        static function isUtf8( $value, $disableMbstring = false ) {
                $value = (string)$value;
@@ -121,10 +121,10 @@ class StringUtils {
         * hungry and inflexible. The memory requirements are such that I don't
         * recommend using it on anything but guaranteed small chunks of text.
         *
-        * @param $startDelim
-        * @param $endDelim
-        * @param $replace
-        * @param $subject
+        * @param string $startDelim
+        * @param string $endDelim
+        * @param string $replace
+        * @param string $subject
         *
         * @return string
         */
@@ -157,11 +157,11 @@ class StringUtils {
         * start, so e.g. /*\/ is not considered to be both the start and end of a
         * comment. /*\/xy/*\/ is considered to be a single comment with contents /xy/.
         *
-        * @param string $startDelim start delimiter
-        * @param string $endDelim end delimiter
-        * @param $callback Callback: function to call on each match
-        * @param $subject String
-        * @param string $flags regular expression flags
+        * @param string $startDelim Start delimiter
+        * @param string $endDelim End delimiter
+        * @param callable $callback Function to call on each match
+        * @param string $subject
+        * @param string $flags Regular expression flags
         * @throws MWException
         * @return string
         */
@@ -245,13 +245,13 @@ class StringUtils {
         *
         *   preg_replace( "!$startDelim(.*)$endDelim!$flags", $replace, $subject )
         *
-        * @param string $startDelim start delimiter regular expression
-        * @param string $endDelim end delimiter regular expression
-        * @param string $replace replacement string. May contain $1, which will be
+        * @param string $startDelim Start delimiter regular expression
+        * @param string $endDelim End delimiter regular expression
+        * @param string $replace Replacement string. May contain $1, which will be
         *                 replaced by the text between the delimiters
-        * @param string $subject to search
-        * @param string $flags regular expression flags
-        * @return String: The string with the matches replaced
+        * @param string $subject String to search
+        * @param string $flags Regular expression flags
+        * @return string The string with the matches replaced
         */
        static function delimiterReplace( $startDelim, $endDelim, $replace, $subject, $flags = '' ) {
                $replacer = new RegexlikeReplacer( $replace );
@@ -361,8 +361,8 @@ class RegexlikeReplacer extends Replacer {
  */
 class DoubleReplacer extends Replacer {
        /**
-        * @param $from
-        * @param $to
+        * @param mixed $from
+        * @param mixed $to
         * @param int $index
         */
        function __construct( $from, $to, $index = 0 ) {
@@ -387,7 +387,7 @@ class HashtableReplacer extends Replacer {
        private $table, $index;
 
        /**
-        * @param $table
+        * @param array $table
         * @param int $index
         */
        function __construct( $table, $index = 0 ) {
index 0ce90c1..604d381 100644 (file)
@@ -37,7 +37,7 @@ class UIDGenerator {
        protected $lockFile88; // string; local file path
        protected $lockFile128; // string; local file path
 
-       /** @var Array */
+       /** @var array */
        protected $fileHandles = array(); // cache file handles
 
        const QUICK_RAND = 1; // get randomness from fast and insecure sources
@@ -102,7 +102,7 @@ class UIDGenerator {
         *
         * UID generation is serialized on each server (as the node ID is for the whole machine).
         *
-        * @param $base integer Specifies a base other than 10
+        * @param int $base Specifies a base other than 10
         * @return string Number
         * @throws MWException
         */
@@ -146,7 +146,7 @@ class UIDGenerator {
         *
         * UID generation is serialized on each server (as the node ID is for the whole machine).
         *
-        * @param $base integer Specifies a base other than 10
+        * @param int $base Specifies a base other than 10
         * @return string Number
         * @throws MWException
         */
@@ -185,7 +185,7 @@ class UIDGenerator {
        /**
         * Return an RFC4122 compliant v4 UUID
         *
-        * @param $flags integer Bitfield (supports UIDGenerator::QUICK_RAND)
+        * @param int $flags Bitfield (supports UIDGenerator::QUICK_RAND)
         * @return string
         * @throws MWException
         */
@@ -211,7 +211,7 @@ class UIDGenerator {
        /**
         * Return an RFC4122 compliant v4 UUID
         *
-        * @param $flags integer Bitfield (supports UIDGenerator::QUICK_RAND)
+        * @param int $flags Bitfield (supports UIDGenerator::QUICK_RAND)
         * @return string 32 hex characters with no hyphens
         * @throws MWException
         */
@@ -226,8 +226,8 @@ class UIDGenerator {
         * If UIDGenerator::QUICK_VOLATILE is used the counter might reset on server restart.
         *
         * @param string $bucket Arbitrary bucket name (should be ASCII)
-        * @param integer $bits Bit size (<=48) of resulting numbers before wrap-around
-        * @param integer $flags (supports UIDGenerator::QUICK_VOLATILE)
+        * @param int $bits Bit size (<=48) of resulting numbers before wrap-around
+        * @param int $flags (supports UIDGenerator::QUICK_VOLATILE)
         * @return float Integer value as float
         * @since 1.23
         */
@@ -240,9 +240,9 @@ class UIDGenerator {
         *
         * @see UIDGenerator::newSequentialPerNodeID()
         * @param string $bucket Arbitrary bucket name (should be ASCII)
-        * @param integer $bits Bit size (16 to 48) of resulting numbers before wrap-around
-        * @param integer $count Number of IDs to return (1 to 10000)
-        * @param integer $flags (supports UIDGenerator::QUICK_VOLATILE)
+        * @param int $bits Bit size (16 to 48) of resulting numbers before wrap-around
+        * @param int $count Number of IDs to return (1 to 10000)
+        * @param int $flags (supports UIDGenerator::QUICK_VOLATILE)
         * @return array Ordered list of float integer values
         * @since 1.23
         */
@@ -256,9 +256,9 @@ class UIDGenerator {
         *
         * @see UIDGenerator::newSequentialPerNodeID()
         * @param string $bucket Arbitrary bucket name (should be ASCII)
-        * @param integer $bits Bit size (16 to 48) of resulting numbers before wrap-around
-        * @param integer $count Number of IDs to return (1 to 10000)
-        * @param integer $flags (supports UIDGenerator::QUICK_VOLATILE)
+        * @param int $bits Bit size (16 to 48) of resulting numbers before wrap-around
+        * @param int $count Number of IDs to return (1 to 10000)
+        * @param int $flags (supports UIDGenerator::QUICK_VOLATILE)
         * @return array Ordered list of float integer values
         */
        protected function getSequentialPerNodeIDs( $bucket, $bits, $count, $flags ) {
@@ -337,9 +337,9 @@ class UIDGenerator {
         * This is useful for making UIDs sequential on a per-node bases.
         *
         * @param string $lockFile Name of a local lock file
-        * @param $clockSeqSize integer The number of possible clock sequence values
-        * @param $counterSize integer The number of possible counter values
-        * @return Array (result of UIDGenerator::millitime(), counter, clock sequence)
+        * @param int $clockSeqSize The number of possible clock sequence values
+        * @param int $counterSize The number of possible counter values
+        * @return array (result of UIDGenerator::millitime(), counter, clock sequence)
         * @throws MWException
         */
        protected function getTimestampAndDelay( $lockFile, $clockSeqSize, $counterSize ) {
@@ -420,7 +420,7 @@ class UIDGenerator {
         * timestamp. This returns false if it would have to wait more than 10ms.
         *
         * @param array $time Result of UIDGenerator::millitime()
-        * @return Array|bool UIDGenerator::millitime() result or false
+        * @return array|bool UIDGenerator::millitime() result or false
         */
        protected function timeWaitUntil( array $time ) {
                do {
@@ -449,7 +449,7 @@ class UIDGenerator {
        }
 
        /**
-        * @return Array (current time in seconds, milliseconds since then)
+        * @return array (current time in seconds, milliseconds since then)
         */
        protected static function millitime() {
                list( $msec, $sec ) = explode( ' ', microtime() );
index 6be186f..cbf5afe 100644 (file)
@@ -64,7 +64,7 @@ class ZipDirectoryReader {
         *        valid ZIP64 file, and working out what non-ZIP64 readers will make
         *        of such a file is not trivial.
         *
-        * @return Status object. The following fatal errors are defined:
+        * @return Status A Status object. The following fatal errors are defined:
         *
         *      - zip-file-open-error: The file could not be opened.
         *
@@ -181,6 +181,8 @@ class ZipDirectoryReader {
 
        /**
         * Throw an error, and log a debug message
+        * @param mixed $code
+        * @param string $debugMessage
         */
        function error( $code, $debugMessage ) {
                wfDebug( __CLASS__ . ": Fatal error: $debugMessage\n" );
@@ -299,7 +301,7 @@ class ZipDirectoryReader {
         * Find the location of the central directory, as would be seen by a
         * non-ZIP64 reader.
         *
-        * @return List containing offset, size and end position.
+        * @return array List containing offset, size and end position.
         */
        function findOldCentralDirectory() {
                $size = $this->eocdr['CD size'];
@@ -485,6 +487,7 @@ class ZipDirectoryReader {
 
        /**
         * Get the length of the file.
+        * @return int
         */
        function getFileLength() {
                if ( $this->fileLength === null ) {
@@ -661,7 +664,7 @@ class ZipDirectoryReader {
         * Returns a bit from a given position in an integer value, converted to
         * boolean.
         *
-        * @param $value integer
+        * @param int $value
         * @param int $bitIndex The index of the bit, where 0 is the LSB.
         * @return bool
         */
@@ -671,6 +674,7 @@ class ZipDirectoryReader {
 
        /**
         * Debugging helper function which dumps a string in hexdump -C format.
+        * @param string $s
         */
        function hexDump( $s ) {
                $n = strlen( $s );