* Return a new SearchResult and initializes it with a title.
*
* @param Title $title
- * @param SearchResultSet $parentSet
+ * @param SearchResultSet|null $parentSet
* @return SearchResult
*/
public static function newFromTitle( $title, SearchResultSet $parentSet = null ) {
*/
protected function initFromTitle( $title ) {
$this->mTitle = $title;
+ $services = MediaWikiServices::getInstance();
if ( !is_null( $this->mTitle ) ) {
$id = false;
Hooks::run( 'SearchResultInitFromTitle', [ $title, &$id ] );
$this->mRevision = Revision::newFromTitle(
$this->mTitle, $id, Revision::READ_NORMAL );
if ( $this->mTitle->getNamespace() === NS_FILE ) {
- $this->mImage = wfFindFile( $this->mTitle );
+ $this->mImage = $services->getRepoGroup()->findFile( $this->mTitle );
}
}
- $this->searchEngine = MediaWikiServices::getInstance()->newSearchEngine();
+ $this->searchEngine = $services->newSearchEngine();
}
/**
}
/**
- * @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 ) {
if ( $extensionData instanceof Closure ) {
$this->extensionData = $extensionData;
} elseif ( is_array( $extensionData ) ) {
- wfDeprecated( __METHOD__ . ' with array argument', 1.32 );
+ wfDeprecated( __METHOD__ . ' with array argument', '1.32' );
$this->extensionData = function () use ( $extensionData ) {
return $extensionData;
};