Skip to content

Commit 7468ba1

Browse files
committed
Merge pull request #431 from wmde/deprecatedClaim
Replace Claim alias with Statement
2 parents b8de754 + 1f95fec commit 7468ba1

3 files changed

Lines changed: 13 additions & 19 deletions

File tree

src/Entity/Entity.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
use InvalidArgumentException;
66
use RuntimeException;
7-
use Wikibase\DataModel\Claim\Claim;
87
use Wikibase\DataModel\Entity\Diff\EntityDiff;
98
use Wikibase\DataModel\Entity\Diff\EntityDiffer;
109
use Wikibase\DataModel\Entity\Diff\EntityPatcher;
1110
use Wikibase\DataModel\Snak\Snak;
11+
use Wikibase\DataModel\Statement\Statement;
1212
use Wikibase\DataModel\Term\AliasGroup;
1313
use Wikibase\DataModel\Term\AliasGroupList;
1414
use Wikibase\DataModel\Term\Fingerprint;
@@ -352,20 +352,20 @@ public function copy() {
352352
* @since 0.3
353353
* @deprecated since 1.0, use getStatements()->addStatement() instead.
354354
*
355-
* @param Claim $claim
355+
* @param Statement $statement
356356
*
357357
* @throws InvalidArgumentException
358358
* @throws RuntimeException
359359
*/
360-
public function addClaim( Claim $claim ) {
361-
throw new RuntimeException( 'Claims on entities are not supported any more.' );
360+
public function addClaim( Statement $statement ) {
361+
throw new RuntimeException( 'Statements on entities are not supported any more.' );
362362
}
363363

364364
/**
365365
* @since 0.3
366366
* @deprecated since 1.0, use getStatements()->toArray() instead.
367367
*
368-
* @return Claim[]
368+
* @return Statement[]
369369
*/
370370
public function getClaims() {
371371
return array();
@@ -377,10 +377,10 @@ public function getClaims() {
377377
*
378378
* @param Snak $mainSnak
379379
*
380-
* @return Claim
380+
* @return Statement
381381
*/
382382
public function newClaim( Snak $mainSnak ) {
383-
return new Claim( $mainSnak );
383+
return new Statement( $mainSnak );
384384
}
385385

386386
/**

src/Entity/Item.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use InvalidArgumentException;
66
use OutOfBoundsException;
7-
use Wikibase\DataModel\Claim\Claim;
87
use Wikibase\DataModel\Claim\Claims;
98
use Wikibase\DataModel\SiteLink;
109
use Wikibase\DataModel\SiteLinkList;
@@ -240,14 +239,12 @@ public function clear() {
240239
/**
241240
* @deprecated since 1.0, use getStatements()->addStatement() instead.
242241
*
243-
* @param Claim $statement This needs to be a Statement as of 1.0
242+
* @param Statement $statement
244243
*
245244
* @throws InvalidArgumentException
246245
*/
247-
public function addClaim( Claim $statement ) {
248-
if ( !( $statement instanceof Statement ) ) {
249-
throw new InvalidArgumentException( '$statement must be an instance of Statement' );
250-
} elseif ( $statement->getGuid() === null ) {
246+
public function addClaim( Statement $statement ) {
247+
if ( $statement->getGuid() === null ) {
251248
throw new InvalidArgumentException( 'Can\'t add a Claim without a GUID.' );
252249
}
253250

src/Entity/Property.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Wikibase\DataModel\Entity;
44

55
use InvalidArgumentException;
6-
use Wikibase\DataModel\Claim\Claim;
76
use Wikibase\DataModel\Claim\Claims;
87
use Wikibase\DataModel\Snak\Snak;
98
use Wikibase\DataModel\Statement\Statement;
@@ -237,14 +236,12 @@ public function newClaim( Snak $mainSnak ) {
237236
/**
238237
* @deprecated since 1.0, use getStatements()->addStatement() instead.
239238
*
240-
* @param Claim $statement This needs to be a Statement as of 1.0
239+
* @param Statement $statement
241240
*
242241
* @throws InvalidArgumentException
243242
*/
244-
public function addClaim( Claim $statement ) {
245-
if ( !( $statement instanceof Statement ) ) {
246-
throw new InvalidArgumentException( '$statement must be an instance of Statement' );
247-
} elseif ( $statement->getGuid() === null ) {
243+
public function addClaim( Statement $statement ) {
244+
if ( $statement->getGuid() === null ) {
248245
throw new InvalidArgumentException( 'Can\'t add a Claim without a GUID.' );
249246
}
250247

0 commit comments

Comments
 (0)