mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TextExtracts
synced 2024-11-27 09:30:09 +00:00
Fix minor deprecations and incomplete PHPDoc tags
Change-Id: I8c331d269bf5dcd177dd1ab9d5f6d1c83f53e40b
This commit is contained in:
parent
f93fcf6d26
commit
ee8d932de2
10
.phpcs.xml
10
.phpcs.xml
|
@ -1,6 +1,16 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ruleset>
|
<ruleset>
|
||||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
|
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
|
||||||
|
|
||||||
|
<rule ref="MediaWiki.Classes.FullQualifiedClassName">
|
||||||
|
<severity>5</severity>
|
||||||
|
</rule>
|
||||||
|
<rule ref="MediaWiki.Commenting.ClassLevelLicense">
|
||||||
|
<properties>
|
||||||
|
<property name="license" value="GPL-2.0-or-later" />
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<file>.</file>
|
<file>.</file>
|
||||||
<arg name="extensions" value="php" />
|
<arg name="extensions" value="php" />
|
||||||
<arg name="encoding" value="UTF-8" />
|
<arg name="encoding" value="UTF-8" />
|
||||||
|
|
|
@ -14,6 +14,7 @@ use ParserOptions;
|
||||||
use Title;
|
use Title;
|
||||||
use User;
|
use User;
|
||||||
use WANObjectCache;
|
use WANObjectCache;
|
||||||
|
use Wikimedia\ParamValidator\ParamValidator;
|
||||||
use WikiPage;
|
use WikiPage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +46,7 @@ class ApiQueryExtracts extends ApiQueryBase {
|
||||||
// TODO: Allow extensions to hook into this to opt-in.
|
// TODO: Allow extensions to hook into this to opt-in.
|
||||||
// This is partly for security reasons; see T107170.
|
// This is partly for security reasons; see T107170.
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private $supportedContentModels = [ 'wikitext' ];
|
private $supportedContentModels = [ 'wikitext' ];
|
||||||
|
|
||||||
|
@ -64,7 +65,6 @@ class ApiQueryExtracts extends ApiQueryBase {
|
||||||
/**
|
/**
|
||||||
* Evaluates the parameters, performs the requested extraction of text,
|
* Evaluates the parameters, performs the requested extraction of text,
|
||||||
* and sets up the result
|
* and sets up the result
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function execute() {
|
public function execute() {
|
||||||
$titles = $this->getPageSet()->getGoodTitles();
|
$titles = $this->getPageSet()->getGoodTitles();
|
||||||
|
@ -189,7 +189,7 @@ class ApiQueryExtracts extends ApiQueryBase {
|
||||||
/**
|
/**
|
||||||
* @param WikiPage $page
|
* @param WikiPage $page
|
||||||
* @param bool $introOnly
|
* @param bool $introOnly
|
||||||
* @return string
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
private function getFromCache( WikiPage $page, $introOnly ) {
|
private function getFromCache( WikiPage $page, $introOnly ) {
|
||||||
$cache = $this->cache;
|
$cache = $this->cache;
|
||||||
|
@ -372,8 +372,7 @@ class ApiQueryExtracts extends ApiQueryBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array describing all possible parameters to this module
|
* @inheritDoc
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function getAllowedParams() {
|
public function getAllowedParams() {
|
||||||
return [
|
return [
|
||||||
|
@ -388,7 +387,7 @@ class ApiQueryExtracts extends ApiQueryBase {
|
||||||
ApiBase::PARAM_MAX => 10,
|
ApiBase::PARAM_MAX => 10,
|
||||||
],
|
],
|
||||||
'limit' => [
|
'limit' => [
|
||||||
ApiBase::PARAM_DFLT => 20,
|
ParamValidator::PARAM_DEFAULT => 20,
|
||||||
ApiBase::PARAM_TYPE => 'limit',
|
ApiBase::PARAM_TYPE => 'limit',
|
||||||
ApiBase::PARAM_MIN => 1,
|
ApiBase::PARAM_MIN => 1,
|
||||||
ApiBase::PARAM_MAX => 20,
|
ApiBase::PARAM_MAX => 20,
|
||||||
|
@ -398,7 +397,7 @@ class ApiQueryExtracts extends ApiQueryBase {
|
||||||
'plaintext' => false,
|
'plaintext' => false,
|
||||||
'sectionformat' => [
|
'sectionformat' => [
|
||||||
ApiBase::PARAM_TYPE => [ 'plain', 'wiki', 'raw' ],
|
ApiBase::PARAM_TYPE => [ 'plain', 'wiki', 'raw' ],
|
||||||
ApiBase::PARAM_DFLT => 'wiki',
|
ParamValidator::PARAM_DEFAULT => 'wiki',
|
||||||
],
|
],
|
||||||
'continue' => [
|
'continue' => [
|
||||||
ApiBase::PARAM_TYPE => 'integer',
|
ApiBase::PARAM_TYPE => 'integer',
|
||||||
|
@ -408,8 +407,7 @@ class ApiQueryExtracts extends ApiQueryBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ApiBase::getExamplesMessages()
|
* @inheritDoc
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
protected function getExamplesMessages() {
|
protected function getExamplesMessages() {
|
||||||
return [
|
return [
|
||||||
|
@ -419,10 +417,10 @@ class ApiQueryExtracts extends ApiQueryBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ApiBase::getHelpUrls()
|
* @inheritDoc
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getHelpUrls() {
|
public function getHelpUrls() {
|
||||||
return 'https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:TextExtracts#API';
|
return 'https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:TextExtracts#API';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue