Skip to content

Commit a02da97

Browse files
committed
Merge pull request #490 from wmde/getByPropertyId
Rename getWithPropertyId to getByPropertyId
2 parents cc1c2de + 9f63f7a commit a02da97

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Other breaking changes:
3636
* Removed previously deprecated `Entity::getAllSnaks`, use `StatementList::getAllSnaks` instead
3737
* Removed previously deprecated `EntityId::getPrefixedId`, use `EntityId::getSerialization` instead
3838
* Removed previously deprecated `Property::newEmpty`, use `Property::newFromType` or `new Property()` instead
39+
* Renamed `StatementList::getWithPropertyId` to `StatementList::getByPropertyId`
3940
* `Reference` and `ReferenceList`s no longer can not be instantiated with `null`
4041
* Added `setId` method to `EntityDocument`
4142

src/Statement/StatementList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ public function getWithUniqueMainSnaks() {
140140
}
141141

142142
/**
143-
* @since 2.3
143+
* @since 3.0
144144
*
145145
* @param PropertyId $id
146146
*
147147
* @return self
148148
*/
149-
public function getWithPropertyId( PropertyId $id ) {
149+
public function getByPropertyId( PropertyId $id ) {
150150
$statementList = new self();
151151

152152
foreach ( $this->statements as $statement ) {

tests/unit/Statement/StatementListTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,17 +503,17 @@ public function testGetMainSnaks() {
503503
);
504504
}
505505

506-
public function testGivenNotKnownPropertyId_getWithPropertyIdReturnsEmptyList() {
506+
public function testGivenNotKnownPropertyId_getByPropertyIdReturnsEmptyList() {
507507
$list = new StatementList();
508508
$list->addNewStatement( new PropertyNoValueSnak( 42 ) );
509509

510510
$this->assertEquals(
511511
new StatementList(),
512-
$list->getWithPropertyId( new PropertyId( 'P2' ) )
512+
$list->getByPropertyId( new PropertyId( 'P2' ) )
513513
);
514514
}
515515

516-
public function testGivenKnownPropertyId_getWithPropertyIdReturnsListWithOnlyMatchingStatements() {
516+
public function testGivenKnownPropertyId_getByPropertyIdReturnsListWithOnlyMatchingStatements() {
517517
$list = new StatementList();
518518
$list->addNewStatement( new PropertyNoValueSnak( 42 ) );
519519
$list->addNewStatement( new PropertyNoValueSnak( 9001 ) );
@@ -526,7 +526,7 @@ public function testGivenKnownPropertyId_getWithPropertyIdReturnsListWithOnlyMat
526526

527527
$this->assertEquals(
528528
$expected,
529-
$list->getWithPropertyId( new PropertyId( 'P42' ) )
529+
$list->getByPropertyId( new PropertyId( 'P42' ) )
530530
);
531531
}
532532

0 commit comments

Comments
 (0)