Skip to content

Commit

Permalink
Merge pull request #832 from wmde/retire-interfaces
Browse files Browse the repository at this point in the history
Retire interfaces
  • Loading branch information
lucaswerkmeister committed Nov 11, 2020
2 parents 94a38d4 + 3666e04 commit c05df4c
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 31 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
please update your code:
for instance, change `->addNewReference( [ $x, $y ] )` to `->addNewReference( $x, $y )`,
and `->addNewReference( $snaks )` to `->addNewReference( ...$snaks )`.
* `Statement`, `Reference`, `SnakList` and `Snak` no longer implement the `Hashable` and `Immutable` interfaces from `DataValues/DataValues`.

## Version 9.5.1 (2020-06-03)

Expand Down
6 changes: 1 addition & 5 deletions src/Internal/MapValueHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Wikibase\DataModel\Internal;

use Hashable;
use InvalidArgumentException;
use Traversable;

Expand All @@ -27,7 +26,7 @@ public function __construct( $holdOrderIntoAccount = false ) {
*
* @since 0.1
*
* @param Traversable|Hashable[] $map
* @param Traversable $map
*
* @return string
* @throws InvalidArgumentException
Expand All @@ -39,9 +38,6 @@ public function hash( $map ) {

$hashes = [];

/**
* @var Hashable $hashable
*/
foreach ( $map as $hashable ) {
$hashes[] = $hashable->getHash();
}
Expand Down
6 changes: 1 addition & 5 deletions src/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use Comparable;
use Countable;
use Hashable;
use Immutable;
use InvalidArgumentException;
use Wikibase\DataModel\Snak\Snak;
use Wikibase\DataModel\Snak\SnakList;
Expand All @@ -19,7 +17,7 @@
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
class Reference implements Hashable, Comparable, Immutable, Countable {
class Reference implements Comparable, Countable {

/**
* @var SnakList
Expand Down Expand Up @@ -77,8 +75,6 @@ public function isEmpty() {
}

/**
* @see Hashable::getHash
*
* @since 0.1
*
* @return string
Expand Down
4 changes: 1 addition & 3 deletions src/Snak/Snak.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace Wikibase\DataModel\Snak;

use Comparable;
use Hashable;
use Immutable;
use Serializable;
use Wikibase\DataModel\PropertyIdProvider;

Expand All @@ -17,7 +15,7 @@
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
interface Snak extends Serializable, Hashable, Immutable, Comparable, PropertyIdProvider {
interface Snak extends Serializable, Comparable, PropertyIdProvider {

/**
* Returns a string that can be used to identify the type of snak.
Expand Down
7 changes: 2 additions & 5 deletions src/Snak/SnakList.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use ArrayObject;
use Comparable;
use Hashable;
use InvalidArgumentException;
use Traversable;
use Wikibase\DataModel\Internal\MapValueHasher;
Expand All @@ -19,7 +18,7 @@
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
* @author Addshore
*/
class SnakList extends ArrayObject implements Comparable, Hashable {
class SnakList extends ArrayObject implements Comparable {

/**
* Maps snak hashes to their offsets.
Expand Down Expand Up @@ -144,8 +143,6 @@ public function equals( $target ) {
}

/**
* @see Hashable::getHash
*
* The hash is purely value based. Order of the elements in the array is not held into account.
*
* @since 0.1
Expand Down Expand Up @@ -212,7 +209,7 @@ private function getNewOffset() {
public function offsetUnset( $index ) {
if ( $this->offsetExists( $index ) ) {
/**
* @var Hashable $element
* @var Snak $element
*/
$element = $this->offsetGet( $index );
$hash = $element->getHash();
Expand Down
2 changes: 0 additions & 2 deletions src/Snak/SnakObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ public function getPropertyId() {
}

/**
* @see Hashable::getHash
*
* @return string
*/
public function getHash() {
Expand Down
5 changes: 1 addition & 4 deletions src/Statement/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Wikibase\DataModel\Statement;

use Comparable;
use Hashable;
use InvalidArgumentException;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\PropertyIdProvider;
Expand All @@ -22,7 +21,7 @@
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
* @author Bene* < benestar.wikimedia@gmail.com >
*/
class Statement implements Hashable, Comparable, PropertyIdProvider {
class Statement implements Comparable, PropertyIdProvider {

/**
* Rank enum. Higher values are more preferred.
Expand Down Expand Up @@ -218,8 +217,6 @@ public function getRank() {
}

/**
* @see Hashable::getHash
*
* @since 0.1
*
* @return string
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/ReferenceListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Wikibase\DataModel\Tests;

use Hashable;
use InvalidArgumentException;
use Traversable;
use Wikibase\DataModel\Entity\PropertyId;
Expand Down Expand Up @@ -369,7 +368,7 @@ public function testHasReferenceHash( ReferenceList $references ) {
$this->assertFalse( $references->hasReferenceHash( '~=[,,_,,]:3' ) );

/**
* @var Hashable $reference
* @var Reference $reference
*/
foreach ( $references as $reference ) {
$this->assertTrue( $references->hasReferenceHash( $reference->getHash() ) );
Expand Down
5 changes: 0 additions & 5 deletions tests/unit/Snak/SnakListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Comparable;
use DataValues\StringValue;
use Hashable;
use InvalidArgumentException;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Snak\PropertyNoValueSnak;
Expand Down Expand Up @@ -347,10 +346,6 @@ public function equalsProvider() {
];
}

public function testHashableInterface() {
$this->assertInstanceOf( Hashable::class, new SnakList() );
}

public function testGetHash() {
$snakList = new SnakList( [ new PropertyNoValueSnak( 1 ) ] );
$hash = $snakList->getHash();
Expand Down

0 comments on commit c05df4c

Please sign in to comment.