Skip to content

Commit ae41850

Browse files
committed
Add contract of equals to EntityDocument
1 parent 9e8868c commit ae41850

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

src/Entity/EntityDocument.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,18 @@ public function setId( $id );
5454
*/
5555
public function isEmpty();
5656

57+
/**
58+
* @see Comparable::equals
59+
*
60+
* Two entities are considered equal if they are of the same
61+
* type and have the same value. The value does not include
62+
* the id, so entities with the same value but different id
63+
* are considered equal.
64+
*
65+
* @param mixed $target
66+
*
67+
* @return bool
68+
*/
69+
public function equals( $target );
70+
5771
}

src/Entity/Item.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,7 @@ public function setStatements( StatementList $statements ) {
300300
}
301301

302302
/**
303-
* @see Comparable::equals
304-
*
305-
* Two items are considered equal if they are of the same
306-
* type and have the same value. The value does not include
307-
* the id, so entities with the same value but different id
308-
* are considered equal.
303+
* @see EntityDocument::equals
309304
*
310305
* @since 0.1
311306
*

src/Entity/Property.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,7 @@ public static function newFromType( $dataTypeId ) {
190190
}
191191

192192
/**
193-
* @see Comparable::equals
194-
*
195-
* Two properties are considered equal if they are of the same
196-
* type and have the same value. The value does not include
197-
* the id, so entities with the same value but different id
198-
* are considered equal.
193+
* @see EntityDocument::equals
199194
*
200195
* @since 0.1
201196
*

0 commit comments

Comments
 (0)