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

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

Change subject: Optimize all use sections in Repo
......................................................................

Optimize all use sections in Repo

Stuff that's not in a namespace needs the backslash and can not
be added to the use section because PHPStorm thinks it can remove
this. Yes, that's probably a bug in PHPStorm but since multiple
team members use it it's much easier to just do it as I did here
than to wait for a bugfix.

Change-Id: I8fa5b47b9c18d621cb964e7200b187b5e2d09bab
---
M repo/maintenance/dumpJson.php
M repo/maintenance/importProperties.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php
M repo/tests/phpunit/includes/Diff/ClaimDifferTest.php
M repo/tests/phpunit/includes/Diff/DiffViewTest.php
M repo/tests/phpunit/includes/ItemDisambiguationTest.php
M repo/tests/phpunit/includes/ItemMoveTest.php
M repo/tests/phpunit/includes/ItemSearchTextGeneratorTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
M repo/tests/phpunit/includes/ParserOutputJsConfigBuilderTest.php
M repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
M repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
M repo/tests/phpunit/includes/View/SiteLinksViewTest.php
M repo/tests/phpunit/includes/actions/EditEntityActionTest.php
M repo/tests/phpunit/includes/api/ApiErrorReporterTest.php
M repo/tests/phpunit/includes/api/ApiModuleTestHelper.php
M repo/tests/phpunit/includes/api/ApiXmlFormatTest.php
M repo/tests/phpunit/includes/api/AvailableBadgesTest.php
M repo/tests/phpunit/includes/api/BotEditTest.php
M repo/tests/phpunit/includes/api/IntegrationApiTest.php
M repo/tests/phpunit/includes/api/WikibaseApiTestCase.php
M repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
22 files changed, 23 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/97/172997/1

diff --git a/repo/maintenance/dumpJson.php b/repo/maintenance/dumpJson.php
index 3e00b25..7996a46 100644
--- a/repo/maintenance/dumpJson.php
+++ b/repo/maintenance/dumpJson.php
@@ -15,10 +15,10 @@
 use Wikibase\Lib\Serializers\Serializer;
 use Wikibase\Lib\Serializers\SerializerFactory;
 use Wikibase\Lib\Store\EntityLookup;
-use Wikibase\Repo\Store\SQL\EntityPerPageIdPager;
 use Wikibase\Repo\IO\EntityIdReader;
 use Wikibase\Repo\IO\LineReader;
 use Wikibase\Repo\Store\EntityIdPager;
+use Wikibase\Repo\Store\SQL\EntityPerPageIdPager;
 use Wikibase\Repo\WikibaseRepo;
 
 $basePath = getenv( 'MW_INSTALL_PATH' ) !== false ? getenv( 'MW_INSTALL_PATH' 
) : __DIR__ . '/../../../..';
diff --git a/repo/maintenance/importProperties.php 
b/repo/maintenance/importProperties.php
index cfd9db9..9f185f3 100644
--- a/repo/maintenance/importProperties.php
+++ b/repo/maintenance/importProperties.php
@@ -1,8 +1,8 @@
 <?php
 
 use Wikibase\DataModel\Entity\Property;
-use Wikibase\Repo\WikibaseRepo;
 use Wikibase\Lib\Store\EntityStore;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * Maintenance script for importing properties in Wikidata.
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php
index 3c80b0c..f846cf2 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php
@@ -4,11 +4,9 @@
 
 use DataValues\NumberValue;
 use DataValues\StringValue;
-use InvalidArgumentException;
 use Wikibase\ChangeOp\ChangeOpClaim;
 use Wikibase\DataModel\Claim\Claim;
 use Wikibase\DataModel\Claim\ClaimGuidParser;
-use Wikibase\DataModel\Claim\Claims;
 use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
diff --git a/repo/tests/phpunit/includes/Diff/ClaimDifferTest.php 
b/repo/tests/phpunit/includes/Diff/ClaimDifferTest.php
index aa0760f..ffa9c43 100644
--- a/repo/tests/phpunit/includes/Diff/ClaimDifferTest.php
+++ b/repo/tests/phpunit/includes/Diff/ClaimDifferTest.php
@@ -3,11 +3,11 @@
 namespace Wikibase\Test;
 
 use Diff\Comparer\ComparableComparer;
+use Diff\Differ\OrderedListDiffer;
 use Diff\DiffOp\Diff\Diff;
 use Diff\DiffOp\DiffOpAdd;
 use Diff\DiffOp\DiffOpChange;
 use Diff\DiffOp\DiffOpRemove;
-use Diff\Differ\OrderedListDiffer;
 use Wikibase\DataModel\Claim\Claim;
 use Wikibase\DataModel\ReferenceList;
 use Wikibase\DataModel\Snak\PropertyNoValueSnak;
diff --git a/repo/tests/phpunit/includes/Diff/DiffViewTest.php 
b/repo/tests/phpunit/includes/Diff/DiffViewTest.php
index 54ca345..0a86d48 100644
--- a/repo/tests/phpunit/includes/Diff/DiffViewTest.php
+++ b/repo/tests/phpunit/includes/Diff/DiffViewTest.php
@@ -6,7 +6,6 @@
 use Diff\DiffOp\DiffOpAdd;
 use Diff\DiffOp\DiffOpChange;
 use Diff\DiffOp\DiffOpRemove;
-use RequestContext;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\Repo\Diff\DiffView;
diff --git a/repo/tests/phpunit/includes/ItemDisambiguationTest.php 
b/repo/tests/phpunit/includes/ItemDisambiguationTest.php
index 3cfb8d8..bff2974 100644
--- a/repo/tests/phpunit/includes/ItemDisambiguationTest.php
+++ b/repo/tests/phpunit/includes/ItemDisambiguationTest.php
@@ -7,7 +7,6 @@
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\ItemDisambiguation;
 use Wikibase\Lib\EntityIdFormatter;
-use MediaWikiTestCase;
 
 /**
  * @covers Wikibase\ItemDisambiguation
@@ -121,7 +120,7 @@
                $html = $disambig->getHTML( $items );
 
                foreach ( $matchers as $key => $matcher ) {
-                       MediaWikiTestCase::assertTag( $matcher, $html, "Failed 
to match HTML output with tag '{$key}'" );
+                       \MediaWikiTestCase::assertTag( $matcher, $html, "Failed 
to match HTML output with tag '{$key}'" );
                }
        }
 
diff --git a/repo/tests/phpunit/includes/ItemMoveTest.php 
b/repo/tests/phpunit/includes/ItemMoveTest.php
index 335806a..12f4fcc 100644
--- a/repo/tests/phpunit/includes/ItemMoveTest.php
+++ b/repo/tests/phpunit/includes/ItemMoveTest.php
@@ -2,7 +2,6 @@
 
 namespace Wikibase\Test;
 
-use TestSites;
 use Title;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
@@ -54,7 +53,7 @@
                if ( !$hasSites ) {
                        $sitesTable = 
WikibaseRepo::getDefaultInstance()->getSiteStore();
                        $sitesTable->clear();
-                       $sitesTable->saveSites( TestSites::getSites() );
+                       $sitesTable->saveSites( \TestSites::getSites() );
                        $hasSites = true;
                }
 
@@ -114,4 +113,3 @@
        }
 
 }
-
diff --git a/repo/tests/phpunit/includes/ItemSearchTextGeneratorTest.php 
b/repo/tests/phpunit/includes/ItemSearchTextGeneratorTest.php
index 6325831..efcfa45 100644
--- a/repo/tests/phpunit/includes/ItemSearchTextGeneratorTest.php
+++ b/repo/tests/phpunit/includes/ItemSearchTextGeneratorTest.php
@@ -2,8 +2,8 @@
 
 namespace Wikibase\Test;
 
-use Wikibase\DataModel\SiteLink;
 use Wikibase\DataModel\Entity\Item;
+use Wikibase\DataModel\SiteLink;
 use Wikibase\Repo\ItemSearchTextGenerator;
 
 /**
diff --git a/repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php 
b/repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
index 1eb2dff..5ea49a4 100644
--- a/repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
+++ b/repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
@@ -2,9 +2,9 @@
 
 namespace Wikibase\Test;
 
+use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\EntityRevision;
-use Wikibase\DataModel\Entity\Item;
 use Wikibase\Lib\Store\EntityRedirect;
 
 /**
diff --git a/repo/tests/phpunit/includes/ParserOutputJsConfigBuilderTest.php 
b/repo/tests/phpunit/includes/ParserOutputJsConfigBuilderTest.php
index 60acbfb..83720cd 100644
--- a/repo/tests/phpunit/includes/ParserOutputJsConfigBuilderTest.php
+++ b/repo/tests/phpunit/includes/ParserOutputJsConfigBuilderTest.php
@@ -18,10 +18,8 @@
 use Wikibase\LanguageFallbackChainFactory;
 use Wikibase\Lib\Serializers\SerializationOptions;
 use Wikibase\Lib\Serializers\SerializerFactory;
-use Wikibase\Lib\Store\EntityRedirect;
 use Wikibase\Lib\Store\EntityTitleLookup;
 use Wikibase\ParserOutputJsConfigBuilder;
-use Wikibase\ReferencedEntitiesFinder;
 
 /**
  * @covers Wikibase\ParserOutputJsConfigBuilder
diff --git 
a/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php 
b/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
index 06b36cf..2e83f67 100644
--- a/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
+++ b/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
@@ -2,9 +2,9 @@
 
 namespace Wikibase\Repo\Tests\UpdateRepo;
 
+use Status;
 use Title;
 use User;
-use Status;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\Repo\UpdateRepo\UpdateRepoOnDeleteJob;
diff --git a/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php 
b/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
index f1bc188..49138e9 100644
--- a/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
+++ b/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
@@ -2,9 +2,9 @@
 
 namespace Wikibase\Repo\Tests\UpdateRepo;
 
+use Status;
 use Title;
 use User;
-use Status;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\Repo\UpdateRepo\UpdateRepoOnMoveJob;
diff --git a/repo/tests/phpunit/includes/View/SiteLinksViewTest.php 
b/repo/tests/phpunit/includes/View/SiteLinksViewTest.php
index 45c498f..b6b825f 100644
--- a/repo/tests/phpunit/includes/View/SiteLinksViewTest.php
+++ b/repo/tests/phpunit/includes/View/SiteLinksViewTest.php
@@ -3,7 +3,6 @@
 namespace Wikibase\Test;
 
 use MediaWikiSite;
-use MediaWikiTestCase;
 use SiteList;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\Item;
@@ -11,8 +10,8 @@
 use Wikibase\DataModel\SiteLink;
 use Wikibase\Lib\Store\EntityLookup;
 use Wikibase\Repo\View\SectionEditLinkGenerator;
-use Wikibase\Repo\WikibaseRepo;
 use Wikibase\Repo\View\SiteLinksView;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * @covers Wikibase\Repo\View\SiteLinksView
@@ -60,7 +59,7 @@
 
                $value = $siteLinksView->getHtml( $item->getSiteLinks(), 
$item->getId(), $groups, $editable );
                $this->assertInternalType( 'string', $value );
-               MediaWikiTestCase::assertTag( $expectedValue, $value, $value . 
' did not match ' . var_export( $expectedValue, true ) );
+               \MediaWikiTestCase::assertTag( $expectedValue, $value, $value . 
' did not match ' . var_export( $expectedValue, true ) );
        }
 
        public function getHtmlProvider() {
diff --git a/repo/tests/phpunit/includes/actions/EditEntityActionTest.php 
b/repo/tests/phpunit/includes/actions/EditEntityActionTest.php
index 9f0868e..b512531 100644
--- a/repo/tests/phpunit/includes/actions/EditEntityActionTest.php
+++ b/repo/tests/phpunit/includes/actions/EditEntityActionTest.php
@@ -5,7 +5,6 @@
 use MWException;
 use Title;
 use User;
-use Wikibase\Repo\EntityNamespaceLookup;
 use Wikibase\Repo\WikibaseRepo;
 use WikiPage;
 
diff --git a/repo/tests/phpunit/includes/api/ApiErrorReporterTest.php 
b/repo/tests/phpunit/includes/api/ApiErrorReporterTest.php
index 6396488..aba77b2 100644
--- a/repo/tests/phpunit/includes/api/ApiErrorReporterTest.php
+++ b/repo/tests/phpunit/includes/api/ApiErrorReporterTest.php
@@ -5,7 +5,6 @@
 use ApiMain;
 use DataValues\IllegalValueException;
 use Language;
-use Message;
 use Status;
 use UsageException;
 use ValueParsers\ParseException;
diff --git a/repo/tests/phpunit/includes/api/ApiModuleTestHelper.php 
b/repo/tests/phpunit/includes/api/ApiModuleTestHelper.php
index 9eb7ff6..be4feb9 100644
--- a/repo/tests/phpunit/includes/api/ApiModuleTestHelper.php
+++ b/repo/tests/phpunit/includes/api/ApiModuleTestHelper.php
@@ -6,9 +6,9 @@
 use ApiMain;
 use Exception;
 use FauxRequest;
+use PHPUnit_Framework_Assert as Assert;
 use UsageException;
 use User;
-use PHPUnit_Framework_Assert as Assert;
 
 /**
  * @license GPL 2+
diff --git a/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php 
b/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php
index 6071a25..84d72ea 100644
--- a/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php
+++ b/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php
@@ -4,7 +4,6 @@
 
 use ApiBase;
 use ApiMain;
-use Exception;
 use FauxRequest;
 use Wikibase\DataModel\Claim\Claim;
 use Wikibase\DataModel\Entity\Item;
diff --git a/repo/tests/phpunit/includes/api/AvailableBadgesTest.php 
b/repo/tests/phpunit/includes/api/AvailableBadgesTest.php
index bc54117..bb974f9 100644
--- a/repo/tests/phpunit/includes/api/AvailableBadgesTest.php
+++ b/repo/tests/phpunit/includes/api/AvailableBadgesTest.php
@@ -2,7 +2,6 @@
 
 namespace Wikibase\Test\Api;
 
-use ApiTestCase;
 use Wikibase\Repo\WikibaseRepo;
 
 /**
@@ -19,7 +18,7 @@
  *
  * @author Bene* < benestar.wikime...@gmail.com >
  */
-class AvailabeBadgesTest extends ApiTestCase {
+class AvailabeBadgesTest extends \ApiTestCase {
 
        static $badgeItems = array(
                'Q123' => '',
diff --git a/repo/tests/phpunit/includes/api/BotEditTest.php 
b/repo/tests/phpunit/includes/api/BotEditTest.php
index ae2f46c..2dbbf58 100644
--- a/repo/tests/phpunit/includes/api/BotEditTest.php
+++ b/repo/tests/phpunit/includes/api/BotEditTest.php
@@ -2,8 +2,6 @@
 
 namespace Wikibase\Test\Api;
 
-use ApiTestCase;
-use TestUser;
 use Title;
 use Wikibase\Repo\WikibaseRepo;
 
@@ -34,7 +32,7 @@
        private static $hasSetup;
 
        /**
-        * @var TestUser
+        * @var \TestUser
         */
        private static $wbBotUser;
 
@@ -42,7 +40,7 @@
                parent::setUp();
 
                if ( !isset( self::$wbBotUser ) ) {
-                       self::$wbBotUser = new TestUser(
+                       self::$wbBotUser = new \TestUser(
                                'Apitestbot',
                                'Api Test Bot',
                                'api_test_...@example.com',
@@ -50,7 +48,7 @@
                        );
                }
 
-               ApiTestCase::$users['wbbot'] = self::$wbBotUser;
+               \ApiTestCase::$users['wbbot'] = self::$wbBotUser;
 
                if( !isset( self::$hasSetup ) ){
                        $this->initTestEntities( array( 'Empty' ) );
diff --git a/repo/tests/phpunit/includes/api/IntegrationApiTest.php 
b/repo/tests/phpunit/includes/api/IntegrationApiTest.php
index 4f6e25d..e5db7e0 100644
--- a/repo/tests/phpunit/includes/api/IntegrationApiTest.php
+++ b/repo/tests/phpunit/includes/api/IntegrationApiTest.php
@@ -2,8 +2,6 @@
 
 namespace Wikibase\Test\Api;
 
-use ApiTestCase;
-use TestSites;
 use Wikibase\Repo\WikibaseRepo;
 
 /**
@@ -19,13 +17,13 @@
  *
  * @author Adam Shorland
  */
-class IntegrationApiTest extends ApiTestCase {
+class IntegrationApiTest extends \ApiTestCase {
 
        public function setUp() {
                parent::setUp();
                $sitesTable = 
WikibaseRepo::getDefaultInstance()->getSiteStore();
                $sitesTable->clear();
-               $sitesTable->saveSites( TestSites::getSites() );
+               $sitesTable->saveSites( \TestSites::getSites() );
        }
 
        public function apiRequestProvider() {
diff --git a/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php 
b/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php
index 389328b..69c6e67 100644
--- a/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php
+++ b/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php
@@ -2,10 +2,7 @@
 
 namespace Wikibase\Test\Api;
 
-use ApiTestCase;
 use Revision;
-use TestSites;
-use TestUser;
 use UsageException;
 use User;
 use Wikibase\EntityFactory;
@@ -18,7 +15,7 @@
  * @author Daniel Kinzler
  * @author Adam Shorland
  */
-abstract class WikibaseApiTestCase extends ApiTestCase {
+abstract class WikibaseApiTestCase extends \ApiTestCase {
 
        protected static $loginSession = null;
        protected static $loginUser = null;
@@ -35,7 +32,7 @@
                if ( !$isSetup ) {
                        $sitesTable = 
WikibaseRepo::getDefaultInstance()->getSiteStore();
                        $sitesTable->clear();
-                       $sitesTable->saveSites( TestSites::getSites() );
+                       $sitesTable->saveSites( \TestSites::getSites() );
 
                        $this->login();
 
@@ -49,7 +46,7 @@
 
        private function setupUser() {
                if ( !self::$wbTestUser ) {
-                       self::$wbTestUser = new TestUser(
+                       self::$wbTestUser = new \TestUser(
                                'Apitesteditor',
                                'Api Test Editor',
                                'api_test_edi...@example.com',
@@ -57,7 +54,7 @@
                        );
                }
 
-               ApiTestCase::$users['wbeditor'] = self::$wbTestUser;
+               \ApiTestCase::$users['wbeditor'] = self::$wbTestUser;
 
                $this->setMwGlobals( 'wgUser', self::$users['wbeditor']->user );
        }
diff --git a/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php 
b/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
index bcd424c..e0c95d6 100644
--- a/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
+++ b/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
@@ -2,8 +2,8 @@
 
 namespace Wikibase\Test;
 
-use Wikibase\DataModel\SiteLink;
 use Wikibase\DataModel\Entity\Item;
+use Wikibase\DataModel\SiteLink;
 use Wikibase\DataModel\Term\AliasGroupList;
 use Wikibase\DataModel\Term\Fingerprint;
 use Wikibase\DataModel\Term\TermList;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8fa5b47b9c18d621cb964e7200b187b5e2d09bab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
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