Add lots of @throws
authorReedy <reedy@wikimedia.org>
Wed, 24 Dec 2014 13:49:20 +0000 (13:49 +0000)
committerReedy <reedy@wikimedia.org>
Wed, 24 Dec 2014 13:49:20 +0000 (13:49 +0000)
Change-Id: I09d0c13070f966fcf23d2638d8fc1328279a5995

48 files changed:
includes/Hooks.php
includes/HtmlFormatter.php
includes/OutputPage.php
includes/api/ApiBase.php
includes/api/ApiMain.php
includes/api/ApiOpenSearch.php
includes/api/ApiResult.php
includes/cache/LocalisationCache.php
includes/cache/bloom/BloomCache.php
includes/changes/EnhancedChangesList.php
includes/content/CodeContentHandler.php
includes/content/TextContent.php
includes/context/RequestContext.php
includes/db/Database.php
includes/db/DatabaseMssql.php
includes/db/ORMTable.php
includes/htmlform/HTMLFormField.php
includes/libs/MultiHttpClient.php
includes/libs/virtualrest/VirtualRESTServiceClient.php
includes/media/DjVu.php
includes/objectcache/APCBagOStuff.php
includes/objectcache/MemcachedPeclBagOStuff.php
includes/objectcache/MultiWriteBagOStuff.php
includes/objectcache/SqlBagOStuff.php
includes/objectcache/XCacheBagOStuff.php
includes/parser/MWTidy.php
includes/parser/Preprocessor_DOM.php
includes/profiler/SectionProfiler.php
includes/resourceloader/ResourceLoaderEditToolbarModule.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/revisiondelete/RevisionDeleter.php
includes/skins/Skin.php
includes/specials/SpecialConfirmemail.php
includes/specials/SpecialImport.php
includes/specials/SpecialListfiles.php
includes/specials/SpecialMediaStatistics.php
includes/specials/SpecialRandomInCategory.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialUpload.php
includes/specials/SpecialUserlogin.php
includes/utils/AutoloadGenerator.php
includes/utils/MWCryptHKDF.php
includes/utils/UIDGenerator.php
includes/utils/ZipDirectoryReader.php
tests/parser/parserTest.inc
tests/phpunit/includes/api/format/ApiFormatTestBase.php
tests/phpunit/includes/password/PasswordTestCase.php
tests/testHelpers.inc

index 44f78a5..dffc7bc 100644 (file)
@@ -127,11 +127,12 @@ class Hooks {
         * @param string|null $deprecatedVersion Optionally, mark hook as deprecated with version number
         * @return bool True if no handler aborted the hook
         *
+        * @throws Exception
+        * @throws FatalError
+        * @throws MWException
         * @since 1.22 A hook function is not required to return a value for
         *   processing to continue. Not returning a value (or explicitly
         *   returning null) is equivalent to returning true.
-        * @throws MWException
-        * @throws FatalError
         */
        public static function run( $event, array $args = array(), $deprecatedVersion = null ) {
                $profiler = Profiler::instance();
index e5efb5b..f74c15a 100644 (file)
@@ -322,6 +322,7 @@ class HtmlFormatter {
         * @param string $type The type of selector (ID, CLASS, TAG_CLASS, or TAG)
         * @param string $rawName The raw name of the selector
         * @return bool Whether the selector was successfully recognised
+        * @throws MWException
         */
        protected function parseSelector( $selector, &$type, &$rawName ) {
                if ( strpos( $selector, '.' ) === 0 ) {
index 411bb2e..259e280 100644 (file)
@@ -1626,6 +1626,7 @@ class OutputPage extends ContextSource {
         * @param string $text
         * @param bool $linestart Is this the start of a line?
         * @param bool $interface Is this text in the user interface language?
+        * @throws MWException
         */
        public function addWikiText( $text, $linestart = true, $interface = true ) {
                $title = $this->getTitle(); // Work around E_STRICT
index 9985c36..87c88fb 100644 (file)
@@ -1045,6 +1045,7 @@ abstract class ApiBase extends ContextSource {
         * @param string $token Supplied token
         * @param array $params All supplied parameters for the module
         * @return bool
+        * @throws MWException
         */
        final public function validateToken( $token, array $params ) {
                $tokenType = $this->needsToken();
@@ -1294,6 +1295,7 @@ abstract class ApiBase extends ContextSource {
         * @since 1.23
         * @param Status $status
         * @return array Array of code and error string
+        * @throws MWException
         */
        public function getErrorFromStatus( $status ) {
                if ( $status->isGood() ) {
index c03e513..a5287b6 100644 (file)
@@ -458,6 +458,7 @@ class ApiMain extends ApiBase {
         *
         * @since 1.23
         * @param Exception $e
+        * @throws Exception
         */
        public static function handleApiBeforeMainException( Exception $e ) {
                ob_start();
@@ -778,6 +779,8 @@ class ApiMain extends ApiBase {
        /**
         * Set up the module for response
         * @return ApiBase The module that will handle this action
+        * @throws MWException
+        * @throws UsageException
         */
        protected function setupModule() {
                // Instantiate the module requested by the user
index 5fc9f2b..f24a03f 100644 (file)
@@ -340,6 +340,7 @@ class ApiOpenSearch extends ApiBase {
         *
         * @param string $type MIME type
         * @return string
+        * @throws MWException
         */
        public static function getOpenSearchTemplate( $type ) {
                global $wgOpenSearchTemplate, $wgCanonicalServer;
index 5bc2efb..306c478 100644 (file)
@@ -518,6 +518,7 @@ class ApiResult extends ApiBase {
         * @param ApiBase $module
         * @param string $paramName
         * @param string|array $paramValue
+        * @throws MWException
         */
        public function setContinueParam( ApiBase $module, $paramName, $paramValue ) {
                $name = $module->getModuleName();
index c3e5e1d..472195c 100644 (file)
@@ -654,6 +654,7 @@ class LocalisationCache {
         * rules, and save the compiled rules in a process-local cache.
         *
         * @param string $fileName
+        * @throws MWException
         */
        protected function loadPluralFile( $fileName ) {
                // Use file_get_contents instead of DOMDocument::load (T58439)
index 627f4f0..ef15bb1 100644 (file)
@@ -60,6 +60,7 @@ abstract class BloomCache {
         *               It should only consist of alphanumberic, '-', and '_' characters.
         *               This ID is what avoids collisions if multiple logical caches
         *               use the same storage system, so this should be set carefully.
+        * @throws MWException
         */
        public function __construct( array $config ) {
                $this->cacheID = $config['cacheId'];
index 4ab7729..09fcfd9 100644 (file)
@@ -34,6 +34,7 @@ class EnhancedChangesList extends ChangesList {
 
        /**
         * @param IContextSource|Skin $obj
+        * @throws MWException
         */
        public function __construct( $obj ) {
                if ( $obj instanceof Skin ) {
index 447a2a7..694b633 100644 (file)
@@ -58,6 +58,7 @@ abstract class CodeContentHandler extends TextContentHandler {
 
        /**
         * @return string
+        * @throws MWException
         */
        protected function getContentClass() {
                throw new MWException( 'Subclass must override' );
index c479f20..baea812 100644 (file)
@@ -37,6 +37,7 @@ class TextContent extends AbstractContent {
        /**
         * @param string $text
         * @param string $model_id
+        * @throws MWException
         */
        public function __construct( $text, $model_id = CONTENT_MODEL_TEXT ) {
                parent::__construct( $model_id );
index c76e3a9..7cd2290 100644 (file)
@@ -297,8 +297,8 @@ class RequestContext implements IContextSource {
        /**
         * Get the Language object.
         * Initialization of user or request objects can depend on this.
-        *
         * @return Language
+        * @throws Exception
         * @since 1.19
         */
        public function getLanguage() {
index 33c5cfb..2182b2c 100644 (file)
@@ -3657,6 +3657,7 @@ abstract class DatabaseBase implements IDatabase {
         *   calling rollback when no transaction is in progress. This will silently
         *   break any ongoing explicit transaction. Only set the flush flag if you
         *   are sure that it is safe to ignore these warnings in your context.
+        * @throws DBUnexpectedError
         * @since 1.23 Added $flush parameter
         */
        final public function rollback( $fname = __METHOD__, $flush = '' ) {
index 669525a..a7bc6dd 100644 (file)
@@ -380,6 +380,9 @@ class DatabaseMssql extends DatabaseBase {
         *   (optional) (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
         * @return mixed Database result resource (feed to Database::fetchObject
         *   or whatever), or false on failure
+        * @throws DBQueryError
+        * @throws DBUnexpectedError
+        * @throws Exception
         */
        public function select( $table, $vars, $conds = '', $fname = __METHOD__,
                $options = array(), $join_conds = array()
@@ -574,8 +577,8 @@ class DatabaseMssql extends DatabaseBase {
         * @param array $arrToInsert
         * @param string $fname
         * @param array $options
-        * @throws DBQueryError
         * @return bool
+        * @throws Exception
         */
        public function insert( $table, $arrToInsert, $fname = __METHOD__, $options = array() ) {
                # No rows to insert, easy just return now
@@ -713,8 +716,8 @@ class DatabaseMssql extends DatabaseBase {
         * @param string $fname
         * @param array $insertOptions
         * @param array $selectOptions
-        * @throws DBQueryError
         * @return null|ResultWrapper
+        * @throws Exception
         */
        public function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = __METHOD__,
                $insertOptions = array(), $selectOptions = array()
@@ -761,6 +764,9 @@ class DatabaseMssql extends DatabaseBase {
         *                   - IGNORE: Ignore unique key conflicts
         *                   - LOW_PRIORITY: MySQL-specific, see MySQL manual.
         * @return bool
+        * @throws DBUnexpectedError
+        * @throws Exception
+        * @throws MWException
         */
        function update( $table, $values, $conds, $fname = __METHOD__, $options = array() ) {
                $table = $this->tableName( $table );
@@ -893,6 +899,7 @@ class DatabaseMssql extends DatabaseBase {
         * @param int $limit The SQL limit
         * @param bool|int $offset The SQL offset (default false)
         * @return array|string
+        * @throws DBUnexpectedError
         */
        public function limitResult( $sql, $limit, $offset = false ) {
                if ( $offset === false || $offset == 0 ) {
index cada298..562a810 100644 (file)
@@ -248,8 +248,8 @@ class ORMTable extends DBAccessBase implements IORMTable {
         * @param array $options
         * @param null|string $functionName
         * @return ResultWrapper
-        * @throws DBQueryError If the query failed (even if the database was in
-        *   ignoreErrors mode).
+        * @throws Exception
+        * @throws MWException
         */
        public function rawSelect( $fields = null, array $conditions = array(),
                array $options = array(), $functionName = null
index 861ae4c..11b88b4 100644 (file)
@@ -126,6 +126,7 @@ abstract class HTMLFormField {
         * @param array $alldata
         * @param array $params
         * @return bool
+        * @throws MWException
         */
        protected function isHiddenRecurse( array $alldata, array $params ) {
                $origParams = $params;
index 8ed9ee4..eeda8d4 100644 (file)
@@ -59,6 +59,7 @@ class MultiHttpClient {
         *   - reqTimeout      : default request timeout
         *   - usePipelining   : whether to use HTTP pipelining if possible (for all hosts)
         *   - maxConnsPerHost : maximum number of concurrent connections (per host)
+        * @throws Exception
         */
        public function __construct( array $options ) {
                if ( isset( $options['caBundlePath'] ) ) {
@@ -103,14 +104,14 @@ class MultiHttpClient {
         * Execute a set of HTTP(S) requests concurrently
         *
         * The maps are returned by this method with the 'response' field set to a map of:
-        *   - code    : HTTP response code or 0 if there was a serious cURL error
-        *   - reason  : HTTP response reason (empty if there was a serious cURL error)
-        *   - headers : <header name/value associative array>
-        *   - body    : HTTP response body or resource (if "stream" was set)
+        *   - code    : HTTP response code or 0 if there was a serious cURL error
+        *   - reason  : HTTP response reason (empty if there was a serious cURL error)
+        *   - headers : <header name/value associative array>
+        *   - body    : HTTP response body or resource (if "stream" was set)
         *   - error   : Any cURL error string
-        * The map also stores integer-indexed copies of these values. This lets callers do:
-        *      <code>
-        *              list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response'];
+        * The map also stores integer-indexed copies of these values. This lets callers do:
+        *    <code>
+        *        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response'];
         *  </code>
         * All headers in the 'headers' field are normalized to use lower case names.
         * This is true for the request headers and the response headers. Integer-indexed
@@ -123,6 +124,7 @@ class MultiHttpClient {
         *   - usePipelining   : whether to use HTTP pipelining if possible
         *   - maxConnsPerHost : maximum number of concurrent connections (per host)
         * @return array $reqs With response array populated for each
+        * @throws Exception
         */
        public function runMulti( array $reqs, array $opts = array() ) {
                $chm = $this->getCurlMulti();
@@ -244,6 +246,7 @@ class MultiHttpClient {
         *   - connTimeout    : default connection timeout
         *   - reqTimeout     : default request timeout
         * @return resource
+        * @throws Exception
         */
        protected function getCurlHandle( array &$req, array $opts = array() ) {
                $ch = curl_init();
index 6f416f1..46be144 100644 (file)
@@ -148,12 +148,13 @@ class VirtualRESTServiceClient {
         *   - body    : HTTP response body or resource (if "stream" was set)
         *   - error   : Any cURL error string
         * The map also stores integer-indexed copies of these values. This lets callers do:
-        *      <code>
-        *              list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $responses[0];
+        *    <code>
+        *        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $responses[0];
         *  </code>
         *
         * @param array $reqs Map of Virtual HTTP request maps
         * @return array $reqs Map of corresponding response values with the same keys/order
+        * @throws Exception
         */
        public function runMulti( array $reqs ) {
                foreach ( $reqs as $index => &$req ) {
index daeb475..ba60af4 100644 (file)
@@ -266,6 +266,7 @@ class DjVuHandler extends ImageHandler {
         *
         * @param File $file The DjVu file in question
         * @return string XML metadata as a string.
+        * @throws MWException
         */
        private function getUnserializedMetadata( File $file ) {
                $metadata = $file->getMetadata();
index 4cbb32d..d879ca8 100644 (file)
@@ -70,6 +70,7 @@ class APCBagOStuff extends BagOStuff {
         * @param mixed $value
         * @param int $exptime
         * @return bool
+        * @throws MWException
         */
        public function cas( $casToken, $key, $value, $exptime = 0 ) {
                // APC's CAS functions only work on integers
index c853bcf..fcc37cb 100644 (file)
@@ -43,6 +43,7 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff {
         *                          values, but serialization is much slower unless the php.ini option
         *                          igbinary.compact_strings is off.
         * @param array $params
+        * @throws MWException
         */
        function __construct( $params ) {
                $params = $this->applyDefaultParams( $params );
index c2a4a27..04ed894 100644 (file)
@@ -81,6 +81,7 @@ class MultiWriteBagOStuff extends BagOStuff {
         * @param mixed $value
         * @param mixed $exptime
         * @return bool
+        * @throws MWException
         */
        public function cas( $casToken, $key, $value, $exptime = 0 ) {
                throw new MWException( "CAS is not implemented in " . __CLASS__ );
index 3585e57..7524240 100644 (file)
@@ -118,6 +118,7 @@ class SqlBagOStuff extends BagOStuff {
         *
         * @param int $serverIndex
         * @return DatabaseBase
+        * @throws MWException
         */
        protected function getDB( $serverIndex ) {
                global $wgDebugDBTransactions;
index 8e2a160..d7603b1 100644 (file)
@@ -74,6 +74,7 @@ class XCacheBagOStuff extends BagOStuff {
         * @param mixed $value
         * @param int $exptime
         * @return bool
+        * @throws MWException
         */
        public function cas( $casToken, $key, $value, $exptime = 0 ) {
                // Can't find any documentation on xcache cas
index ed4db38..6c62302 100644 (file)
@@ -164,7 +164,8 @@ class MWTidy {
         * @param string $text HTML to check
         * @param bool $stderr Whether to read result from STDERR rather than STDOUT
         * @param int &$retval Exit code (-1 on internal error)
-        * @return string|null
+        * @return null|string
+        * @throws MWException
         */
        private static function clean( $text, $stderr = false, &$retval = null ) {
                global $wgTidyInternal;
index 2cce574..7e0405c 100644 (file)
@@ -68,6 +68,7 @@ class Preprocessor_DOM implements Preprocessor {
        /**
         * @param array $values
         * @return PPNode_DOM
+        * @throws MWException
         */
        public function newPartNodeArray( $values ) {
                //NOTE: DOM manipulation is slower than building & parsing XML! (or so Tim sais)
index d5da928..245022d 100644 (file)
@@ -277,6 +277,7 @@ class SectionProfiler {
        /**
         * Returns a tree of function calls with their real times
         * @return string
+        * @throws Exception
         */
        public function getCallTreeReport() {
                if ( $this->collateOnly ) {
index 2e07911..d79174c 100644 (file)
@@ -32,6 +32,7 @@ class ResourceLoaderEditToolbarModule extends ResourceLoaderFileModule {
         *
         * @param string $value
         * @return string
+        * @throws Exception
         */
        private static function cssSerializeString( $value ) {
                if ( strstr( $value, "\0" ) ) {
index bcef149..3decabf 100644 (file)
@@ -483,8 +483,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
 
        /**
         * Get the skip function.
-        *
-        * @return string|null
+        * @return null|string
+        * @throws MWException
         */
        public function getSkipFunction() {
                if ( !$this->skipFunction ) {
@@ -979,8 +979,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
 
        /**
         * Takes named templates by the module and returns an array mapping.
-        *
         * @return array of templates mapping template alias to content
+        * @throws MWException
         */
        public function getTemplates() {
                $templates = array();
index b9f2024..ba1f0f6 100644 (file)
@@ -78,6 +78,7 @@ class RevisionDeleter {
         * @param Title $title
         * @param array $ids
         * @return RevDelList
+        * @throws MWException
         */
        public static function createList( $typeName, IContextSource $context, Title $title, array $ids ) {
                $typeName = self::getCanonicalTypeName( $typeName );
index c3ac9c7..3b08e74 100644 (file)
@@ -1046,6 +1046,7 @@ abstract class Skin extends ContextSource {
         *
         * @param string $name The name or path of a skin resource file
         * @return string The fully resolved style path url including styleversion
+        * @throws MWException
         */
        function getSkinStylePath( $name ) {
                global $wgStylePath, $wgStyleVersion;
index d771589..b6ab112 100644 (file)
@@ -38,6 +38,9 @@ class EmailConfirmation extends UnlistedSpecialPage {
         * Main execution point
         *
         * @param null|string $code Confirmation code passed to the page
+        * @throws PermissionsError
+        * @throws ReadOnlyError
+        * @throws UserNotLoggedIn
         */
        function execute( $code ) {
                $this->setHeaders();
index c6ebaed..4480ac3 100644 (file)
@@ -52,6 +52,8 @@ class SpecialImport extends SpecialPage {
        /**
         * Execute
         * @param string|null $par
+        * @throws PermissionsError
+        * @throws ReadOnlyError
         */
        function execute( $par ) {
                $this->setHeaders();
index c68341c..760704d 100644 (file)
@@ -302,6 +302,7 @@ class ImageListPager extends TablePager {
         * @param int $limit
         * @param bool $asc
         * @return array
+        * @throws MWException
         */
        function reallyDoQuery( $offset, $limit, $asc ) {
                $prevTableName = $this->mTableName;
index c26adc5..e3c7e3a 100644 (file)
@@ -306,6 +306,8 @@ class MediaStatisticsPage extends QueryPage {
         *
         * @param $skin Skin
         * @param $result stdObject Result row
+        * @return bool|string|void
+        * @throws MWException
         */
        public function formatResult( $skin, $result ) {
                throw new MWException( "unimplemented" );
index f9e03ab..b4af7ba 100644 (file)
@@ -179,12 +179,12 @@ class SpecialRandomInCategory extends FormSpecialPage {
         * @param float $rand Random number between 0 and 1
         * @param int $offset Extra offset to fudge randomness
         * @param bool $up True to get the result above the random number, false for below
-        *
+        * @return array Query information.
+        * @throws MWException
         * @note The $up parameter is supposed to counteract what would happen if there
         *   was a large gap in the distribution of cl_timestamp values. This way instead
         *   of things to the right of the gap being favoured, both sides of the gap
         *   are favoured.
-        * @return array Query information.
         */
        protected function getQueryInfo( $rand, $offset, $up ) {
                $op = $up ? '>=' : '<=';
index 7eea71d..7a350c7 100644 (file)
@@ -293,6 +293,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         * Show a deleted file version requested by the visitor.
         * @todo Mostly copied from Special:Undelete. Refactor.
         * @param string $archiveName
+        * @throws MWException
+        * @throws PermissionsError
         */
        protected function tryShowFile( $archiveName ) {
                $repo = RepoGroup::singleton()->getLocalRepo();
index ee89b0a..708d469 100644 (file)
@@ -143,6 +143,13 @@ class SpecialUpload extends SpecialPage {
        /**
         * Special page entry point
         * @param string $par
+        * @throws ErrorPageError
+        * @throws Exception
+        * @throws FatalError
+        * @throws MWException
+        * @throws PermissionsError
+        * @throws ReadOnlyError
+        * @throws UserBlockedError
         */
        public function execute( $par ) {
                $this->setHeaders();
index b261cbf..f2f6b69 100644 (file)
@@ -1272,6 +1272,12 @@ class LoginForm extends SpecialPage {
        /**
         * @param string $msg
         * @param string $msgtype
+        * @throws ErrorPageError
+        * @throws Exception
+        * @throws FatalError
+        * @throws MWException
+        * @throws PermissionsError
+        * @throws ReadOnlyError
         * @private
         */
        function mainLoginForm( $msg, $msgtype = 'error' ) {
index 0d0907b..1f639fc 100644 (file)
@@ -63,6 +63,7 @@ class AutoloadGenerator {
         *
         * @param string $fqcn FQCN to force the location of
         * @param string $inputPath Full path to the file containing the class
+        * @throws Exception
         */
        public function forceClassPath( $fqcn, $inputPath ) {
                $path = self::normalizePathSeparator( realpath( $inputPath ) );
@@ -79,6 +80,7 @@ class AutoloadGenerator {
 
        /**
         * @param string $inputPath Path to a php file to find classes within
+        * @throws Exception
         */
        public function readFile( $inputPath ) {
                // NOTE: do NOT expand $inputPath using realpath(). It is perfectly
index cc13679..950dd84 100644 (file)
@@ -103,6 +103,7 @@ class MWCryptHKDF {
         * @param string $algorithm Name of hashing algorithm
         * @param BagOStuff $cache
         * @param string|array $context Context to mix into HKDF context
+        * @throws MWException
         */
        public function __construct( $secretKeyMaterial, $algorithm, $cache, $context ) {
                if ( strlen( $secretKeyMaterial ) < 16 ) {
@@ -157,6 +158,7 @@ class MWCryptHKDF {
        /**
         * Return a singleton instance, based on the global configs.
         * @return HKDF
+        * @throws MWException
         */
        protected static function singleton() {
                global $wgHKDFAlgorithm, $wgHKDFSecret, $wgSecretKey;
@@ -271,14 +273,15 @@ class MWCryptHKDF {
         *
         * @param string $hash Hashing Algorithm
         * @param string $prk A pseudorandom key of at least HashLen octets
-        *      (usually, the output from the extract step)
+        *    (usually, the output from the extract step)
         * @param string $info Optional context and application specific information
-        *      (can be a zero-length string)
+        *    (can be a zero-length string)
         * @param int $bytes Length of output keying material in bytes
-        *      (<= 255*HashLen)
+        *    (<= 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.
+        *    In MediaWiki, this is used to seed future Extractions.
         * @return string Cryptographically secure random string $bytes long
+        * @throws MWException
         */
        private static function HKDFExpand( $hash, $prk, $info, $bytes, &$lastK = '' ) {
                $hashLen = MWCryptHKDF::$hashLength[$hash];
index 5346afa..33e9116 100644 (file)
@@ -119,6 +119,7 @@ class UIDGenerator {
        /**
         * @param array $info (UIDGenerator::millitime(), counter, clock sequence)
         * @return string 88 bits
+        * @throws MWException
         */
        protected function getTimestampedID88( array $info ) {
                list( $time, $counter ) = $info;
@@ -163,6 +164,7 @@ class UIDGenerator {
        /**
         * @param array $info (UIDGenerator::millitime(), counter, clock sequence)
         * @return string 128 bits
+        * @throws MWException
         */
        protected function getTimestampedID128( array $info ) {
                list( $time, $counter, $clkSeq ) = $info;
@@ -260,6 +262,7 @@ class UIDGenerator {
         * @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
+        * @throws MWException
         */
        protected function getSequentialPerNodeIDs( $bucket, $bits, $count, $flags ) {
                if ( $count <= 0 ) {
@@ -436,6 +439,7 @@ class UIDGenerator {
        /**
         * @param array $time Result of UIDGenerator::millitime()
         * @return string 46 MSBs of "milliseconds since epoch" in binary (rolls over in 4201)
+        * @throws MWException
         */
        protected function millisecondsSinceEpochBinary( array $time ) {
                list( $sec, $msec ) = $time;
index bc84976..86960aa 100644 (file)
@@ -186,6 +186,7 @@ class ZipDirectoryReader {
         * Throw an error, and log a debug message
         * @param mixed $code
         * @param string $debugMessage
+        * @throws ZipDirectoryReaderError
         */
        function error( $code, $debugMessage ) {
                wfDebug( __CLASS__ . ": Fatal error: $debugMessage\n" );
index cf03ad1..17769ad 100644 (file)
@@ -1493,8 +1493,10 @@ class ParserTest {
         * Insert a temporary test article
         * @param string $name The title, including any prefix
         * @param string $text The article text
-        * @param int $line The input line number, for reporting errors
-        * @param bool $ignoreDuplicate Whether to silently ignore duplicate pages
+        * @param int|string $line The input line number, for reporting errors
+        * @param bool|string $ignoreDuplicate Whether to silently ignore duplicate pages
+        * @throws Exception
+        * @throws MWException
         */
        public static function addArticle( $name, $text, $line = 'unknown', $ignoreDuplicate = '' ) {
                global $wgCapitalLinks;
index 8134c50..67949ab 100644 (file)
@@ -11,6 +11,7 @@ abstract class ApiFormatTestBase extends MediaWikiTestCase {
        /**
         * Return general data to be encoded for testing
         * @return array See self::testGeneralEncoding
+        * @throws Exception
         */
        public static function provideGeneralEncoding() {
                throw new Exception( 'Subclass must implement ' . __METHOD__ );
@@ -21,6 +22,8 @@ abstract class ApiFormatTestBase extends MediaWikiTestCase {
         * @param array $params Query parameters
         * @param array $data Data to encode
         * @param string $class Printer class to use instead of the normal one
+        * @return string
+        * @throws Exception
         */
        protected function encodeData( array $params, array $data, $class = null ) {
                $context = new RequestContext;
index 78fc3ed..9a142cb 100644 (file)
@@ -49,8 +49,8 @@ abstract class PasswordTestCase extends MediaWikiTestCase {
         * An array of tests in the form of (bool, string, string), where the first
         * element is whether the second parameter (a password hash) and the third
         * parameter (a password) should match.
-        *
         * @return array
+        * @throws MWException
         * @abstract
         */
        public static function providePasswordTests() {
index bc02d0f..acfdac8 100644 (file)
@@ -618,6 +618,7 @@ class TestFileIterator implements Iterator {
         * @param bool $fatal True iff an exception should be thrown if
         * the section is not found.
         * @return bool|string
+        * @throws MWException
         */
        private function checkSection( $tokens, $fatal = true ) {
                if ( is_null( $this->section ) ) {
@@ -691,6 +692,7 @@ class DelayedParserTest {
         * Should be the case if we found the parserTest is not disabled
         * @param ParserTest|NewParserTest $parserTest
         * @return bool
+        * @throws MWException
         */
        public function unleash( &$parserTest ) {
                if ( !( $parserTest instanceof ParserTest || $parserTest instanceof NewParserTest )     ) {