From: Brad Jorsch Date: Wed, 25 Nov 2015 16:32:14 +0000 (-0500) Subject: Update ApiBase::PARAM_* comments X-Git-Tag: 1.31.0-rc.0~8872^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=0c3fd14073e6ef3c3e24450289734914e288b57d;p=lhc%2Fweb%2Fwiklou.git Update ApiBase::PARAM_* comments Put them in a form that doxygen should recognize,[1] and document all the types recognized for PARAM_TYPE. Ideally we'd use some @-thing like @var to specify the types instead of just a weird parenthetical, but looking at existing examples it seems that putting @var on a class constant will instead make doxygen completely ignore it. [1]: See https://doc.wikimedia.org/mediawiki-core/master/php/classApiBase.html Change-Id: Iccfa1dc9a7a79313ff9acf71934264c115b3fa76 --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 122789984d..8e5cdcc471 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -37,68 +37,148 @@ * @ingroup API */ abstract class ApiBase extends ContextSource { - // These constants allow modules to specify exactly how to treat incoming parameters. - // Default value of the parameter + /** + * @name Constants for ::getAllowedParams() arrays + * These constants are keys in the arrays returned by ::getAllowedParams() + * and accepted by ::getParameterFromSettings() that define how the + * parameters coming in from the request are to be interpreted. + * @{ + */ + + /** (null|boolean|integer|string) Default value of the parameter. */ const PARAM_DFLT = 0; - // Boolean, do we accept more than one item for this parameter (e.g.: titles)? + + /** (boolean) Accept multiple pipe-separated values for this parameter (e.g. titles)? */ const PARAM_ISMULTI = 1; - // Can be either a string type (e.g.: 'integer') or an array of allowed values + + /** + * (string|string[]) Either an array of allowed value strings, or a string + * type as described below. If not specified, will be determined from the + * type of PARAM_DFLT. + * + * Supported string types are: + * - boolean: A boolean parameter, returned as false if the parameter is + * omitted and true if present (even with a falsey value, i.e. it works + * like HTML checkboxes). PARAM_DFLT must be boolean false, if specified. + * Cannot be used with PARAM_ISMULTI. + * - integer: An integer value. See also PARAM_MIN, PARAM_MAX, and + * PARAM_RANGE_ENFORCE. + * - limit: An integer or the string 'max'. Default lower limit is 0 (but + * see PARAM_MIN), and requires that PARAM_MAX and PARAM_MAX2 be + * specified. Cannot be used with PARAM_ISMULTI. + * - namespace: An integer representing a MediaWiki namespace. + * - NULL: Any string. + * - password: Any non-empty string. Input value is private or sensitive. + * would be an appropriate HTML form field. + * - string: Any non-empty string, not expected to be very long or contain newlines. + * would be an appropriate HTML form field. + * - submodule: The name of a submodule of this module, see PARAM_SUBMODULE_MAP. + * - text: Any non-empty string, expected to be very long or contain newlines. + *