From 002d8710486e755a7d6329cc29a6510c53959064 Mon Sep 17 00:00:00 2001 From: Reedy Date: Thu, 12 Jul 2012 16:53:00 +0100 Subject: [PATCH] Api method documentation tweaks Change-Id: I43398b6016f64accf86921c72a6dac5e71e11c34 --- includes/api/ApiBase.php | 3 ++- includes/api/ApiMain.php | 10 ++++++++++ includes/api/ApiPageSet.php | 2 +- includes/api/ApiQuery.php | 16 ++++++++++++++++ includes/api/ApiQueryBase.php | 5 +++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 77c0fc29dd..f231081976 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -134,7 +134,7 @@ abstract class ApiBase extends ContextSource { /** * Get the name of the module as shown in the profiler log * - * @param $db DatabaseBase + * @param $db DatabaseBase|bool * * @return string */ @@ -1185,6 +1185,7 @@ abstract class ApiBase extends ContextSource { * automated identification of the error, e.g., 'unknown_action' * @param $httpRespCode int HTTP response code * @param $extradata array Data to add to the "" element; array in ApiResult format + * @throws UsageException */ public function dieUsage( $description, $errorCode, $httpRespCode = 0, $extradata = null ) { Profiler::instance()->close(); diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 172a77bed8..65aaf7d88d 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -1160,8 +1160,18 @@ class ApiMain extends ApiBase { class UsageException extends MWException { private $mCodestr; + + /** + * @var null|array + */ private $mExtraData; + /** + * @param $message string + * @param $codestr string + * @param $code int + * @param $extradata array|null + */ public function __construct( $message, $codestr, $code = 0, $extradata = null ) { parent::__construct( $message, $code ); $this->mCodestr = $codestr; diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index e5146ebc6d..4c0596b61a 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -52,7 +52,7 @@ class ApiPageSet extends ApiQueryBase { /** * Constructor - * @param $query ApiQueryBase + * @param $query ApiBase * @param $resolveRedirects bool Whether redirects should be resolved * @param $convertTitles bool */ diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index 866b71c25f..168bb24457 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -103,6 +103,10 @@ class ApiQuery extends ApiBase { protected $mAllowedGenerators = array(); + /** + * @param $main ApiMain + * @param $action string + */ public function __construct( $main, $action ) { parent::__construct( $main, $action ); @@ -202,6 +206,9 @@ class ApiQuery extends ApiBase { return null; } + /** + * @return ApiFormatRaw|null + */ public function getCustomPrinter() { // If &exportnowrap is set, use the raw formatter if ( $this->getParameter( 'export' ) && @@ -258,6 +265,9 @@ class ApiQuery extends ApiBase { $this->outputGeneralPageInfo(); // Execute all requested modules. + /** + * @var $module ApiQueryBase + */ foreach ( $modules as $module ) { $params = $module->extractRequestParams(); $cacheMode = $this->mergeCacheMode( @@ -303,6 +313,9 @@ class ApiQuery extends ApiBase { */ private function addCustomFldsToPageSet( $modules, $pageSet ) { // Query all requested modules. + /** + * @var $module ApiQueryBase + */ foreach ( $modules as $module ) { $module->requestExtraData( $pageSet ); } @@ -384,6 +397,9 @@ class ApiQuery extends ApiBase { // Show redirect information $redirValues = array(); + /** + * @var $titleTo Title + */ foreach ( $pageSet->getRedirectTitles() as $titleStrFrom => $titleTo ) { $r = array( 'from' => strval( $titleStrFrom ), diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 92fabddd00..0819d86c20 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -571,6 +571,11 @@ abstract class ApiQueryGeneratorBase extends ApiQueryBase { private $mIsGenerator; + /** + * @param $query ApiBase + * @param $moduleName string + * @param $paramPrefix string + */ public function __construct( $query, $moduleName, $paramPrefix = '' ) { parent::__construct( $query, $moduleName, $paramPrefix ); $this->mIsGenerator = false; -- 2.20.1