Skip to content

Commit 9d0106e

Browse files
committed
Merge pull request #437 from wmde/removeClaim2
Drop unused Claims::removeClaim
2 parents 028ed44 + 5ee6719 commit 9d0106e

3 files changed

Lines changed: 1 addition & 43 deletions

File tree

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* Removed `Claims::getHash` (and `Claims` no longer implements `Hashable`)
2323
* Removed `Claims::isEmpty` (you can use `StatementList::isEmpty` instead)
2424
* Removed `Claims::indexOf` (you can use `StatementList::getIndexByGuid` instead)
25+
* Removed `Claims::removeClaim`
2526
* Removed `Entity::getAllSnaks`, use `StatementList::getAllSnaks` instead
2627
* Removed `EntityId::getPrefixedId`, use `EntityId::getSerialization` instead
2728

src/Claim/Claims.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -135,25 +135,6 @@ public function hasClaim( Claim $claim ) {
135135
return $this->offsetExists( $key );
136136
}
137137

138-
/**
139-
* @since 0.1
140-
*
141-
* @param Claim $claim
142-
*/
143-
public function removeClaim( Claim $claim ) {
144-
$guid = $claim->getGuid();
145-
146-
if ( $guid === null ) {
147-
return;
148-
}
149-
150-
$key = $this->getGuidKey( $guid );
151-
152-
if ( $this->offsetExists( $key ) ) {
153-
$this->offsetUnset( $key );
154-
}
155-
}
156-
157138
/**
158139
* @since 0.3
159140
*

tests/unit/Claim/ClaimsTest.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -123,30 +123,6 @@ public function testHasClaimWithGuid() {
123123
$this->assertTrue( $claims->hasClaimWithGuid( $claim2->getGuid() ) );
124124
}
125125

126-
public function testRemoveClaim() {
127-
$claims = new Claims();
128-
$claim1 = $this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P15' ) ) );
129-
$claim2 = $this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P16' ) ) );
130-
131-
$claims->addClaim( $claim1 );
132-
$claims->addClaim( $claim2 );
133-
$this->assertSame( 2, $claims->count() );
134-
135-
$claims->removeClaim( $claim1 );
136-
$this->assertFalse( $claims->hasClaim( $claim1 ) );
137-
$this->assertNull( $claims->getClaimWithGuid( $claim1->getGuid() ) );
138-
$this->assertSame( 1, $claims->count() );
139-
140-
$claims->removeClaim( $claim2 );
141-
$this->assertFalse( $claims->hasClaim( $claim2 ) );
142-
$this->assertNull( $claims->getClaimWithGuid( $claim2->getGuid() ) );
143-
$this->assertSame( 0, $claims->count() );
144-
145-
// no guid
146-
$claim0 = new Claim( new PropertyNoValueSnak( new PropertyId( 'P15' ) ) );
147-
$claims->removeClaim( $claim0 );
148-
}
149-
150126
public function testRemoveClaimWithGuid() {
151127
$claims = new Claims();
152128
$claim1 = $this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P15' ) ) );

0 commit comments

Comments
 (0)