jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/402125 )

Change subject: Type hint against IDatabase instead of Database
......................................................................


Type hint against IDatabase instead of Database

Also use namespaced ResultWrapper, DBError and DBUnexpectedError

Change-Id: Ibb0e3fd3531ce5f115933a5fc33e2e08892b5186
---
M includes/DumpMetaInformation/SqlDumpMetaInformationRepo.php
M includes/ExternalDataRepo.php
M includes/UpdateExternalData/ExternalDataImporter.php
M tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php
M tests/phpunit/ExternalDataRepoTest.php
M tests/phpunit/Specials/SpecialCrossCheckTest.php
M tests/phpunit/Specials/SpecialExternalDatabasesTest.php
7 files changed, 13 insertions(+), 12 deletions(-)

Approvals:
  jenkins-bot: Verified
  Thiemo Kreuz (WMDE): Looks good to me, approved



diff --git a/includes/DumpMetaInformation/SqlDumpMetaInformationRepo.php 
b/includes/DumpMetaInformation/SqlDumpMetaInformationRepo.php
index 9c1be85..8eb90ad 100644
--- a/includes/DumpMetaInformation/SqlDumpMetaInformationRepo.php
+++ b/includes/DumpMetaInformation/SqlDumpMetaInformationRepo.php
@@ -2,12 +2,12 @@
 
 namespace WikibaseQuality\ExternalValidation\DumpMetaInformation;
 
-use Database;
 use InvalidArgumentException;
 use UnexpectedValueException;
-use ResultWrapper;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Entity\PropertyId;
+use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * Implements access to the actual database table that stores the dump 
information.
@@ -229,11 +229,11 @@
        }
 
        /**
-        * @param Database $db
+        * @param IDatabase $db
         * @param DumpMetaInformation $dumpMetaInformation
         * @return array
         */
-       private function getDumpInformationFields( Database $db,  
DumpMetaInformation $dumpMetaInformation ) {
+       private function getDumpInformationFields( IDatabase $db,  
DumpMetaInformation $dumpMetaInformation ) {
                return [
                        'id' => $dumpMetaInformation->getDumpId(),
                        'source_qid' => 
$dumpMetaInformation->getSourceItemId()->getSerialization(),
diff --git a/includes/ExternalDataRepo.php b/includes/ExternalDataRepo.php
index 3b5fdc9..ac7e610 100644
--- a/includes/ExternalDataRepo.php
+++ b/includes/ExternalDataRepo.php
@@ -2,9 +2,9 @@
 
 namespace WikibaseQuality\ExternalValidation;
 
-use DBError;
 use Wikibase\DataModel\Entity\PropertyId;
 use Wikimedia\Assert\Assert;
+use Wikimedia\Rdbms\DBError;
 
 /**
  * @package WikibaseQuality\ExternalValidation
@@ -115,7 +115,7 @@
         *
         * @param string $dumpId
         * @param int $batchSize
-        * @throws \DBUnexpectedError
+        * @throws \Wikimedia\Rdbms\DBUnexpectedError
         */
        public function deleteOfDump( $dumpId, $batchSize = 1000 ) {
                Assert::parameterType( 'string', $dumpId, '$dumpId' );
diff --git a/includes/UpdateExternalData/ExternalDataImporter.php 
b/includes/UpdateExternalData/ExternalDataImporter.php
index 3b4b005..d094288 100644
--- a/includes/UpdateExternalData/ExternalDataImporter.php
+++ b/includes/UpdateExternalData/ExternalDataImporter.php
@@ -7,6 +7,7 @@
 use WikibaseQuality\ExternalValidation\DumpMetaInformation\DumpMetaInformation;
 use 
WikibaseQuality\ExternalValidation\DumpMetaInformation\DumpMetaInformationStore;
 use WikibaseQuality\ExternalValidation\ExternalDataRepo;
+use Wikimedia\Rdbms\DBError;
 
 /**
  * @package WikibaseQuality\ExternalValidation\UpdateExternalData
@@ -102,7 +103,7 @@
 
                        try {
                                $this->dumpMetaInformationStore->save( 
$dumpMetaInformation );
-                       } catch ( \DBError $e ) {
+                       } catch ( DBError $e ) {
                                exit( 'Unknown database error occurred.' );
                        }
 
@@ -136,7 +137,7 @@
                        if ( $data === false || ++$i % 
$this->importSettings->getBatchSize() === 0 ) {
                                try {
                                        $this->externalDataRepo->insertBatch( 
$accumulator );
-                               } catch ( \DBError $e ) {
+                               } catch ( DBError $e ) {
                                        exit( 'Unknown database error 
occurred.' );
                                }
                                wfGetLBFactory()->waitForReplication();
diff --git 
a/tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php 
b/tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php
index 0a7c7c8..02c9886 100644
--- a/tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php
+++ b/tests/phpunit/DumpMetaInformation/SqlDumpMetaInformationRepoTest.php
@@ -92,7 +92,7 @@
        /**
         * Adds temporary test data to database
         *
-        * @throws \DBUnexpectedError
+        * @throws \Wikimedia\Rdbms\DBUnexpectedError
         */
        public function addDBData() {
                $this->db->delete(
diff --git a/tests/phpunit/ExternalDataRepoTest.php 
b/tests/phpunit/ExternalDataRepoTest.php
index 04cee40..9b99fb6 100644
--- a/tests/phpunit/ExternalDataRepoTest.php
+++ b/tests/phpunit/ExternalDataRepoTest.php
@@ -41,7 +41,7 @@
        /**
         * Adds temporary test data to database
         *
-        * @throws \DBUnexpectedError
+        * @throws \Wikimedia\Rdbms\DBUnexpectedError
         */
        public function addDBData() {
                $this->db->delete(
diff --git a/tests/phpunit/Specials/SpecialCrossCheckTest.php 
b/tests/phpunit/Specials/SpecialCrossCheckTest.php
index 53344e6..f7675c9 100644
--- a/tests/phpunit/Specials/SpecialCrossCheckTest.php
+++ b/tests/phpunit/Specials/SpecialCrossCheckTest.php
@@ -92,7 +92,7 @@
 
        /**
         * Adds temporary test data to database
-        * @throws \DBUnexpectedError
+        * @throws \Wikimedia\Rdbms\DBUnexpectedError
         */
        public function addDBData() {
                global $wgWBQEVInstanceOfPID, $wgWBQEVIdentifierPropertyQID;
diff --git a/tests/phpunit/Specials/SpecialExternalDatabasesTest.php 
b/tests/phpunit/Specials/SpecialExternalDatabasesTest.php
index a0083a1..a7eb846 100644
--- a/tests/phpunit/Specials/SpecialExternalDatabasesTest.php
+++ b/tests/phpunit/Specials/SpecialExternalDatabasesTest.php
@@ -46,7 +46,7 @@
 
        /**
         * Adds temporary test data to database
-        * @throws \DBUnexpectedError
+        * @throws \Wikimedia\Rdbms\DBUnexpectedError
         */
        public function addDBData() {
                // Truncate table

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibb0e3fd3531ce5f115933a5fc33e2e08892b5186
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/WikibaseQualityExternalValidation
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to