From ee8d932de23a4a4d4a397deb8006f08eba59cf1f Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Fri, 8 Jan 2021 08:36:47 +0100 Subject: [PATCH] Fix minor deprecations and incomplete PHPDoc tags Change-Id: I8c331d269bf5dcd177dd1ab9d5f6d1c83f53e40b --- .phpcs.xml | 10 ++++++++++ includes/ApiQueryExtracts.php | 20 +++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index eddb6dc..0a285ef 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,6 +1,16 @@ + + + 5 + + + + + + + . diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php index a6910a3..70f50ff 100644 --- a/includes/ApiQueryExtracts.php +++ b/includes/ApiQueryExtracts.php @@ -14,6 +14,7 @@ use ParserOptions; use Title; use User; use WANObjectCache; +use Wikimedia\ParamValidator\ParamValidator; use WikiPage; /** @@ -45,7 +46,7 @@ class ApiQueryExtracts extends ApiQueryBase { // TODO: Allow extensions to hook into this to opt-in. // This is partly for security reasons; see T107170. /** - * @var array + * @var string[] */ private $supportedContentModels = [ 'wikitext' ]; @@ -64,7 +65,6 @@ class ApiQueryExtracts extends ApiQueryBase { /** * Evaluates the parameters, performs the requested extraction of text, * and sets up the result - * @return null */ public function execute() { $titles = $this->getPageSet()->getGoodTitles(); @@ -189,7 +189,7 @@ class ApiQueryExtracts extends ApiQueryBase { /** * @param WikiPage $page * @param bool $introOnly - * @return string + * @return string|false */ private function getFromCache( WikiPage $page, $introOnly ) { $cache = $this->cache; @@ -372,8 +372,7 @@ class ApiQueryExtracts extends ApiQueryBase { } /** - * Return an array describing all possible parameters to this module - * @return array + * @inheritDoc */ public function getAllowedParams() { return [ @@ -388,7 +387,7 @@ class ApiQueryExtracts extends ApiQueryBase { ApiBase::PARAM_MAX => 10, ], 'limit' => [ - ApiBase::PARAM_DFLT => 20, + ParamValidator::PARAM_DEFAULT => 20, ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => 20, @@ -398,7 +397,7 @@ class ApiQueryExtracts extends ApiQueryBase { 'plaintext' => false, 'sectionformat' => [ ApiBase::PARAM_TYPE => [ 'plain', 'wiki', 'raw' ], - ApiBase::PARAM_DFLT => 'wiki', + ParamValidator::PARAM_DEFAULT => 'wiki', ], 'continue' => [ ApiBase::PARAM_TYPE => 'integer', @@ -408,8 +407,7 @@ class ApiQueryExtracts extends ApiQueryBase { } /** - * @see ApiBase::getExamplesMessages() - * @return array + * @inheritDoc */ protected function getExamplesMessages() { return [ @@ -419,10 +417,10 @@ class ApiQueryExtracts extends ApiQueryBase { } /** - * @see ApiBase::getHelpUrls() - * @return string + * @inheritDoc */ public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:TextExtracts#API'; } + }