[MediaWiki-commits] [Gerrit] Rename duplicate/outdated methods and parameters - change (mediawiki...WikibaseQualityExternalValidation)
jenkins-bot has submitted this change and it was merged. Change subject: Rename duplicate/outdated methods and parameters .. Rename duplicate/outdated methods and parameters Focus is on two renames: 1. The duplicate "crossCheckStatement(s|List)" methods in CrossCheckInteractor. 2. Outdated "claimGuids". Change-Id: I45449638aca5ff41f2dd5d9ea69b5c90af7ef45d --- M api/RunCrossCheck.php M includes/CrossCheck/CrossCheckInteractor.php M includes/DumpMetaInformation/DumpMetaInformation.php M includes/DumpMetaInformation/SqlDumpMetaInformationRepo.php M includes/ExternalDataRepo.php M specials/SpecialCrossCheck.php M tests/phpunit/Api/RunCrossCheckTest.php M tests/phpunit/CrossCheck/CrossCheckInteractorTest.php M tests/phpunit/CrossCheck/Result/CrossCheckResultTest.php M tests/phpunit/Specials/SpecialCrossCheckTest.php 10 files changed, 58 insertions(+), 56 deletions(-) Approvals: Daniel Kinzler: Looks good to me, approved Addshore: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/api/RunCrossCheck.php b/api/RunCrossCheck.php index 06b2651..8bc75c2 100644 --- a/api/RunCrossCheck.php +++ b/api/RunCrossCheck.php @@ -122,9 +122,9 @@ $resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIds( $entityIds ); } } elseif ( $params['claims'] ) { - $claimGuids = $params['claims']; - $this->assertAreValidClaimGuids( $claimGuids ); - $resultLists = $this->crossCheckInteractor->crossCheckStatements( $claimGuids ); + $guids = $params['claims']; + $this->assertAreValidClaimGuids( $guids ); + $resultLists = $this->crossCheckInteractor->crossCheckStatementsByGuids( $guids ); } else { $this->errorReporter->dieError( 'Either provide the ids of entities or ids of claims, that should be cross-checked.', @@ -149,11 +149,11 @@ } /** -* @param array $claimGuids +* @param string[] $guids */ - private function assertAreValidClaimGuids( array $claimGuids ) { - foreach ( $claimGuids as $claimGuid ) { - if ( $this->statementGuidValidator->validateFormat( $claimGuid ) === false ) { + private function assertAreValidClaimGuids( array $guids ) { + foreach ( $guids as $guid ) { + if ( $this->statementGuidValidator->validateFormat( $guid ) === false ) { $this->errorReporter->dieError( 'Invalid claim guid.', 'invalid-guid' ); } } diff --git a/includes/CrossCheck/CrossCheckInteractor.php b/includes/CrossCheck/CrossCheckInteractor.php index bf77f07..f263237 100644 --- a/includes/CrossCheck/CrossCheckInteractor.php +++ b/includes/CrossCheck/CrossCheckInteractor.php @@ -60,7 +60,7 @@ $entity = $this->entityLookup->getEntity( $entityId ); if ( $entity instanceof StatementListProvider ) { - return $this->crossCheckStatementList( $entity->getStatements() ); + return $this->crossCheckStatements( $entity->getStatements() ); } return null; @@ -91,7 +91,7 @@ * * @return CrossCheckResultList */ - public function crossCheckStatementList( StatementList $statements ) { + public function crossCheckStatements( StatementList $statements ) { return $this->crossChecker->crossCheckStatements( $statements, $statements ); } @@ -110,7 +110,7 @@ foreach ( $entities as $entity ) { $entityId = $entity->getId()->getSerialization(); if ( $entity instanceof StatementListProvider ) { - $results[$entityId] = $this->crossCheckStatementList( $entity->getStatements() ); + $results[$entityId] = $this->crossCheckStatements( $entity->getStatements() ); } } @@ -211,16 +211,15 @@ /** * Runs cross-check for a single statement. * -* @param string $statementGuid +* @param string $guid * -* @param string $claimGuid * @return CrossCheckResultList * @throws InvalidArgumentException */ - public function crossCheckStatement( $statementGuid ) { - $this->assertIsString( $statementGuid, '$claimGuid' ); + public function crossCheckStatementByGuid( $guid ) { + $this->assertIsString( $guid, '$guid' ); - $resultList = $this->crossCheckStatements( array( $statementGuid ) ); + $resultList =
[MediaWiki-commits] [Gerrit] Rename duplicate/outdated methods and parameters - change (mediawiki...WikibaseQualityExternalValidation)
Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/243125 Change subject: Rename duplicate/outdated methods and parameters .. Rename duplicate/outdated methods and parameters Focus is on two renames: 1. The duplicate "crossCheckStatement(s|List)" methods in CrossCheckInteractor. 2. Outdated "claimGuids". Change-Id: I45449638aca5ff41f2dd5d9ea69b5c90af7ef45d --- M api/RunCrossCheck.php M includes/CrossCheck/CrossCheckInteractor.php M includes/DumpMetaInformation/DumpMetaInformation.php M includes/DumpMetaInformation/SqlDumpMetaInformationRepo.php M includes/ExternalDataRepo.php M specials/SpecialCrossCheck.php M tests/phpunit/Api/RunCrossCheckTest.php M tests/phpunit/CrossCheck/CrossCheckInteractorTest.php M tests/phpunit/CrossCheck/Result/CrossCheckResultTest.php M tests/phpunit/Specials/SpecialCrossCheckTest.php 10 files changed, 58 insertions(+), 56 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityExternalValidation refs/changes/25/243125/1 diff --git a/api/RunCrossCheck.php b/api/RunCrossCheck.php index 06b2651..8bc75c2 100644 --- a/api/RunCrossCheck.php +++ b/api/RunCrossCheck.php @@ -122,9 +122,9 @@ $resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIds( $entityIds ); } } elseif ( $params['claims'] ) { - $claimGuids = $params['claims']; - $this->assertAreValidClaimGuids( $claimGuids ); - $resultLists = $this->crossCheckInteractor->crossCheckStatements( $claimGuids ); + $guids = $params['claims']; + $this->assertAreValidClaimGuids( $guids ); + $resultLists = $this->crossCheckInteractor->crossCheckStatementsByGuids( $guids ); } else { $this->errorReporter->dieError( 'Either provide the ids of entities or ids of claims, that should be cross-checked.', @@ -149,11 +149,11 @@ } /** -* @param array $claimGuids +* @param string[] $guids */ - private function assertAreValidClaimGuids( array $claimGuids ) { - foreach ( $claimGuids as $claimGuid ) { - if ( $this->statementGuidValidator->validateFormat( $claimGuid ) === false ) { + private function assertAreValidClaimGuids( array $guids ) { + foreach ( $guids as $guid ) { + if ( $this->statementGuidValidator->validateFormat( $guid ) === false ) { $this->errorReporter->dieError( 'Invalid claim guid.', 'invalid-guid' ); } } diff --git a/includes/CrossCheck/CrossCheckInteractor.php b/includes/CrossCheck/CrossCheckInteractor.php index bf77f07..f263237 100644 --- a/includes/CrossCheck/CrossCheckInteractor.php +++ b/includes/CrossCheck/CrossCheckInteractor.php @@ -60,7 +60,7 @@ $entity = $this->entityLookup->getEntity( $entityId ); if ( $entity instanceof StatementListProvider ) { - return $this->crossCheckStatementList( $entity->getStatements() ); + return $this->crossCheckStatements( $entity->getStatements() ); } return null; @@ -91,7 +91,7 @@ * * @return CrossCheckResultList */ - public function crossCheckStatementList( StatementList $statements ) { + public function crossCheckStatements( StatementList $statements ) { return $this->crossChecker->crossCheckStatements( $statements, $statements ); } @@ -110,7 +110,7 @@ foreach ( $entities as $entity ) { $entityId = $entity->getId()->getSerialization(); if ( $entity instanceof StatementListProvider ) { - $results[$entityId] = $this->crossCheckStatementList( $entity->getStatements() ); + $results[$entityId] = $this->crossCheckStatements( $entity->getStatements() ); } } @@ -211,16 +211,15 @@ /** * Runs cross-check for a single statement. * -* @param string $statementGuid +* @param string $guid * -* @param string $claimGuid * @return CrossCheckResultList * @throws InvalidArgumentException */ - public function crossCheckStatement( $statementGuid ) { - $this->assertIsString( $statementGuid, '$claimGuid' ); + public function crossCheckStatementByGuid( $guid ) { + $this->assertIsString( $guid, '$guid' ); - $resultList = $this->crossCheckStatements( array( $statementGuid ) ); +