Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/322236

Change subject: Remove unused imports and unused code
......................................................................

Remove unused imports and unused code

Change-Id: I2cf48f01a01a4034639a3fec47ba180508ece85d
---
M includes/Api/SuggestIndex.php
M includes/BuildDocument/RedirectsAndIncomingLinks.php
M includes/DataSender.php
M includes/InterwikiSearcher.php
M includes/LanguageDetector/Detector.php
M includes/Maintenance/MappingConfigBuilder.php
M includes/Query/FileNumericFeature.php
M includes/Query/FileTypeFeature.php
M includes/RequestLogger.php
M includes/Sanity/Checker.php
M includes/Search/BooleanIndexField.php
M includes/Search/CirrusIndexField.php
M includes/Search/DatetimeIndexField.php
M includes/Search/Filters.php
M includes/Search/IntegerIndexField.php
M includes/Search/KeywordIndexField.php
M includes/Search/NestedIndexField.php
M includes/Search/NumberIndexField.php
M includes/Search/OpeningTextIndexField.php
A includes/Search/SearchTextQueryBuilders.php
M includes/Search/ShortTextIndexField.php
M includes/Search/SourceTextIndexField.php
M includes/Search/TextIndexField.php
M includes/Searcher.php
M includes/SiteMatrixInterwikiResolver.php
M maintenance/dumpIndex.php
M maintenance/saneitizeJobs.php
M maintenance/updateOneSearchIndexConfig.php
M maintenance/updateVersionIndex.php
M tests/jenkins/Jenkins.php
M tests/unit/ConnectionTest.php
M tests/unit/HooksTest.php
M tests/unit/InterwikiSearcherTest.php
M tests/unit/Maintenance/AnalysisConfigBuilderTest.php
M tests/unit/Query/GeoFeatureTest.php
M tests/unit/RequestLoggerTest.php
M tests/unit/UtilTest.php
37 files changed, 225 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/36/322236/1

diff --git a/includes/Api/SuggestIndex.php b/includes/Api/SuggestIndex.php
index 8bd005f..31fe236 100644
--- a/includes/Api/SuggestIndex.php
+++ b/includes/Api/SuggestIndex.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Api;
 
 /**
diff --git a/includes/BuildDocument/RedirectsAndIncomingLinks.php 
b/includes/BuildDocument/RedirectsAndIncomingLinks.php
index cb46135..80a4ead 100644
--- a/includes/BuildDocument/RedirectsAndIncomingLinks.php
+++ b/includes/BuildDocument/RedirectsAndIncomingLinks.php
@@ -107,6 +107,7 @@
                $redirectTitles = $title->getBacklinkCache()
                        ->getLinks( 'redirect', false, false, 
$wgCirrusSearchIndexedRedirects );
                $redirects = [];
+               /** @var Title $redirect */
                foreach ( $redirectTitles as $redirect ) {
                        // If the redirect is in main OR the same namespace as 
the article the index it
                        if ( $redirect->getNamespace() === NS_MAIN || 
$redirect->getNamespace() === $title->getNamespace()) {
diff --git a/includes/DataSender.php b/includes/DataSender.php
index 034b299..12ec9dd 100644
--- a/includes/DataSender.php
+++ b/includes/DataSender.php
@@ -305,7 +305,7 @@
                                        'send_data_other_idx_write'
                                ) );
                                $bulk->send();
-                       } catch ( \Elastica\Exception\Bulk\ResponseException $e 
) {
+                       } catch ( ResponseException $e ) {
                                if ( 
!$this->bulkResponseExceptionIsJustDocumentMissing( $e ) ) {
                                        $exception = $e;
                                }
diff --git a/includes/InterwikiSearcher.php b/includes/InterwikiSearcher.php
index 07f9bf4..2f3ea45 100644
--- a/includes/InterwikiSearcher.php
+++ b/includes/InterwikiSearcher.php
@@ -4,9 +4,7 @@
 
 use CirrusSearch\Search\InterwikiResultsType;
 use CirrusSearch\Search\ResultSet;
-use ObjectCache;
 use SpecialPageFactory;
-use Title;
 use User;
 
 /**
@@ -32,11 +30,6 @@
         * @var int Max number of results to fetch from other wiki
         */
        const MAX_RESULTS = 5;
-
-       /**
-        * @var string interwiki prefix
-        */
-       private $interwiki;
 
        /**
         * @var bool Is the interwiki load test configured?
diff --git a/includes/LanguageDetector/Detector.php 
b/includes/LanguageDetector/Detector.php
index 2493578..3cd705b 100644
--- a/includes/LanguageDetector/Detector.php
+++ b/includes/LanguageDetector/Detector.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\LanguageDetector;
 
 use CirrusSearch;
diff --git a/includes/Maintenance/MappingConfigBuilder.php 
b/includes/Maintenance/MappingConfigBuilder.php
index ba3dc82..7b8eded 100644
--- a/includes/Maintenance/MappingConfigBuilder.php
+++ b/includes/Maintenance/MappingConfigBuilder.php
@@ -82,8 +82,6 @@
         * @return array
         */
        private function getDefaultFields( $flags ) {
-               global $wgCirrusSearchWikimediaExtraPlugin;
-
                // Note never to set something as type='object' here because 
that isn't returned by elasticsearch
                // and is inferred anyway.
                $titleExtraAnalyzers = [
diff --git a/includes/Query/FileNumericFeature.php 
b/includes/Query/FileNumericFeature.php
index 75c2eec..1789155 100644
--- a/includes/Query/FileNumericFeature.php
+++ b/includes/Query/FileNumericFeature.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Query;
 
 use CirrusSearch\Search\SearchContext;
diff --git a/includes/Query/FileTypeFeature.php 
b/includes/Query/FileTypeFeature.php
index de8a7ce..e46940f 100644
--- a/includes/Query/FileTypeFeature.php
+++ b/includes/Query/FileTypeFeature.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Query;
 
 use CirrusSearch\Search\SearchContext;
diff --git a/includes/RequestLogger.php b/includes/RequestLogger.php
index 03e7b4c..f3c2389 100644
--- a/includes/RequestLogger.php
+++ b/includes/RequestLogger.php
@@ -6,7 +6,6 @@
 use MediaWiki\Logger\LoggerFactory;
 use RequestContext;
 use SearchResultSet;
-use Title;
 use User;
 
 /**
diff --git a/includes/Sanity/Checker.php b/includes/Sanity/Checker.php
index 9e805d8..014392e 100644
--- a/includes/Sanity/Checker.php
+++ b/includes/Sanity/Checker.php
@@ -107,7 +107,6 @@
                                $fromIndex = $pagesFromIndex[$docId];
                        }
 
-                       $updated = false;
                        if ( isset ( $pagesFromDb[$pageId] ) ) {
                                $page = $pagesFromDb[$pageId];
                                $updated = $this->checkExisitingPage( $docId, 
$pageId, $page, $fromIndex );
diff --git a/includes/Search/BooleanIndexField.php 
b/includes/Search/BooleanIndexField.php
index 1a01edf..8e6a13d 100644
--- a/includes/Search/BooleanIndexField.php
+++ b/includes/Search/BooleanIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 /**
diff --git a/includes/Search/CirrusIndexField.php 
b/includes/Search/CirrusIndexField.php
index 240167d..88aa10f 100644
--- a/includes/Search/CirrusIndexField.php
+++ b/includes/Search/CirrusIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 use SearchEngine;
diff --git a/includes/Search/DatetimeIndexField.php 
b/includes/Search/DatetimeIndexField.php
index ba2a496..3ee7cdd 100644
--- a/includes/Search/DatetimeIndexField.php
+++ b/includes/Search/DatetimeIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 use SearchEngine;
diff --git a/includes/Search/Filters.php b/includes/Search/Filters.php
index 63c30d1..2507d56 100644
--- a/includes/Search/Filters.php
+++ b/includes/Search/Filters.php
@@ -92,7 +92,7 @@
                        return $nonScript;
                }
 
-               $bool = new \Elastica\Query\BoolQuery();
+               $bool = new BoolQuery();
                if ( $nonScript === null ) {
                        if ( $scriptFiltersCount === 1 ) {
                                return $scriptFilters[ 0 ];
@@ -124,7 +124,7 @@
                if ( $mustFilterCount === 1 && $mustNotFilterCount == 0 ) {
                        return $mustFilters[ 0 ];
                }
-               $bool = new \Elastica\Query\BoolQuery();
+               $bool = new BoolQuery();
                foreach ( $mustFilters as $must ) {
                        $bool->addMust( $must );
                }
diff --git a/includes/Search/IntegerIndexField.php 
b/includes/Search/IntegerIndexField.php
index 748a94f..592e619 100644
--- a/includes/Search/IntegerIndexField.php
+++ b/includes/Search/IntegerIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 /**
diff --git a/includes/Search/KeywordIndexField.php 
b/includes/Search/KeywordIndexField.php
index dd672fa..d96fe7d 100644
--- a/includes/Search/KeywordIndexField.php
+++ b/includes/Search/KeywordIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 /**
diff --git a/includes/Search/NestedIndexField.php 
b/includes/Search/NestedIndexField.php
index 21bbcdc..68f996c 100644
--- a/includes/Search/NestedIndexField.php
+++ b/includes/Search/NestedIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 use SearchIndexField;
diff --git a/includes/Search/NumberIndexField.php 
b/includes/Search/NumberIndexField.php
index f391aae..1020c1a 100644
--- a/includes/Search/NumberIndexField.php
+++ b/includes/Search/NumberIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 /**
diff --git a/includes/Search/OpeningTextIndexField.php 
b/includes/Search/OpeningTextIndexField.php
index 0c9116c..9ffab54 100644
--- a/includes/Search/OpeningTextIndexField.php
+++ b/includes/Search/OpeningTextIndexField.php
@@ -1,7 +1,6 @@
 <?php
-namespace CirrusSearch\Search;
 
-use CirrusSearch\Search\TextIndexField;
+namespace CirrusSearch\Search;
 
 /**
  * Simple TextIndexField subclass useful to customize COPY_TO_SUGGEST
diff --git a/includes/Search/SearchTextQueryBuilders.php 
b/includes/Search/SearchTextQueryBuilders.php
new file mode 100644
index 0000000..e3fb90d
--- /dev/null
+++ b/includes/Search/SearchTextQueryBuilders.php
@@ -0,0 +1,196 @@
+<?php
+
+namespace CirrusSearch\Search;
+
+/**
+ * Set of builders to construct the full text search query.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/**
+ * Factory of SearchTextQueryBuilder.
+ * Maintains all the SearchTextQueryBuilder designed to
+ * write the main full text query.
+ */
+class SearchTextQueryBuilderFactory {
+       /**
+        * @var SearchTextQueryBuilder[]
+        */
+       private $builders = array();
+
+       /**
+        * @var SearchContext
+        */
+       private $context;
+
+       public function __construct( SearchContext $context ) {
+               $this->context = $context;
+               $this->builders[] = new SearchTextQueryStringBuilder( $context 
);
+       }
+
+       /**
+        * Returns the best builder for this query.
+        *
+        * @param string $queryString the query without special syntax
+        * @return SearchTextQueryBuilder
+        */
+       public function getBuilder( $queryString ) {
+               foreach( $this->builders as $builder ) {
+                       if( $builder->accept( $queryString ) ) {
+                               return $builder;
+                       }
+               }
+
+               throw new \Exception( "BUG: no query builder found for 
$queryString " );
+       }
+}
+
+/**
+ * Builds a full text search query
+ */
+interface SearchTextQueryBuilder {
+       /**
+        * Builds the main query
+        *
+        * @param string[] $fields of string encoded as field_name^boost_value
+        * @param string $queryString the query
+        * @param integer $phraseSlop the phrase slop to use for phrase queries
+        * @return \Elastica\Query\AbstractQuery the query
+        */
+       public function buildMainQuery( array $fields, $queryString, 
$phraseSlop );
+
+       /**
+        * Builds the query used in the rescore phase
+        *
+        * @param string[] $fields of string encoded as field_name^boost_value
+        * @param string $queryString the query
+        * @param integer $phraseSlop the phrase slop to use for phrase queries
+        * @return \Elastica\Query\AbstractQuery the query
+        */
+       public function buildRescoreQuery( array $fields, $queryString, 
$phraseSlop );
+
+       /**
+        * Builds the query for highlighting
+        *
+        * @param string[] $fields of string encoded as field_name^boost_value
+        * @param string $queryString the query
+        * @param integer $phraseSlop the phrase slop to use for phrase queries
+        * @return \Elastica\Query\AbstractQuery the query
+        */
+       public function buildHighlightQuery( array $fields, $queryString, 
$phraseSlop );
+
+
+       /**
+        * Check if the query can be built by this builder
+        *
+        * @param string $queryString the query
+        * @return boolean true if this query can be built by this builder
+        */
+       public function accept( $queryString );
+}
+
+/**
+ * Base query builder
+ */
+abstract class SearchTextBaseQueryBuilder implements SearchTextQueryBuilder {
+       /**
+        * @var SearchContext
+        */
+       protected $context;
+
+       /**
+        * @param SearchContext $context
+        */
+       public function __construct( SearchContext $context ) {
+               $this->context = $context;
+       }
+}
+
+/**
+ * Builds the query using the QueryString, this is the default builder
+ * used by cirrus and uses a default AND between clause.
+ * The query 'the query' and the fields all and all.plain will be like
+ * (all:the OR all.plain:the) AND (all:query OR all.plain:query)
+ */
+class SearchTextQueryStringBuilder extends SearchTextBaseQueryBuilder {
+       /**
+        * This builder will always return true.
+        *
+        * @param string $queryString
+        * @return bool
+        */
+       public function accept( $queryString ) {
+               return true;
+       }
+
+       /**
+        * @param string[] $fields
+        * @param string $queryString
+        * @param int $phraseSlop
+        * @return \Elastica\Query\AbstractQuery
+        */
+       public function buildMainQuery( array $fields, $queryString, 
$phraseSlop ) {
+               return $this->buildQueryString( $fields, $queryString, 
$phraseSlop );
+       }
+
+       /**
+        * @param string[] $fields
+        * @param string $queryString
+        * @param int $phraseSlop
+        * @return \Elastica\Query\AbstractQuery
+        */
+       public function buildHighlightQuery( array $fields, $queryString, 
$phraseSlop ) {
+               return $this->buildQueryString( $fields, $queryString, 
$phraseSlop );
+       }
+
+       /**
+        * @param string[] $fields
+        * @param string $queryString
+        * @param int $phraseSlop
+        * @return \Elastica\Query\AbstractQuery
+        */
+       public function buildRescoreQuery( array $fields, $queryString, 
$phraseSlop ) {
+               return $this->buildQueryString( $fields, $queryString, 
$phraseSlop );
+       }
+
+       /**
+        * Builds a query based on QueryString syntax
+        *
+        * @param string[] $fields the fields
+        * @param string $queryString the query
+        * @param integer $phraseSlop phrase slop
+        * @param string $defaultOperator the default operator AND or OR
+        * @return \Elastica\Query\QueryString
+        */
+       public function buildQueryString( array $fields, $queryString, 
$phraseSlop, $defaultOperator = 'AND' ) {
+               $query = new \Elastica\Query\QueryString( $queryString );
+               $query->setFields( $fields );
+               $query->setAutoGeneratePhraseQueries( true );
+               $query->setPhraseSlop( $phraseSlop );
+               $query->setDefaultOperator( $defaultOperator );
+               $query->setAllowLeadingWildcard( 
$this->context->isAllowLeadingWildcards() );
+               $query->setFuzzyPrefixLength( 2 );
+               $query->setRewrite( 'top_terms_boost_1024' );
+               $states = $this->context->getConfig()->get( 
'CirrusSearchQueryStringMaxDeterminizedStates' );
+               if ( isset( $states ) ) {
+                       // Requires ES 1.4+
+                       $query->setParam( 'max_determinized_states', $states );
+               }
+               return $query;
+       }
+
+}
diff --git a/includes/Search/ShortTextIndexField.php 
b/includes/Search/ShortTextIndexField.php
index c6b8c09..a2b7538 100644
--- a/includes/Search/ShortTextIndexField.php
+++ b/includes/Search/ShortTextIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 /**
diff --git a/includes/Search/SourceTextIndexField.php 
b/includes/Search/SourceTextIndexField.php
index d40f397..765e6bd 100644
--- a/includes/Search/SourceTextIndexField.php
+++ b/includes/Search/SourceTextIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 use CirrusSearch\SearchConfig;
diff --git a/includes/Search/TextIndexField.php 
b/includes/Search/TextIndexField.php
index bffd813..45b8b79 100644
--- a/includes/Search/TextIndexField.php
+++ b/includes/Search/TextIndexField.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Search;
 
 use CirrusSearch\Maintenance\MappingConfigBuilder;
diff --git a/includes/Searcher.php b/includes/Searcher.php
index cd3f333..da0c036 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -14,7 +14,6 @@
 use ObjectCache;
 use SearchResultSet;
 use Status;
-use Title;
 use ApiUsageException;
 use UsageException;
 use User;
diff --git a/includes/SiteMatrixInterwikiResolver.php 
b/includes/SiteMatrixInterwikiResolver.php
index c1c26b9..81a8cb1 100644
--- a/includes/SiteMatrixInterwikiResolver.php
+++ b/includes/SiteMatrixInterwikiResolver.php
@@ -2,9 +2,9 @@
 
 namespace CirrusSearch;
 
-use \CachedBagOStuff;
 use \ObjectCache;
 use \SiteMatrix;
+use MediaWiki\MediaWikiServices;
 
 /**
  * InterwikiResolver suited for WMF context and uses SiteMatrix.
@@ -15,7 +15,6 @@
 
        private $config;
        private $cache;
-       private $matrix;
 
        /**
         * @param SearchConfig $config
@@ -74,9 +73,9 @@
                        global $wgConf;
 
                        $matrix = new \SiteMatrix;
-                       $iwLookup = 
\MediaWiki\MediaWikiServices::getInstance()->getInterwikiLookup();
+                       $iwLookup = 
MediaWikiServices::getInstance()->getInterwikiLookup();
                        $wikiDBname = $this->config->get( 'DBname' );
-                       list( $_, $myLang ) = $wgConf->siteFromDB( $wikiDBname 
);
+                       list( , $myLang ) = $wgConf->siteFromDB( $wikiDBname );
                        $siteConf = $this->config->get( 'SiteMatrixSites' );
                        $sisterProjects = [];
                        $crossLanguage = [];
diff --git a/maintenance/dumpIndex.php b/maintenance/dumpIndex.php
index efc1083..0969b31 100644
--- a/maintenance/dumpIndex.php
+++ b/maintenance/dumpIndex.php
@@ -4,7 +4,6 @@
 
 use CirrusSearch\SearchConfig;
 use Elastica;
-use Elastica\Filter;
 use Elastica\Index;
 use Elastica\JSON;
 use Elastica\Query;
diff --git a/maintenance/saneitizeJobs.php b/maintenance/saneitizeJobs.php
index dc458ca..308e337 100644
--- a/maintenance/saneitizeJobs.php
+++ b/maintenance/saneitizeJobs.php
@@ -5,7 +5,7 @@
 use CirrusSearch\Connection;
 use CirrusSearch\SearchConfig;
 use CirrusSearch\Job\CheckerJob;
-use CirrusSearch\Maintenance\Maintenance;
+
 use JobQueueGroup;
 
 /**
@@ -49,11 +49,6 @@
         * @var int max page id (from db)
         */
        private $maxId;
-
-       /**
-        * @var SearchConfig
-        */
-       private $config;
 
        /**
         * @var string profile name
diff --git a/maintenance/updateOneSearchIndexConfig.php 
b/maintenance/updateOneSearchIndexConfig.php
index 950323f..b2c5e5f 100644
--- a/maintenance/updateOneSearchIndexConfig.php
+++ b/maintenance/updateOneSearchIndexConfig.php
@@ -4,7 +4,6 @@
 
 use CirrusSearch\Connection;
 use CirrusSearch\ElasticaErrorHandler;
-use CirrusSearch\Maintenance\Metastore;
 use CirrusSearch\SearchConfig;
 use CirrusSearch\Util;
 use Elastica;
diff --git a/maintenance/updateVersionIndex.php 
b/maintenance/updateVersionIndex.php
index a557eed..c100eaf 100644
--- a/maintenance/updateVersionIndex.php
+++ b/maintenance/updateVersionIndex.php
@@ -2,7 +2,6 @@
 
 namespace CirrusSearch\Maintenance;
 
-use CirrusSearch\Maintenance\Metastore;
 use CirrusSearch\SearchConfig;
 
 /**
diff --git a/tests/jenkins/Jenkins.php b/tests/jenkins/Jenkins.php
index 5efc300..e42b378 100644
--- a/tests/jenkins/Jenkins.php
+++ b/tests/jenkins/Jenkins.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Jenkins;
 
 use DatabaseUpdater;
diff --git a/tests/unit/ConnectionTest.php b/tests/unit/ConnectionTest.php
index 405c69d..5709e33 100644
--- a/tests/unit/ConnectionTest.php
+++ b/tests/unit/ConnectionTest.php
@@ -3,7 +3,6 @@
 namespace CirrusSearch;
 
 use CirrusSearch\Test\HashSearchConfig;
-use PHPUnit_Framework_TestCase;
 
 /**
  * Make sure cirrus doens't break any hooks.
diff --git a/tests/unit/HooksTest.php b/tests/unit/HooksTest.php
index 0b1bc5b..0cfd9ff 100644
--- a/tests/unit/HooksTest.php
+++ b/tests/unit/HooksTest.php
@@ -2,8 +2,6 @@
 
 namespace CirrusSearch;
 
-use PHPUnit_Framework_TestCase;
-
 /**
  * Make sure cirrus doens't break any hooks.
  *
diff --git a/tests/unit/InterwikiSearcherTest.php 
b/tests/unit/InterwikiSearcherTest.php
index 28ac67c..c746bd8 100644
--- a/tests/unit/InterwikiSearcherTest.php
+++ b/tests/unit/InterwikiSearcherTest.php
@@ -58,7 +58,6 @@
                                        // bulk calls are two at a time
                                        $newCalls /= 2;
                                }
-                               $fixture = ['total' => 0, 'hits' => []];
                                $calls += $newCalls;
                                return new \Elastica\Response( json_encode( [
                                        'responses' => array_fill(0, $newCalls, 
['total' => 0, 'hits' => []])
diff --git a/tests/unit/Maintenance/AnalysisConfigBuilderTest.php 
b/tests/unit/Maintenance/AnalysisConfigBuilderTest.php
index ed439ba..d8d3252 100644
--- a/tests/unit/Maintenance/AnalysisConfigBuilderTest.php
+++ b/tests/unit/Maintenance/AnalysisConfigBuilderTest.php
@@ -1,4 +1,5 @@
 <?php
+
 namespace CirrusSearch\Tests\Maintenance;
 
 use CirrusSearch\Maintenance\AnalysisConfigBuilder;
diff --git a/tests/unit/Query/GeoFeatureTest.php 
b/tests/unit/Query/GeoFeatureTest.php
index 891d411..126657c 100644
--- a/tests/unit/Query/GeoFeatureTest.php
+++ b/tests/unit/Query/GeoFeatureTest.php
@@ -91,7 +91,7 @@
        public function testParseDistance( $expected, $distance ) {
                if ( class_exists( Coord::class ) ) {
                        $feature = new GeoFeature();
-                       $this->assertEquals( $expected, 
$feature->parseDistance( $distance, 5000 ) );
+                       $this->assertEquals( $expected, 
$feature->parseDistance( $distance ) );
                } else {
                        $this->markTestSkipped( 'GeoData extension must be 
installed' );
                }
diff --git a/tests/unit/RequestLoggerTest.php b/tests/unit/RequestLoggerTest.php
index 14e1d4a..b8231eb 100644
--- a/tests/unit/RequestLoggerTest.php
+++ b/tests/unit/RequestLoggerTest.php
@@ -24,7 +24,8 @@
  */
 class RequestLoggerTest extends CirrusTestCase {
        public function requestLoggingProvider() {
-               $test = [];
+               $tests = [];
+
                foreach ( glob( __DIR__ . "/fixtures/requestLogging/*.request" 
) as $requestFile ) {
                        $testBase = substr( $requestFile, 0, -8 );
                        $testName = basename( $testBase );
diff --git a/tests/unit/UtilTest.php b/tests/unit/UtilTest.php
index 7ade371..878e797 100644
--- a/tests/unit/UtilTest.php
+++ b/tests/unit/UtilTest.php
@@ -162,7 +162,7 @@
                        'wgMainCacheType' => 'UtilTest',
                        'wgObjectCaches' => [ 'UtilTest' => [ 'class' => 
\HashBagOStuff::class ] ]
                ] );
-               $services = \MediaWiki\MediaWikiServices::getInstance();
+               $services = MediaWikiServices::getInstance();
                if ( method_exists( $services, 'getLocalClusterObjectCache' ) ) 
{
                        $services->resetServiceForTesting( 
'LocalClusterObjectCache' );
                        $services->redefineService( 'LocalClusterObjectCache', 
function () {

-- 
To view, visit https://gerrit.wikimedia.org/r/322236
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cf48f01a01a4034639a3fec47ba180508ece85d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to