Skip to content

Commit 2e004c9

Browse files
committed
Removed Claims::getHash
1 parent c21c4d8 commit 2e004c9

3 files changed

Lines changed: 2 additions & 42 deletions

File tree

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Removed `Claims::getHashes`
1717
* Removed `Claims::getGuids`
1818
* Removed `Claims::equals` (and `Claims` no longer implements `Comparable`)
19+
* Removed `Claims::getHash` (and `Claims` no longer implements `Hashable`)
1920

2021
## Version 2.6.0 (2015-03-08)
2122

src/Claim/Claims.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @author Daniel Kinzler
2323
* @author H. Snater < mediawiki@snater.com >
2424
*/
25-
class Claims extends ArrayObject implements Hashable {
25+
class Claims extends ArrayObject {
2626

2727
/**
2828
* @see GenericArrayObject::__construct
@@ -279,26 +279,6 @@ public function offsetUnset( $guid ) {
279279
parent::offsetUnset( $key );
280280
}
281281

282-
/**
283-
* Returns a hash based on the value of the object.
284-
* The hash is based on the hashes of the claims contained,
285-
* with the order of claims considered significant.
286-
*
287-
* @since 0.5
288-
*
289-
* @return string
290-
*/
291-
public function getHash() {
292-
$hash = sha1( '' );
293-
294-
/* @var Claim $claim */
295-
foreach ( $this as $claim ) {
296-
$hash = sha1( $hash . $claim->getHash() );
297-
}
298-
299-
return $hash;
300-
}
301-
302282
/**
303283
* @return bool
304284
*/

tests/unit/Claim/ClaimsTest.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -414,27 +414,6 @@ public function testDuplicateClaims() {
414414
$this->assertNull( $list->getClaimWithGuid( $secondClaim->getGuid() ) );
415415
}
416416

417-
public function testGetHash() {
418-
$claimsA = new Claims();
419-
$claimsB = new Claims();
420-
$claim1 = $this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P15' ) ) );
421-
$claim2 = $this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P16' ) ) );
422-
423-
$this->assertEquals( $claimsA->getHash(), $claimsB->getHash(), 'empty list' );
424-
425-
$claimsA->addClaim( $claim1 );
426-
$claimsB->addClaim( $claim2 );
427-
$this->assertNotEquals( $claimsA->getHash(), $claimsB->getHash(), 'different content' );
428-
429-
$claimsA->addClaim( $claim2 );
430-
$claimsB->addClaim( $claim1 );
431-
$this->assertNotEquals( $claimsA->getHash(), $claimsB->getHash(), 'different order' );
432-
433-
$claimsA->removeClaim( $claim1 );
434-
$claimsB->removeClaim( $claim1 );
435-
$this->assertEquals( $claimsA->getHash(), $claimsB->getHash(), 'same content' );
436-
}
437-
438417
public function testIterator() {
439418
$expected = array(
440419
'TESTCLAIM1' => $this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P42' ) ), 'testclaim1' ),

0 commit comments

Comments
 (0)