Fix param type of search terms in search related classes

Change-Id: I036434268f1e7992f7f9f23d2c1c0fcd399823c8
This commit is contained in:
Umherirrender 2019-06-07 20:43:02 +02:00
parent 7cc76abc36
commit 9421f6f52f
12 changed files with 17 additions and 16 deletions

View file

@ -3004,7 +3004,8 @@ $terms: Search terms, for highlighting
&$titleSnippet: Label for the link representing the search result. Typically the
article title.
$result: The SearchResult object
$terms: String of the search terms entered
$terms: array of search terms extracted by SearchDatabase search engines
(may not be populated by other search engines).
$specialSearch: The SpecialSearch object
&$query: Array of query string parameters for the link representing the search
result.

View file

@ -46,7 +46,7 @@ abstract class SearchEngine {
/** @var int */
protected $offset = 0;
/** @var array|string */
/** @var string[] */
protected $searchTerms = [];
/** @var bool */

View file

@ -44,7 +44,7 @@ class SearchHighlighter {
* Wikitext highlighting when $wgAdvancedSearchHighlighting = true
*
* @param string $text
* @param array $terms Terms to highlight (not html escaped but
* @param string[] $terms Terms to highlight (not html escaped but
* regex escaped via SearchDatabase::regexTerm())
* @param int $contextlines
* @param int $contextchars
@ -502,7 +502,7 @@ class SearchHighlighter {
* Used when $wgAdvancedSearchHighlighting is false.
*
* @param string $text
* @param array $terms Escaped for regex by SearchDatabase::regexTerm()
* @param string[] $terms Escaped for regex by SearchDatabase::regexTerm()
* @param int $contextlines
* @param int $contextchars
* @return string

View file

@ -146,7 +146,7 @@ class SearchResult {
}
/**
* @param array $terms Terms to highlight
* @param string[] $terms Terms to highlight
* @return string Highlighted text snippet, null (and not '') if not supported
*/
function getTextSnippet( $terms ) {

View file

@ -95,7 +95,7 @@ class SearchResultSet implements Countable, IteratorAggregate {
* the search terms as parsed by this engine in a text extract.
* STUB
*
* @return array
* @return string[]
*/
function termMatches() {
return [];

View file

@ -9,7 +9,7 @@ use Wikimedia\Rdbms\ResultWrapper;
class SqlSearchResultSet extends SearchResultSet {
/** @var ResultWrapper Result object from database */
protected $resultSet;
/** @var string Requested search query */
/** @var string[] Requested search query */
protected $terms;
/** @var int|null Total number of hits for $terms */
protected $totalHits;

View file

@ -30,7 +30,7 @@ class FullSearchResultWidget implements SearchResultWidget {
/**
* @param SearchResult $result The result to render
* @param string $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param string[] $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param int $position The result position, including offset
* @return string HTML
*/
@ -117,7 +117,7 @@ class FullSearchResultWidget implements SearchResultWidget {
* title with highlighted words).
*
* @param SearchResult $result
* @param string $terms
* @param string[] $terms
* @param int $position
* @return string HTML
*/

View file

@ -24,7 +24,7 @@ class InterwikiSearchResultWidget implements SearchResultWidget {
/**
* @param SearchResult $result The result to render
* @param string $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param string[] $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param int $position The result position, including offset
* @return string HTML
*/

View file

@ -10,7 +10,7 @@ use SearchResult;
interface SearchResultWidget {
/**
* @param SearchResult $result The result to render
* @param string $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param string[] $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param int $position The zero indexed result position, including offset
* @return string HTML
*/

View file

@ -26,7 +26,7 @@ class SimpleSearchResultWidget implements SearchResultWidget {
/**
* @param SearchResult $result The result to render
* @param string $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param string[] $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
* @param int $position The result position, including offset
* @return string HTML
*/

View file

@ -2967,8 +2967,8 @@ class Language {
}
/**
* @param array $termsArray
* @return array
* @param string[] $termsArray
* @return string[]
*/
function convertForSearchResult( $termsArray ) {
# some languages, e.g. Chinese, need to do a conversion

View file

@ -188,8 +188,8 @@ class LanguageZh extends LanguageZh_hans {
}
/**
* @param array $termsArray
* @return array
* @param string[] $termsArray
* @return string[]
*/
function convertForSearchResult( $termsArray ) {
$terms = implode( '|', $termsArray );