Add null to @return tags if a method can return null
[lhc/web/wiklou.git] / includes / search / SearchResult.php
index 1d28691..7bfcd45 100644 (file)
@@ -61,35 +61,6 @@ class SearchResult {
                return $result;
        }
 
-       /**
-        * Return a new SearchResult and initializes it with a row.
-        *
-        * @param object $row
-        * @return SearchResult
-        */
-       public static function newFromRow( $row ) {
-               $result = new self();
-               $result->initFromRow( $row );
-               return $result;
-       }
-
-       public function __construct( $row = null ) {
-               if ( !is_null( $row ) ) {
-                       // Backwards compatibility with pre-1.17 callers
-                       $this->initFromRow( $row );
-               }
-       }
-
-       /**
-        * Initialize from a database row. Makes a Title and passes that to
-        * initFromTitle.
-        *
-        * @param object $row
-        */
-       protected function initFromRow( $row ) {
-               $this->initFromTitle( Title::makeTitle( $row->page_namespace, $row->page_title ) );
-       }
-
        /**
         * Initialize from a Title and if possible initializes a corresponding
         * Revision and File.
@@ -100,7 +71,7 @@ class SearchResult {
                $this->mTitle = $title;
                if ( !is_null( $this->mTitle ) ) {
                        $id = false;
-                       wfRunHooks( 'SearchResultInitFromTitle', array( $title, &$id ) );
+                       Hooks::run( 'SearchResultInitFromTitle', array( $title, &$id ) );
                        $this->mRevision = Revision::newFromTitle(
                                $this->mTitle, $id, Revision::READ_NORMAL );
                        if ( $this->mTitle->getNamespace() === NS_FILE ) {
@@ -194,7 +165,7 @@ class SearchResult {
        }
 
        /**
-        * @return Title Title object for the redirect to this page, null if none or not supported
+        * @return Title|null Title object for the redirect to this page, null if none or not supported
         */
        function getRedirectTitle() {
                return null;
@@ -208,12 +179,19 @@ class SearchResult {
        }
 
        /**
-        * @return Title Title object (pagename+fragment) for the section, null if none or not supported
+        * @return Title|null Title object (pagename+fragment) for the section, null if none or not supported
         */
        function getSectionTitle() {
                return null;
        }
 
+       /**
+        * @return string Highlighted relevant category name or '' if none or not supported
+        */
+       public function getCategorySnippet() {
+               return '';
+       }
+
        /**
         * @return string Timestamp
         */
@@ -242,13 +220,6 @@ class SearchResult {
                return strlen( $this->mText );
        }
 
-       /**
-        * @return bool If hit has related articles
-        */
-       function hasRelated() {
-               return false;
-       }
-
        /**
         * @return string Interwiki prefix of the title (return iw even if title is broken)
         */