Merge "Perform a permission check on the title when changing the page language"
[lhc/web/wiklou.git] / includes / search / SearchExactMatchRescorer.php
index 0ff628d..0e99ba9 100644 (file)
@@ -35,13 +35,13 @@ class SearchExactMatchRescorer {
         * to not be in the results or be lower down the list.
         * @param string $search the query
         * @param int[] $namespaces the namespaces
-        * @param int $limit the max number of results to return
         * @param string[] $srchres results
+        * @param int $limit the max number of results to return
         * @return string[] munged results
         */
        public function rescore( $search, $namespaces, $srchres, $limit ) {
                // Pick namespace (based on PrefixSearch::defaultSearchBackend)
-               $ns = in_array( NS_MAIN, $namespaces ) ? NS_MAIN : $namespaces[0];
+               $ns = in_array( NS_MAIN, $namespaces ) ? NS_MAIN : reset( $namespaces );
                $t = Title::newFromText( $search, $ns );
                if ( !$t || !$t->exists() ) {
                        // No exact match so just return the search results
@@ -101,7 +101,7 @@ class SearchExactMatchRescorer {
         *   that is a redirect to it.
         */
        private function redirectTargetsToRedirect( $titles ) {
-               $result = array();
+               $result = [];
                foreach ( $titles as $key => $titleText ) {
                        $title = Title::newFromText( $titleText );
                        if ( !$title || !$title->isRedirect() ) {