Skip to content

Commit ec1d98a

Browse files
committed
Merge in ClearableEntity from 7.5.0
1 parent bb0c87c commit ec1d98a

5 files changed

Lines changed: 29 additions & 11 deletions

File tree

RELEASE-NOTES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ This release removes integers as acceptable entity IDs.
1313
`hasElement`, `hasElementHash`, `hasValidType`, `preSetElement`, `removeByElementHash`,
1414
`removeElement`, and `setElement`.
1515
* Added periods to the list of disallowed characters in `RepositoryNameAssert`.
16-
* Added `EntityDocument::clear`
16+
* `EntityDocument` now extends `ClearableEntity`
1717

1818
#### Other changes
1919
* Un-deprecated several sitelink related shortcuts from `Item`: `addSiteLink`, `getSiteLink`,
2020
`hasLinkToSite`, and `removeSiteLink`.
2121

22+
## Version 7.5.0 (2018-05-02)
23+
24+
* Introduce `ClearableEntity` interface.
25+
2226
## Version 7.4.1 (2018-05-02)
2327

2428
* Removed `clear` from `EntityDocument`. This was a compatibility break of the interface.

src/Entity/ClearableEntity.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Wikibase\DataModel\Entity;
4+
5+
/**
6+
* Interface for Entity objects that can be cleared.
7+
*
8+
* @since 7.5
9+
*
10+
* @license GPL-2.0+
11+
*/
12+
interface ClearableEntity {
13+
14+
/**
15+
* Clears all fields of the entity that can be emptied. The entity's id stays the same.
16+
*
17+
* @since 7.5
18+
*/
19+
public function clear();
20+
21+
}

src/Entity/EntityDocument.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
1616
* @author Bene* < benestar.wikimedia@gmail.com >
1717
*/
18-
interface EntityDocument extends Comparable {
18+
interface EntityDocument extends Comparable, ClearableEntity {
1919

2020
/**
2121
* Returns a type identifier for the entity, e.g. "item" or "property".
@@ -88,11 +88,4 @@ public function equals( $target );
8888
*/
8989
public function copy();
9090

91-
/**
92-
* Clears all fields of the entity that can be emptied. The entity's id stays the same.
93-
*
94-
* @since 7.4
95-
*/
96-
public function clear();
97-
9891
}

src/Entity/Item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public function __clone() {
343343
}
344344

345345
/**
346-
* @since 7.4
346+
* @since 7.5
347347
*/
348348
public function clear() {
349349
$this->fingerprint = new Fingerprint();

src/Entity/Property.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public function __clone() {
298298
}
299299

300300
/**
301-
* @since 7.4
301+
* @since 7.5
302302
*/
303303
public function clear() {
304304
$this->fingerprint = new Fingerprint();

0 commit comments

Comments
 (0)