Skip to content

Commit 1f95fec

Browse files
committed
Replace Claim alias with Statement
1 parent b36a122 commit 1f95fec

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();
@@ -392,10 +392,10 @@ public function hasClaims() {
392392
*
393393
* @param Snak $mainSnak
394394
*
395-
* @return Claim
395+
* @return Statement
396396
*/
397397
public function newClaim( Snak $mainSnak ) {
398-
return new Claim( $mainSnak );
398+
return new Statement( $mainSnak );
399399
}
400400

401401
/**

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;
@@ -246,14 +245,12 @@ public function newClaim( Snak $mainSnak ) {
246245
/**
247246
* @deprecated since 1.0, use getStatements()->addStatement() instead.
248247
*
249-
* @param Claim $statement This needs to be a Statement as of 1.0
248+
* @param Statement $statement
250249
*
251250
* @throws InvalidArgumentException
252251
*/
253-
public function addClaim( Claim $statement ) {
254-
if ( !( $statement instanceof Statement ) ) {
255-
throw new InvalidArgumentException( '$statement must be an instance of Statement' );
256-
} elseif ( $statement->getGuid() === null ) {
252+
public function addClaim( Statement $statement ) {
253+
if ( $statement->getGuid() === null ) {
257254
throw new InvalidArgumentException( 'Can\'t add a Claim without a GUID.' );
258255
}
259256

0 commit comments

Comments
 (0)