Thiemo Mättig (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/231249
Change subject: Rename "Statement $claim" variables to $statement
......................................................................
Rename "Statement $claim" variables to $statement
Change-Id: Ie9d52b3ea427683c6183056eafe1941057bb7c3a
---
M repo/includes/Diff/ClaimDifferenceVisualizer.php
M repo/includes/Validators/SnakValidator.php
M repo/includes/api/SetClaim.php
M repo/includes/api/SetReference.php
4 files changed, 26 insertions(+), 25 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/49/231249/1
diff --git a/repo/includes/Diff/ClaimDifferenceVisualizer.php
b/repo/includes/Diff/ClaimDifferenceVisualizer.php
index 26fa32f..ab2e6e9 100644
--- a/repo/includes/Diff/ClaimDifferenceVisualizer.php
+++ b/repo/includes/Diff/ClaimDifferenceVisualizer.php
@@ -52,17 +52,17 @@
}
/**
- * Generates HTML of a claim change.
+ * Generates HTML of a statement change.
*
* @since 0.4
*
* @param ClaimDifference $claimDifference
- * @param Statement $baseClaim The new claim, if it exists; otherwise,
the old claim
+ * @param Statement $baseStatement The new statement, if it exists.
Otherwise the old statement.
*
* @return string HTML
*/
- public function visualizeClaimChange( ClaimDifference $claimDifference,
Statement $baseClaim ) {
- $newestMainSnak = $baseClaim->getMainSnak();
+ public function visualizeClaimChange( ClaimDifference $claimDifference,
Statement $baseStatement ) {
+ $newestMainSnak = $baseStatement->getMainSnak();
$oldestMainSnak = $newestMainSnak;
$html = '';
@@ -107,14 +107,14 @@
*
* @since 0.4
*
- * @param Statement $claim
+ * @param Statement $statement
*
* @return string HTML
*/
- public function visualizeNewClaim( Statement $claim ) {
+ public function visualizeNewClaim( Statement $statement ) {
$claimDiffer = new ClaimDiffer( new ListDiffer() );
- $claimDifference = $claimDiffer->diffClaims( null, $claim );
- return $this->visualizeClaimChange( $claimDifference, $claim );
+ $claimDifference = $claimDiffer->diffClaims( null, $statement );
+ return $this->visualizeClaimChange( $claimDifference,
$statement );
}
/**
@@ -122,14 +122,14 @@
*
* @since 0.4
*
- * @param Statement $claim
+ * @param Statement $statement
*
* @return string HTML
*/
- public function visualizeRemovedClaim( Statement $claim ) {
+ public function visualizeRemovedClaim( Statement $statement ) {
$claimDiffer = new ClaimDiffer( new ListDiffer() );
- $claimDifference = $claimDiffer->diffClaims( $claim, null );
- return $this->visualizeClaimChange( $claimDifference, $claim );
+ $claimDifference = $claimDiffer->diffClaims( $statement, null );
+ return $this->visualizeClaimChange( $claimDifference,
$statement );
}
/**
diff --git a/repo/includes/Validators/SnakValidator.php
b/repo/includes/Validators/SnakValidator.php
index 54dbee1..0c1699c 100644
--- a/repo/includes/Validators/SnakValidator.php
+++ b/repo/includes/Validators/SnakValidator.php
@@ -59,19 +59,19 @@
* the main snak, the qualifiers, and all snaks of all references,
* in case the claim is a Statement.
*
- * @param Statement $claim The value to validate
+ * @param Statement $statement The value to validate
*
* @return Result
*/
- public function validateClaimSnaks( Statement $claim ) {
- $snak = $claim->getMainSnak();
+ public function validateClaimSnaks( Statement $statement ) {
+ $snak = $statement->getMainSnak();
$result = $this->validate( $snak );
if ( !$result->isValid() ) {
return $result;
}
- foreach ( $claim->getQualifiers() as $snak ) {
+ foreach ( $statement->getQualifiers() as $snak ) {
$result = $this->validate( $snak );
if ( !$result->isValid() ) {
@@ -79,7 +79,7 @@
}
}
- $result = $this->validateReferences( $claim->getReferences() );
+ $result = $this->validateReferences(
$statement->getReferences() );
if ( !$result->isValid() ) {
return $result;
diff --git a/repo/includes/api/SetClaim.php b/repo/includes/api/SetClaim.php
index d1d89df..84a02a0 100644
--- a/repo/includes/api/SetClaim.php
+++ b/repo/includes/api/SetClaim.php
@@ -109,14 +109,15 @@
/**
* @param array $params
- * @param Statement $claim
+ * @param Statement $statement
* @param Entity $entity
*
+ * @throws InvalidArgumentException
* @return Summary
*
* @todo this summary builder is ugly and summary stuff needs to be
refactored
*/
- private function getSummary( array $params, Statement $claim, Entity
$entity ) {
+ private function getSummary( array $params, Statement $statement,
Entity $entity ) {
if ( !( $entity instanceof StatementListProvider ) ) {
throw new InvalidArgumentException( '$entity must be a
StatementListProvider' );
}
@@ -127,8 +128,8 @@
);
$summary = $claimSummaryBuilder->buildClaimSummary(
- $entity->getStatements()->getFirstStatementWithGuid(
$claim->getGuid() ),
- $claim
+ $entity->getStatements()->getFirstStatementWithGuid(
$statement->getGuid() ),
+ $statement
);
if ( isset( $params['summary'] ) ) {
diff --git a/repo/includes/api/SetReference.php
b/repo/includes/api/SetReference.php
index 376d003..206e898 100644
--- a/repo/includes/api/SetReference.php
+++ b/repo/includes/api/SetReference.php
@@ -123,13 +123,13 @@
}
/**
- * @param Statement $claim
+ * @param Statement $statement
* @param string $referenceHash
*/
- private function validateReferenceHash( Statement $claim,
$referenceHash ) {
- if ( !$claim->getReferences()->hasReferenceHash( $referenceHash
) ) {
+ private function validateReferenceHash( Statement $statement,
$referenceHash ) {
+ if ( !$statement->getReferences()->hasReferenceHash(
$referenceHash ) ) {
$this->errorReporter->dieError(
- 'Claim does not have a reference with the given
hash',
+ 'Statement does not have a reference with the
given hash',
'no-such-reference'
);
}
--
To view, visit https://gerrit.wikimedia.org/r/231249
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9d52b3ea427683c6183056eafe1941057bb7c3a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits