diff --git a/docs/hooks.txt b/docs/hooks.txt index 976d5c2a944..b275adc29ca 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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. diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 9771e8881ed..7cc0ba12a83 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -46,7 +46,7 @@ abstract class SearchEngine { /** @var int */ protected $offset = 0; - /** @var array|string */ + /** @var string[] */ protected $searchTerms = []; /** @var bool */ diff --git a/includes/search/SearchHighlighter.php b/includes/search/SearchHighlighter.php index 469502fd436..6c01f799d5c 100644 --- a/includes/search/SearchHighlighter.php +++ b/includes/search/SearchHighlighter.php @@ -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 diff --git a/includes/search/SearchResult.php b/includes/search/SearchResult.php index f85c58fe2d2..30d7be7fea7 100644 --- a/includes/search/SearchResult.php +++ b/includes/search/SearchResult.php @@ -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 ) { diff --git a/includes/search/SearchResultSet.php b/includes/search/SearchResultSet.php index 3d3b4460bdf..92e2a17d6d6 100644 --- a/includes/search/SearchResultSet.php +++ b/includes/search/SearchResultSet.php @@ -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 []; diff --git a/includes/search/SqlSearchResultSet.php b/includes/search/SqlSearchResultSet.php index 022dc0a6437..31ac83b688f 100644 --- a/includes/search/SqlSearchResultSet.php +++ b/includes/search/SqlSearchResultSet.php @@ -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; diff --git a/includes/widget/search/FullSearchResultWidget.php b/includes/widget/search/FullSearchResultWidget.php index 66fc030ca4f..4d246e45e33 100644 --- a/includes/widget/search/FullSearchResultWidget.php +++ b/includes/widget/search/FullSearchResultWidget.php @@ -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 */ diff --git a/includes/widget/search/InterwikiSearchResultWidget.php b/includes/widget/search/InterwikiSearchResultWidget.php index 095c30a6294..745bc12c61f 100644 --- a/includes/widget/search/InterwikiSearchResultWidget.php +++ b/includes/widget/search/InterwikiSearchResultWidget.php @@ -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 */ diff --git a/includes/widget/search/SearchResultWidget.php b/includes/widget/search/SearchResultWidget.php index 3fbdbef2a92..4f0a271e5b9 100644 --- a/includes/widget/search/SearchResultWidget.php +++ b/includes/widget/search/SearchResultWidget.php @@ -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 */ diff --git a/includes/widget/search/SimpleSearchResultWidget.php b/includes/widget/search/SimpleSearchResultWidget.php index 552cbaf8bad..86a04b18390 100644 --- a/includes/widget/search/SimpleSearchResultWidget.php +++ b/includes/widget/search/SimpleSearchResultWidget.php @@ -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 */ diff --git a/languages/Language.php b/languages/Language.php index 4e663c250c0..9d7ce091252 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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 diff --git a/languages/classes/LanguageZh.php b/languages/classes/LanguageZh.php index 455678d2087..9b9720d7a80 100644 --- a/languages/classes/LanguageZh.php +++ b/languages/classes/LanguageZh.php @@ -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 );