Improve docs in api related classes

Change-Id: I78338d48530f098fa5d36fe84cfd45c0d160f444
This commit is contained in:
Umherirrender 2020-11-12 22:37:48 +01:00
parent 1976283835
commit 083a0e57cb
12 changed files with 23 additions and 23 deletions

View file

@ -182,7 +182,7 @@ abstract class ApiBase extends ContextSource {
/** @var stdClass[][] Cache for self::filterIDs() */
private static $filterIDsCache = [];
/** $var array Map of web UI block messages to corresponding API messages and codes */
/** @var array Map of web UI block messages to corresponding API messages and codes */
private static $blockMsgMap = [
'blockedtext' => [ 'apierror-blocked', 'blocked' ],
'blockedtext-partial' => [ 'apierror-blocked-partial', 'blocked' ],
@ -200,7 +200,7 @@ abstract class ApiBase extends ContextSource {
* @var array
*/
private $mParamCache = [];
/** @var array|null|bool */
/** @var array|null|false */
private $mModuleSource = false;
/**
@ -961,7 +961,7 @@ abstract class ApiBase extends ContextSource {
/**
* Callback function used in requireOnlyOneParameter to check whether required parameters are set
*
* @param object $x Parameter to check is not null/false
* @param mixed $x Parameter to check is not null/false
* @return bool
*/
private function parameterNotEmpty( $x ) {
@ -973,7 +973,7 @@ abstract class ApiBase extends ContextSource {
* Can die, if no param is set or if the title or page id is not valid.
*
* @param array $params User provided set of parameters, as from $this->extractRequestParams()
* @param bool|string $load Whether load the object's state from the database:
* @param string|false $load Whether load the object's state from the database:
* - false: don't load (if the pageid is given, it will still be loaded)
* - 'fromdb': load from a replica DB
* - 'fromdbmaster': load from the master database
@ -1694,7 +1694,7 @@ abstract class ApiBase extends ContextSource {
* tweak it as needed.
*
* @param int $flags Zero or more flags like GET_VALUES_FOR_HELP
* @return array|bool False on no parameters
* @return array
* @since 1.21 $flags param added
*/
public function getFinalParams( $flags = 0 ) {

View file

@ -269,7 +269,7 @@ class ApiErrorFormatter {
return [];
}
$result = new ApiResult( 1e6 );
$result = new ApiResult( 1000000 );
$formatter = new ApiErrorFormatter(
$result, $this->lang, $format ?: $this->format, $this->useDB
);

View file

@ -33,8 +33,8 @@ class ApiFormatFeedWrapper extends ApiFormatBase {
/**
* Call this method to initialize output data. See execute()
* @param ApiResult $result
* @param object $feed An instance of one of the $wgFeedClasses classes
* @param array $feedItems Array of FeedItem objects
* @param FeedItem $feed An instance of one of the $wgFeedClasses classes
* @param FeedItem[] $feedItems
*/
public static function setResult( $result, $feed, $feedItems ) {
// Store output in the Result data.

View file

@ -224,7 +224,7 @@ class ApiModuleManager extends ContextSource {
* Returns the class name of the given module
*
* @param string $module Module name
* @return string|bool class name or false if the module does not exist
* @return string|false class name or false if the module does not exist
* @since 1.24
*/
public function getClassName( $module ) {

View file

@ -158,7 +158,7 @@ class ApiOptions extends ApiBase {
/**
* Load the user from the master to reduce CAS errors on double post (T95839)
*
* @return null|User
* @return User|null
*/
protected function getUserForUpdates() {
if ( !$this->userForUpdates ) {

View file

@ -444,7 +444,7 @@ abstract class ApiQueryBase extends ApiBase {
* here in the same way it treats a false return from addValue().
*
* @since 1.28
* @param object $row Database row
* @param stdClass $row Database row
* @param array &$data Data to be added to the result
* @param array &$hookData Hook data from ApiQueryBase::select()
* @return bool Return false if row processing should end with continuation

View file

@ -364,7 +364,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
* @param array $prop Array of properties to get (in the keys)
* @param ApiResult $result
* @param array|null $thumbParams Containing 'width' and 'height' items, or null
* @param array|bool|string $opts Options for data fetching.
* @param array|false|string $opts Options for data fetching.
* This is an array consisting of the keys:
* 'version': The metadata version for the metadata option
* 'language': The language for extmetadata property
@ -658,7 +658,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
/**
* @param File $img
* @param null|string $start
* @param string|null $start
* @return string
*/
protected function getContinueStr( $img, $start = null ) {

View file

@ -81,7 +81,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
* @internal
* @param User $user
* @param RecentChange|null $rc
* @return bool|string
* @return string|false
*/
public static function getPatrolToken( User $user, $rc = null ) {
$validTokenUser = false;

View file

@ -74,7 +74,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
* @deprecated since 1.24
* @internal
* @param User $user
* @return bool|string
* @return string|false
*/
public static function getRollbackToken( User $user ) {
if ( !MediaWikiServices::getInstance()->getPermissionManager()

View file

@ -232,7 +232,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
*
* @since 1.32, takes a RevisionRecord instead of a Revision
* @param RevisionRecord $revision
* @param object $row Should have a field 'ts_tags' if $this->fld_tags is set
* @param stdClass $row Should have a field 'ts_tags' if $this->fld_tags is set
* @return array
*/
protected function extractRevisionInfo( RevisionRecord $revision, $row ) {

View file

@ -146,7 +146,7 @@ class ApiResult implements ApiSerializable {
private $errorFormatter;
/**
* @param int|bool $maxSize Maximum result "size", or false for no limit
* @param int|false $maxSize Maximum result "size", or false for no limit
*/
public function __construct( $maxSize ) {
$this->maxSize = $maxSize;
@ -788,7 +788,7 @@ class ApiResult implements ApiSerializable {
* @since 1.25
* @param array $dataIn
* @param array $transforms
* @return array|object
* @return array|stdClass
*/
protected static function applyTransformations( array $dataIn, array $transforms ) {
$strip = $transforms['Strip'] ?? 'none';
@ -1003,8 +1003,8 @@ class ApiResult implements ApiSerializable {
* ones.
*
* @since 1.25
* @param array|object $data
* @return array|object
* @param array|stdClass $data
* @return array|stdClass
*/
public static function stripMetadata( $data ) {
if ( is_array( $data ) || is_object( $data ) ) {
@ -1036,9 +1036,9 @@ class ApiResult implements ApiSerializable {
* ones.
*
* @since 1.25
* @param array|object $data
* @param array|stdClass $data
* @param array|null &$metadata Store metadata here, if provided
* @return array|object
* @return array|stdClass
*/
public static function stripMetadataNonRecursive( $data, &$metadata = null ) {
if ( !is_array( $metadata ) ) {

View file

@ -22,7 +22,7 @@ interface ApiQueryBaseAfterQueryHook {
* @since 1.35
*
* @param ApiQueryBase $module Module in question
* @param IResultWrapper|bool $result ResultWrapper or bool returned from the IDatabase::select()
* @param IResultWrapper $result ResultWrapper
* @param array &$hookData Array that was passed to the ApiQueryBaseBeforeQuery hook and
* will be passed to the ApiQueryBaseProcessRow hook, intended for inter-hook
* communication