From c785efd25e8e8f32efe14d4f416aaf0df0b3a4a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thiemo=20M=C3=A4ttig?= Date: Fri, 21 Jul 2017 12:22:12 +0200 Subject: [PATCH] Fix and make some types in PHPDoc and JSDoc tags more specific Change-Id: I7c109067579f570ecccaabc75b0b4db7eac4e6c2 --- includes/api/ApiBase.php | 2 +- includes/libs/StatusValue.php | 13 +++++++++---- includes/specials/SpecialSearch.php | 2 +- languages/Language.php | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index bc3def841f..44a2280087 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -2857,7 +2857,7 @@ abstract class ApiBase extends ContextSource { * Return the error message related to a certain array * @deprecated since 1.29 * @param array|string|MessageSpecifier $error Element of a getUserPermissionsErrors()-style array - * @return [ 'code' => code, 'info' => info ] + * @return array [ 'code' => code, 'info' => info ] */ public function parseMsg( $error ) { // Check whether someone passed the whole array, instead of one element as diff --git a/includes/libs/StatusValue.php b/includes/libs/StatusValue.php index e860ec491f..f9dcc1b52e 100644 --- a/includes/libs/StatusValue.php +++ b/includes/libs/StatusValue.php @@ -40,17 +40,22 @@ * @since 1.25 */ class StatusValue { + /** @var bool */ protected $ok = true; - /** @var array */ + + /** @var array[] */ protected $errors = []; /** @var mixed */ public $value; - /** @var array Map of (key => bool) to indicate success of each part of batch operations */ + + /** @var bool[] Map of (key => bool) to indicate success of each part of batch operations */ public $success = []; + /** @var int Counter for batch operations */ public $successCount = 0; + /** @var int Counter for batch operations */ public $failCount = 0; @@ -138,7 +143,7 @@ class StatusValue { * * Each error is a (message:string or MessageSpecifier,params:array) map * - * @return array + * @return array[] */ public function getErrors() { return $this->errors; @@ -230,7 +235,7 @@ class StatusValue { * - params: array list of parameters * * @param string $type - * @return array + * @return array[] */ public function getErrorsByType( $type ) { $result = []; diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index eeb8823ffb..8afea0b295 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -352,7 +352,7 @@ class SpecialSearch extends SpecialPage { $out->addHTML( $dymWidget->render( $term, $textMatches ) ); } - $hasErrors = $textStatus && $textStatus->getErrors(); + $hasErrors = $textStatus && $textStatus->getErrors() !== []; $hasOtherResults = $textMatches && $textMatches->hasInterwikiResults( SearchResultSet::INLINE_RESULTS ); diff --git a/languages/Language.php b/languages/Language.php index 83dff65aba..f319d38cd0 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1092,7 +1092,7 @@ class Language { * YYYYMMDDHHMMSS * 01234567890123 * @param DateTimeZone $zone Timezone of $ts - * @param[out] int $ttl The amount of time (in seconds) the output may be cached for. + * @param int &$ttl The amount of time (in seconds) the output may be cached for. * Only makes sense if $ts is the current time. * @todo handling of "o" format character for Iranian, Hebrew, Hijri & Thai? * -- 2.20.1