EBernhardson has uploaded a new change for review. https://gerrit.wikimedia.org/r/283580
Change subject: Add annotations to Api, Elastica, and Extra sub-namespaces ...................................................................... Add annotations to Api, Elastica, and Extra sub-namespaces Bug: T132625 Change-Id: I7c181b77a315710242a9f2f0c2dfb75d84ba1315 --- M includes/Api/ApiBase.php M includes/Elastica/PooledHttp.php M includes/Extra/Filter/SourceRegex.php M includes/Util.php 4 files changed, 45 insertions(+), 34 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/80/283580/1 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/Elastica/PooledHttp.php b/includes/Elastica/PooledHttp.php index 8ffd02c..e7ea693 100644 --- a/includes/Elastica/PooledHttp.php +++ b/includes/Elastica/PooledHttp.php @@ -38,11 +38,6 @@ class PooledHttp extends Http { /** - * Map from pool name to active connection - */ - private $_curlPoolConnections = array(); - - /** * @param bool $persistent * @return resource Curl handle */ diff --git a/includes/Extra/Filter/SourceRegex.php b/includes/Extra/Filter/SourceRegex.php index a748d0c..c808ca8 100644 --- a/includes/Extra/Filter/SourceRegex.php +++ b/includes/Extra/Filter/SourceRegex.php @@ -46,7 +46,7 @@ /** * @param string $regex regex to match against field - * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining + * @return $this */ public function setRegex( $regex ) { return $this->setParam( 'regex', $regex ); @@ -54,7 +54,7 @@ /** * @param string $field field who's source to check with the regex - * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining + * @return $this */ public function setField( $field ) { return $this->setParam( 'field', $field ); @@ -62,8 +62,8 @@ /** * @param string $ngramField field that is indexed with ngrams to - * accelerate regex matching - * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining + * accelerate regex matching + * @return $this */ public function setNGramField( $ngramField ) { return $this->setParam( 'ngram_field', $ngramField ); @@ -71,9 +71,9 @@ /** * @param int $gramSize size of the ngrams extracted for acccelerating - * the regex. Defaults to 3 if not set. That gram size must have been - * produced by analyzing the ngramField. - * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining + * the regex. Defaults to 3 if not set. That gram size must have been + * produced by analyzing the ngramField. + * @return $this */ public function setGramSize( $gramSize ) { return $this->setParam( 'gram_size', $gramSize ); @@ -81,10 +81,10 @@ /** * @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 + * 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 ); @@ -92,10 +92,10 @@ /** * @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 + * 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 ); @@ -103,11 +103,11 @@ /** * @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 + * 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 ); @@ -115,8 +115,8 @@ /** * @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 + * that Lucene's regex compilation can expand to (even temporarily) + * @return $this */ public function setMaxDeterminizedStates( $maxDeterminizedStates ) { return $this->setParam( 'max_determinized_states', $maxDeterminizedStates ); @@ -124,8 +124,8 @@ /** * @param bool $caseSensitive is the regex case insensitive? Defaults to - * case insensitive if not set. - * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining + * case insensitive if not set. + * @return $this */ public function setCaseSensitive( $caseSensitive ) { return $this->setParam( 'case_sensitive', $caseSensitive ); @@ -133,8 +133,8 @@ /** * @param bool $locale locale used for case conversions. Its imporant that - * this matches the locale used for lowercasing in the ngram index. - * @return \CirrusSearch\Extra\Filter\SourceRegex this for chaining + * this matches the locale used for lowercasing in the ngram index. + * @return $this */ public function setLocale( $locale ) { return $this->setParam( 'locale', $locale ); diff --git a/includes/Util.php b/includes/Util.php index 4ad6c4e..ae3e636 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 aquired. Called with - * no parameters. + * 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: newchange Gerrit-Change-Id: I7c181b77a315710242a9f2f0c2dfb75d84ba1315 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits