jenkins-bot has submitted this change and it was merged.
Change subject: Add annotations to Api, Elastica, and Extra sub-namespaces
......................................................................
Add annotations to Api, Elastica, and Extra sub-namespaces
Also updates 4 spaces to tabs in the Extra namespace. These were the
only two files doing that, everything else in mediawiki uses tabs.
Bug: T132625
Change-Id: I7c181b77a315710242a9f2f0c2dfb75d84ba1315
---
M includes/Api/ApiBase.php
M includes/Extra/Filter/IdHashMod.php
M includes/Extra/Filter/SourceRegex.php
M includes/Util.php
4 files changed, 113 insertions(+), 97 deletions(-)
Approvals:
Smalyshev: Looks good to me, approved
Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/includes/Api/ApiBase.php b/includes/Api/ApiBase.php
index d094824..0857b9e 100644
--- a/includes/Api/ApiBase.php
+++ b/includes/Api/ApiBase.php
@@ -7,8 +7,12 @@
use MediaWiki\MediaWikiServices;
abstract class ApiBase extends CoreApiBase {
+ /** @var Connection */
private $connection;
+ /**
+ * @return Connection
+ */
public function getCirrusConnection() {
if ($this->connection === null) {
$config = MediaWikiServices::getInstance()
diff --git a/includes/Extra/Filter/IdHashMod.php
b/includes/Extra/Filter/IdHashMod.php
index eeba709..041a99c 100644
--- a/includes/Extra/Filter/IdHashMod.php
+++ b/includes/Extra/Filter/IdHashMod.php
@@ -25,12 +25,12 @@
* http://www.gnu.org/copyleft/gpl.html
*/
class IdHashMod extends AbstractFilter {
- /**
- * @param int $mod modulus to use. Number of chunks to cut the data into.
- * @param int $match value to match. Must be less than $mod. Its the
- * current chunk number.
- */
- public function __construct( $mod, $match ) {
- $this->setParam( 'mod', $mod )->setParam( 'match', $match );
- }
+ /**
+ * @param int $mod modulus to use. Number of chunks to cut the data
into.
+ * @param int $match value to match. Must be less than $mod. Its the
+ * current chunk number.
+ */
+ public function __construct( $mod, $match ) {
+ $this->setParam( 'mod', $mod )->setParam( 'match', $match );
+ }
}
diff --git a/includes/Extra/Filter/SourceRegex.php
b/includes/Extra/Filter/SourceRegex.php
index bf26856..c00da42 100644
--- a/includes/Extra/Filter/SourceRegex.php
+++ b/includes/Extra/Filter/SourceRegex.php
@@ -26,48 +26,48 @@
*/
class SourceRegex extends AbstractFilter {
- /**
- * @param null|string $regex optional regex to match against field
- * @param null|string $field optional field who's source to check with the
regex
- * @param null|string $ngramField optional field that is indexed with
ngrams to
- * accelerate regex matching
- */
- public function __construct( $regex = null, $field = null, $ngramField =
null ) {
- if ( $regex ) {
- $this->setRegex( $regex );
- }
- if ( $field ) {
- $this->setField( $field );
- }
- if ( $ngramField ) {
- $this->setNGramField( $ngramField );
- }
- }
+ /**
+ * @param null|string $regex optional regex to match against field
+ * @param null|string $field optional field who's source to check with
the regex
+ * @param null|string $ngramField optional field that is indexed with
ngrams to
+ * accelerate regex matching
+ */
+ public function __construct( $regex = null, $field = null, $ngramField
= null ) {
+ if ( $regex ) {
+ $this->setRegex( $regex );
+ }
+ if ( $field ) {
+ $this->setField( $field );
+ }
+ if ( $ngramField ) {
+ $this->setNGramField( $ngramField );
+ }
+ }
- /**
- * @param string $regex regex to match against field
- * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining
- */
- public function setRegex( $regex ) {
- return $this->setParam( 'regex', $regex );
- }
+ /**
+ * @param string $regex regex to match against field
+ * @return $this
+ */
+ public function setRegex( $regex ) {
+ return $this->setParam( 'regex', $regex );
+ }
- /**
- * @param string $field field who's source to check with the regex
- * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining
- */
- public function setField( $field ) {
- return $this->setParam( 'field', $field );
- }
+ /**
+ * @param string $field field who's source to check with the regex
+ * @return $this
+ */
+ public function setField( $field ) {
+ return $this->setParam( 'field', $field );
+ }
- /**
- * @param string $ngramField field that is indexed with ngrams to
- * accelerate regex matching
- * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining
- */
- public function setNGramField( $ngramField ) {
- return $this->setParam( 'ngram_field', $ngramField );
- }
+ /**
+ * @param string $ngramField field that is indexed with ngrams to
+ * accelerate regex matching
+ * @return $this
+ */
+ public function setNGramField( $ngramField ) {
+ return $this->setParam( 'ngram_field', $ngramField );
+ }
/**
* @param int $gramSize size of the ngrams extracted for accelerating
@@ -79,57 +79,57 @@
return $this->setParam( 'gram_size', $gramSize );
}
- /**
- * @param int $maxExpand maximum range before outgoing automaton arcs are
- * ignored. Roughly corresponds to the maximum number of characters in a
- * character class ([abcd]) before it is treated as . for purposes of
- * acceleration. Defaults to 4.
- * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining
- */
- public function setMaxExpand( $maxExpand ) {
- return $this->setParam( 'max_expand', $maxExpand );
- }
+ /**
+ * @param int $maxExpand maximum range before outgoing automaton arcs
are
+ * ignored. Roughly corresponds to the maximum number of characters in
a
+ * character class ([abcd]) before it is treated as . for purposes of
+ * acceleration. Defaults to 4.
+ * @return $this
+ */
+ public function setMaxExpand( $maxExpand ) {
+ return $this->setParam( 'max_expand', $maxExpand );
+ }
- /**
- * @param int $maxStatesTraced maximum number of automaton states that can
- * be traced before the algorithm gives up and assumes the regex is too
- * complex and throws an error back to the user. Defaults to 10000 which
- * handily covers all regexes I cared to test.
- * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining
- */
- public function setMaxStatesTraced( $maxStatesTraced ) {
- return $this->setParam( 'max_states_traced', $maxStatesTraced );
- }
+ /**
+ * @param int $maxStatesTraced maximum number of automaton states that
can
+ * be traced before the algorithm gives up and assumes the regex is too
+ * complex and throws an error back to the user. Defaults to 10000
which
+ * handily covers all regexes I cared to test.
+ * @return $this
+ */
+ public function setMaxStatesTraced( $maxStatesTraced ) {
+ return $this->setParam( 'max_states_traced', $maxStatesTraced );
+ }
- /**
- * @param int $maxInspect maximum number of source field to run the regex
- * against before giving up and just declaring all remaining fields not
- * matching by fiat. Defaults to MAX_INT. Set this to 10000 or something
- * nice and low to prevent regular expressions that cannot be sped up from
- * taking up too many resources.
- * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining
- */
- public function setMaxInspect( $maxInspect ) {
- return $this->setParam( 'max_inspect', $maxInspect );
- }
+ /**
+ * @param int $maxInspect maximum number of source field to run the
regex
+ * against before giving up and just declaring all remaining fields not
+ * matching by fiat. Defaults to MAX_INT. Set this to 10000 or
something
+ * nice and low to prevent regular expressions that cannot be sped up
from
+ * taking up too many resources.
+ * @return $this
+ */
+ public function setMaxInspect( $maxInspect ) {
+ return $this->setParam( 'max_inspect', $maxInspect );
+ }
- /**
- * @param int $maxDeterminizedStates maximum number of automaton states
- * that Lucene's regex compilation can expand to (even temporarily)
- * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining
- */
- public function setMaxDeterminizedStates( $maxDeterminizedStates ) {
- return $this->setParam( 'max_determinized_states',
$maxDeterminizedStates );
- }
+ /**
+ * @param int $maxDeterminizedStates maximum number of automaton states
+ * that Lucene's regex compilation can expand to (even temporarily)
+ * @return $this
+ */
+ public function setMaxDeterminizedStates( $maxDeterminizedStates ) {
+ return $this->setParam( 'max_determinized_states',
$maxDeterminizedStates );
+ }
- /**
- * @param bool $caseSensitive is the regex case insensitive? Defaults to
- * case insensitive if not set.
- * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining
- */
- public function setCaseSensitive( $caseSensitive ) {
- return $this->setParam( 'case_sensitive', $caseSensitive );
- }
+ /**
+ * @param bool $caseSensitive is the regex case insensitive? Defaults
to
+ * case insensitive if not set.
+ * @return $this
+ */
+ public function setCaseSensitive( $caseSensitive ) {
+ return $this->setParam( 'case_sensitive', $caseSensitive );
+ }
/**
* @param bool $locale locale used for case conversions. Its important
that
@@ -141,7 +141,7 @@
}
/**
- * @param int $maxNgrams The maximum number of ngrams to extracted from
the
+ * @param int $maxNgrams The maximum number of ngrams to extracted from
the
* regex. If more could be extracted from the regex tey are ignored.
* @return $this
*/
diff --git a/includes/Util.php b/includes/Util.php
index 419fac0..8d5f035 100644
--- a/includes/Util.php
+++ b/includes/Util.php
@@ -35,9 +35,11 @@
class Util {
/**
* Cache getDefaultBoostTemplates()
+ *
* @var array|null boost templates
*/
private static $defaultBoostTemplates = null;
+
/**
* Get the textual representation of a namespace with underscores
stripped, varying
* by gender if need be.
@@ -70,6 +72,7 @@
/**
* Check if too arrays are recursively the same. Values are compared
with != and arrays
* are descended into.
+ *
* @param array $lhs one array
* @param array $rhs the other array
* @return bool are they equal
@@ -133,13 +136,14 @@
/**
* Wraps the complex pool counter interface to force the single call
pattern
* that Cirrus always uses.
+ *
* @param string $type same as type parameter on PoolCounter::factory
* @param \User $user the user
* @param callable $workCallback callback when pool counter is
acquired. Called with
* no parameters.
* @param callable $errorCallback optional callback called on errors.
Called with
- * the error string and the key as parameters. If left undefined
defaults
- * to a function that returns a fatal status and logs an warning.
+ * the error string and the key as parameters. If left undefined
defaults
+ * to a function that returns a fatal status and logs an warning.
* @return mixed
*/
public static function doPoolCounterWork( $type, $user, $workCallback,
$errorCallback = null ) {
@@ -279,6 +283,7 @@
/**
* Iterate over a scroll.
+ *
* @param \Elastica\Index $index
* @param string $scrollId the initial $scrollId
* @param string $scrollTime the scroll timeout
@@ -366,6 +371,7 @@
/**
* Backoff with lowest possible upper bound as 16 seconds.
* With the default maximum number of errors (5) this maxes out at 256
seconds.
+ *
* @param int $errorCount
* @return int
*/
@@ -376,6 +382,7 @@
/**
* Parse a message content into an array. This function is generally
used to
* parse settings stored as i18n messages (see
cirrussearch-boost-templates).
+ *
* @param string $message
* @return string[]
*/
@@ -390,6 +397,7 @@
/**
* Tries to identify the best redirect by finding the link with the
* smallest edit distance between the title and the user query.
+ *
* @param string $userQuery the user query
* @param array $redirects the list of redirects
* @return string the best redirect text
@@ -420,6 +428,7 @@
/**
* Test if $string ends with $suffix
+ *
* @param string $string string to test
* @param string $suffix the suffix
* @return boolean true if $string ends with $suffix
@@ -435,6 +444,7 @@
/**
* Set $dest to the true/false from $request->getVal( $name ) if yes/no.
+ *
* @param mixed &$dest
* @param WebRequest $request
* @param string $name
@@ -453,6 +463,7 @@
/**
* Set $dest to the numeric value from $request->getVal( $name ) if it
is <= $limit
* or => $limit if upperLimit is false.
+ *
* @param mixed &$dest
* @param WebRequest $request
* @param string $name
@@ -474,6 +485,7 @@
/**
* Parse boosted templates. Parse failures silently return no boosted
templates.
+ *
* @param string $text text representation of boosted templates
* @return float[] map of boosted templates (key is the template, value
is a float).
*/
--
To view, visit https://gerrit.wikimedia.org/r/283580
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7c181b77a315710242a9f2f0c2dfb75d84ba1315
Gerrit-PatchSet: 13
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits