Skip to content

Commit 00c0a64

Browse files
committed
Drop deprecated entity::getAllSnaks
1 parent b36a122 commit 00c0a64

3 files changed

Lines changed: 1 addition & 56 deletions

File tree

RELEASE-NOTES.md

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

2627
#### Additions

src/Entity/Entity.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -427,30 +427,6 @@ public final function patch( EntityDiff $patch ) {
427427
$patcher->patchEntity( $this, $patch );
428428
}
429429

430-
/**
431-
* Returns a list of all Snaks on this Entity. This includes at least the main snaks of
432-
* Claims, the snaks from Claim qualifiers, and the snaks from Statement References.
433-
*
434-
* This is a convenience method for use in code that needs to operate on all snaks, e.g.
435-
* to find all referenced Entities.
436-
*
437-
* @since 0.5
438-
* @deprecated since 1.0 - use StatementList::getAllSnaks instead
439-
*
440-
* @return Snak[]
441-
*/
442-
public function getAllSnaks() {
443-
$snaks = array();
444-
445-
foreach ( $this->getClaims() as $claim ) {
446-
foreach( $claim->getAllSnaks() as $snak ) {
447-
$snaks[] = $snak;
448-
}
449-
}
450-
451-
return $snaks;
452-
}
453-
454430
/**
455431
* @since 0.7.3
456432
*

tests/unit/Entity/EntityTest.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -503,38 +503,6 @@ public function testGetClaims( Entity $entity ) {
503503
$this->assertInternalType( 'array', $claims );
504504
}
505505

506-
/**
507-
* @dataProvider instanceProvider
508-
* @param Entity $entity
509-
*/
510-
public function testGetAllSnaks( Entity $entity ) {
511-
$snaks = $entity->getAllSnaks();
512-
$claims = $entity->getClaims();
513-
514-
$this->assertInternalType( 'array', $snaks );
515-
516-
$this->assertGreaterThanOrEqual( count( $claims ), count( $snaks ), "At least one snak per Claim" );
517-
518-
foreach ( $claims as $claim ) {
519-
$snak = $claim->getMainSnak();
520-
$this->assertContains( $snak, $snaks, "main snak" );
521-
522-
$qualifiers = $claim->getQualifiers();
523-
524-
// check the first qualifier
525-
foreach ( $qualifiers as $snak ) {
526-
$this->assertContains( $snak, $snaks, "qualifier snak" );
527-
}
528-
529-
// check the first reference
530-
if ( $claim instanceof Statement ) {
531-
foreach ( $claim->getAllSnaks() as $snak ) {
532-
$this->assertContains( $snak, $snaks, "statement snak" );
533-
}
534-
}
535-
}
536-
}
537-
538506
public function testWhenNoStuffIsSet_getFingerprintReturnsEmptyFingerprint() {
539507
$entity = $this->getNewEmpty();
540508

0 commit comments

Comments
 (0)