Skip to content

Commit 04c5d08

Browse files
committed
Fix minor code smell issues
1 parent a1b5177 commit 04c5d08

7 files changed

Lines changed: 8 additions & 11 deletions

File tree

src/Claim/Claims.php

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

55
use ArrayObject;
6-
use Comparable;
7-
use Hashable;
86
use InvalidArgumentException;
97
use Traversable;
108

src/Entity/Diff/PropertyDiffer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ private function toDiffArray( Property $property ) {
9595
public function getConstructionDiff( EntityDocument $entity ) {
9696
$this->assertIsProperty( $entity );
9797

98+
/** @var Property $entity */
9899
$diffOps = $this->diffPropertyArrays( array(), $this->toDiffArray( $entity ) );
99100
$diffOps['claim'] = $this->statementListDiffer->getDiff( new StatementList(), $entity->getStatements() );
100101

@@ -110,6 +111,7 @@ public function getConstructionDiff( EntityDocument $entity ) {
110111
public function getDestructionDiff( EntityDocument $entity ) {
111112
$this->assertIsProperty( $entity );
112113

114+
/** @var Property $entity */
113115
$diffOps = $this->diffPropertyArrays( $this->toDiffArray( $entity ), array() );
114116
$diffOps['claim'] = $this->statementListDiffer->getDiff( $entity->getStatements(), new StatementList() );
115117

src/Statement/StatementByGuidMap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public function __construct( $statements = array() ) {
3838
* If the provided statement has a GUID not yet in the map, it will be appended to the map.
3939
* If the GUID is already in the map, the statement with this guid will be replaced.
4040
*
41+
* @throws InvalidArgumentException
4142
* @param Statement $statement
4243
*/
4344
public function addStatement( Statement $statement ) {

src/Statement/StatementList.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ public function isEmpty() {
287287
*
288288
* @param string|null $statementGuid
289289
*
290-
* @return int|bool
290+
* @throws InvalidArgumentException
291+
* @return int|bool Zero-based index or false if not found.
291292
*/
292293
public function getIndexByGuid( $statementGuid ) {
293294
if ( !is_string( $statementGuid ) && !is_null( $statementGuid ) ) {

tests/unit/Entity/Diff/ItemDiffTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,13 @@ public function testApply( Entity $a, Entity $b ) {
204204
/**
205205
* @var Item $a
206206
* @var Item $b
207+
* @var SiteLink[] $siteLinks
207208
*/
208-
209209
$siteLinks = array_merge(
210-
$a->getSiteLinks(),
211-
$b->getSiteLinks()
210+
$a->getSiteLinkList()->toArray(),
211+
$b->getSiteLinkList()->toArray()
212212
);
213213

214-
/**
215-
* @var SiteLink $siteLink
216-
*/
217214
foreach ( $siteLinks as $siteLink ) {
218215
$aLink = $a->getSiteLinkList()->getBySiteId( $siteLink->getSiteId() );
219216
$bLink = $a->getSiteLinkList()->getBySiteId( $siteLink->getSiteId() );

tests/unit/Entity/EntityTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Wikibase\DataModel\Entity\Diff\EntityDiff;
99
use Wikibase\DataModel\Entity\Entity;
1010
use Wikibase\DataModel\Entity\Item;
11-
use Wikibase\DataModel\Statement\Statement;
1211
use Wikibase\DataModel\Term\AliasGroup;
1312
use Wikibase\DataModel\Term\AliasGroupList;
1413
use Wikibase\DataModel\Term\Fingerprint;

tests/unit/Entity/ItemTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Wikibase\DataModel\Tests\Entity;
44

5-
use DataValues\StringValue;
65
use Diff\DiffOp\Diff\Diff;
76
use Diff\DiffOp\DiffOpAdd;
87
use Diff\DiffOp\DiffOpChange;

0 commit comments

Comments
 (0)