From: Reedy Date: Wed, 24 Dec 2014 13:49:20 +0000 (+0000) Subject: Add lots of @throws X-Git-Tag: 1.31.0-rc.0~12862 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=4d9143c7f55857377da353bb114ed44c491af2a6;p=lhc%2Fweb%2Fwiklou.git Add lots of @throws Change-Id: I09d0c13070f966fcf23d2638d8fc1328279a5995 --- diff --git a/includes/Hooks.php b/includes/Hooks.php index 44f78a5731..dffc7bcfe8 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -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(); diff --git a/includes/HtmlFormatter.php b/includes/HtmlFormatter.php index e5efb5b8ec..f74c15a37e 100644 --- a/includes/HtmlFormatter.php +++ b/includes/HtmlFormatter.php @@ -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 ) { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 411bb2e51a..259e280851 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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 diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 9985c36b86..87c88fb0e7 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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() ) { diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index c03e513779..a5287b6a10 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -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 diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 5fc9f2b8a5..f24a03fb87 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -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; diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index 5bc2efbc70..306c4784b5 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -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(); diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index c3e5e1d23c..472195c068 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -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) diff --git a/includes/cache/bloom/BloomCache.php b/includes/cache/bloom/BloomCache.php index 627f4f0db9..ef15bb1896 100644 --- a/includes/cache/bloom/BloomCache.php +++ b/includes/cache/bloom/BloomCache.php @@ -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']; diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index 4ab772970d..09fcfd9bde 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -34,6 +34,7 @@ class EnhancedChangesList extends ChangesList { /** * @param IContextSource|Skin $obj + * @throws MWException */ public function __construct( $obj ) { if ( $obj instanceof Skin ) { diff --git a/includes/content/CodeContentHandler.php b/includes/content/CodeContentHandler.php index 447a2a732a..694b633e7b 100644 --- a/includes/content/CodeContentHandler.php +++ b/includes/content/CodeContentHandler.php @@ -58,6 +58,7 @@ abstract class CodeContentHandler extends TextContentHandler { /** * @return string + * @throws MWException */ protected function getContentClass() { throw new MWException( 'Subclass must override' ); diff --git a/includes/content/TextContent.php b/includes/content/TextContent.php index c479f202fb..baea812576 100644 --- a/includes/content/TextContent.php +++ b/includes/content/TextContent.php @@ -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 ); diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index c76e3a98d6..7cd229094d 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -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() { diff --git a/includes/db/Database.php b/includes/db/Database.php index 33c5cfb3d0..2182b2ca45 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -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 = '' ) { diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 669525ac25..a7bc6dd621 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -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 ) { diff --git a/includes/db/ORMTable.php b/includes/db/ORMTable.php index cada298ce2..562a8106ff 100644 --- a/includes/db/ORMTable.php +++ b/includes/db/ORMTable.php @@ -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 diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 861ae4cc15..11b88b4443 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -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; diff --git a/includes/libs/MultiHttpClient.php b/includes/libs/MultiHttpClient.php index 8ed9ee42d2..eeda8d4cc0 100644 --- a/includes/libs/MultiHttpClient.php +++ b/includes/libs/MultiHttpClient.php @@ -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 :
- * - 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 :
+ * - 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: - * - * list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response']; + * The map also stores integer-indexed copies of these values. This lets callers do: + * + * list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response']; * * 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(); diff --git a/includes/libs/virtualrest/VirtualRESTServiceClient.php b/includes/libs/virtualrest/VirtualRESTServiceClient.php index 6f416f12b0..46be144a33 100644 --- a/includes/libs/virtualrest/VirtualRESTServiceClient.php +++ b/includes/libs/virtualrest/VirtualRESTServiceClient.php @@ -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: - * - * list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $responses[0]; + * + * list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $responses[0]; * * * @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 ) { diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index daeb475f3f..ba60af46e4 100644 --- a/includes/media/DjVu.php +++ b/includes/media/DjVu.php @@ -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(); diff --git a/includes/objectcache/APCBagOStuff.php b/includes/objectcache/APCBagOStuff.php index 4cbb32df82..d879ca8416 100644 --- a/includes/objectcache/APCBagOStuff.php +++ b/includes/objectcache/APCBagOStuff.php @@ -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 diff --git a/includes/objectcache/MemcachedPeclBagOStuff.php b/includes/objectcache/MemcachedPeclBagOStuff.php index c853bcf467..fcc37cb4e4 100644 --- a/includes/objectcache/MemcachedPeclBagOStuff.php +++ b/includes/objectcache/MemcachedPeclBagOStuff.php @@ -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 ); diff --git a/includes/objectcache/MultiWriteBagOStuff.php b/includes/objectcache/MultiWriteBagOStuff.php index c2a4a2783a..04ed89478c 100644 --- a/includes/objectcache/MultiWriteBagOStuff.php +++ b/includes/objectcache/MultiWriteBagOStuff.php @@ -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__ ); diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 3585e57b1a..7524240895 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -118,6 +118,7 @@ class SqlBagOStuff extends BagOStuff { * * @param int $serverIndex * @return DatabaseBase + * @throws MWException */ protected function getDB( $serverIndex ) { global $wgDebugDBTransactions; diff --git a/includes/objectcache/XCacheBagOStuff.php b/includes/objectcache/XCacheBagOStuff.php index 8e2a160df9..d7603b11f5 100644 --- a/includes/objectcache/XCacheBagOStuff.php +++ b/includes/objectcache/XCacheBagOStuff.php @@ -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 diff --git a/includes/parser/MWTidy.php b/includes/parser/MWTidy.php index ed4db38cba..6c62302f17 100644 --- a/includes/parser/MWTidy.php +++ b/includes/parser/MWTidy.php @@ -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; diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 2cce574934..7e0405c1bc 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -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) diff --git a/includes/profiler/SectionProfiler.php b/includes/profiler/SectionProfiler.php index d5da928957..245022df02 100644 --- a/includes/profiler/SectionProfiler.php +++ b/includes/profiler/SectionProfiler.php @@ -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 ) { diff --git a/includes/resourceloader/ResourceLoaderEditToolbarModule.php b/includes/resourceloader/ResourceLoaderEditToolbarModule.php index 2e07911c63..d79174cd74 100644 --- a/includes/resourceloader/ResourceLoaderEditToolbarModule.php +++ b/includes/resourceloader/ResourceLoaderEditToolbarModule.php @@ -32,6 +32,7 @@ class ResourceLoaderEditToolbarModule extends ResourceLoaderFileModule { * * @param string $value * @return string + * @throws Exception */ private static function cssSerializeString( $value ) { if ( strstr( $value, "\0" ) ) { diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index bcef149db4..3decabf800 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -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(); diff --git a/includes/revisiondelete/RevisionDeleter.php b/includes/revisiondelete/RevisionDeleter.php index b9f2024b98..ba1f0f69fd 100644 --- a/includes/revisiondelete/RevisionDeleter.php +++ b/includes/revisiondelete/RevisionDeleter.php @@ -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 ); diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index c3ac9c7dd0..3b08e744c5 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -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; diff --git a/includes/specials/SpecialConfirmemail.php b/includes/specials/SpecialConfirmemail.php index d771589d82..b6ab112b34 100644 --- a/includes/specials/SpecialConfirmemail.php +++ b/includes/specials/SpecialConfirmemail.php @@ -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(); diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index c6ebaed3a6..4480ac3dd8 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -52,6 +52,8 @@ class SpecialImport extends SpecialPage { /** * Execute * @param string|null $par + * @throws PermissionsError + * @throws ReadOnlyError */ function execute( $par ) { $this->setHeaders(); diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index c68341cfdf..760704d90e 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -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; diff --git a/includes/specials/SpecialMediaStatistics.php b/includes/specials/SpecialMediaStatistics.php index c26adc5ed3..e3c7e3a183 100644 --- a/includes/specials/SpecialMediaStatistics.php +++ b/includes/specials/SpecialMediaStatistics.php @@ -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" ); diff --git a/includes/specials/SpecialRandomInCategory.php b/includes/specials/SpecialRandomInCategory.php index f9e03ab974..b4af7ba249 100644 --- a/includes/specials/SpecialRandomInCategory.php +++ b/includes/specials/SpecialRandomInCategory.php @@ -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 ? '>=' : '<='; diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 7eea71da51..7a350c701c 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -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(); diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index ee89b0a397..708d4698c2 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -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(); diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index b261cbfeca..f2f6b69dc4 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -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' ) { diff --git a/includes/utils/AutoloadGenerator.php b/includes/utils/AutoloadGenerator.php index 0d0907b330..1f639fc4ff 100644 --- a/includes/utils/AutoloadGenerator.php +++ b/includes/utils/AutoloadGenerator.php @@ -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 diff --git a/includes/utils/MWCryptHKDF.php b/includes/utils/MWCryptHKDF.php index cc136793c9..950dd846f1 100644 --- a/includes/utils/MWCryptHKDF.php +++ b/includes/utils/MWCryptHKDF.php @@ -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]; diff --git a/includes/utils/UIDGenerator.php b/includes/utils/UIDGenerator.php index 5346afa6a9..33e9116b29 100644 --- a/includes/utils/UIDGenerator.php +++ b/includes/utils/UIDGenerator.php @@ -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; diff --git a/includes/utils/ZipDirectoryReader.php b/includes/utils/ZipDirectoryReader.php index bc849766ed..86960aa187 100644 --- a/includes/utils/ZipDirectoryReader.php +++ b/includes/utils/ZipDirectoryReader.php @@ -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" ); diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index cf03ad1b3e..17769ad47e 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -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; diff --git a/tests/phpunit/includes/api/format/ApiFormatTestBase.php b/tests/phpunit/includes/api/format/ApiFormatTestBase.php index 8134c50975..67949ab9f2 100644 --- a/tests/phpunit/includes/api/format/ApiFormatTestBase.php +++ b/tests/phpunit/includes/api/format/ApiFormatTestBase.php @@ -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; diff --git a/tests/phpunit/includes/password/PasswordTestCase.php b/tests/phpunit/includes/password/PasswordTestCase.php index 78fc3ed2ae..9a142cbcca 100644 --- a/tests/phpunit/includes/password/PasswordTestCase.php +++ b/tests/phpunit/includes/password/PasswordTestCase.php @@ -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() { diff --git a/tests/testHelpers.inc b/tests/testHelpers.inc index bc02d0f1d8..acfdac8c4c 100644 --- a/tests/testHelpers.inc +++ b/tests/testHelpers.inc @@ -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 ) ) {