Skip to content

Commit c3b03f7

Browse files
lucaswerkmeisterthiemowmde
authored andcommitted
Remove deprecated options to use snak hashes
This follows through with the deprecation of the separate options in 4f558c9, leaving only the single unified option behind to control whether snak hashes of any kind are included or not.
1 parent bf2de9a commit c3b03f7

3 files changed

Lines changed: 14 additions & 51 deletions

File tree

RELEASE-NOTES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Wikibase DataModel Serialization release notes
22

3+
## 3.0.0 (dev)
4+
5+
* Removed the deprecated `SerializerFactory` options
6+
`OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH`,
7+
`OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH` and
8+
`OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH`
9+
(use `OPTION_SERIALIZE_SNAKS_WITHOUT_HASH` instead)
10+
311
## 2.7.0 (2018-03-28)
412

513
* Fixed `AliasGroupListDeserializer` and `TermListDeserializer` misbehaving when confronted with

src/SerializerFactory.php

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,11 @@ class SerializerFactory {
3636
const OPTION_DEFAULT = 0;
3737
/** @since 1.2.0 */
3838
const OPTION_OBJECTS_FOR_MAPS = 1;
39-
/**
40-
* @since 1.7.0
41-
* @deprecated since 2.5 use OPTION_SERIALIZE_SNAKS_WITHOUT_HASH
42-
*/
43-
const OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH = 2;
44-
/**
45-
* @since 1.7.0
46-
* @deprecated since 2.5 use OPTION_SERIALIZE_SNAKS_WITHOUT_HASH
47-
*/
48-
const OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH = 4;
49-
/**
50-
* @since 1.7.0
51-
* @deprecated since 2.5 use OPTION_SERIALIZE_SNAKS_WITHOUT_HASH
52-
*/
53-
const OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH = 8;
5439
/**
5540
* Omit hashes when serializing snaks.
5641
* @since 2.5.0
5742
*/
58-
const OPTION_SERIALIZE_SNAKS_WITHOUT_HASH = 14; /* =
59-
self::OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH |
60-
self::OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH |
61-
self::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH; */
43+
const OPTION_SERIALIZE_SNAKS_WITHOUT_HASH = 2;
6244

6345
/**
6446
* @var int
@@ -95,22 +77,8 @@ private function shouldUseObjectsForMaps() {
9577
/**
9678
* @return bool
9779
*/
98-
private function shouldSerializeMainSnaksWithHash() {
99-
return !(bool)( $this->options & self::OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH );
100-
}
101-
102-
/**
103-
* @return bool
104-
*/
105-
private function shouldSerializeQualifierSnaksWithHash() {
106-
return !(bool)( $this->options & self::OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH );
107-
}
108-
109-
/**
110-
* @return bool
111-
*/
112-
private function shouldSerializeReferenceSnaksWithHash() {
113-
return !(bool)( $this->options & self::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH );
80+
private function shouldSerializeSnaksWithHash() {
81+
return !(bool)( $this->options & self::OPTION_SERIALIZE_SNAKS_WITHOUT_HASH );
11482
}
11583

11684
/**
@@ -190,8 +158,8 @@ public function newStatementListSerializer() {
190158
*/
191159
public function newStatementSerializer() {
192160
return new StatementSerializer(
193-
$this->newSnakSerializer( $this->shouldSerializeMainSnaksWithHash() ),
194-
$this->newSnakListSerializer( $this->shouldSerializeQualifierSnaksWithHash() ),
161+
$this->newSnakSerializer( $this->shouldSerializeSnaksWithHash() ),
162+
$this->newSnakListSerializer( $this->shouldSerializeSnaksWithHash() ),
195163
$this->newReferencesSerializer()
196164
);
197165
}
@@ -212,9 +180,7 @@ public function newReferencesSerializer() {
212180
*/
213181
public function newReferenceSerializer() {
214182
return new ReferenceSerializer(
215-
$this->newSnakListSerializer(
216-
$this->shouldSerializeReferenceSnaksWithHash()
217-
)
183+
$this->newSnakListSerializer( $this->shouldSerializeSnaksWithHash() )
218184
);
219185
}
220186

tests/unit/SerializerFactoryTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,4 @@ public function testNewAliasGroupListSerializer() {
159159
);
160160
}
161161

162-
public function testSerializeSnaksWithoutHashConstant() {
163-
$this->assertSame(
164-
// expected:
165-
SerializerFactory::OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH |
166-
SerializerFactory::OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH |
167-
SerializerFactory::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH,
168-
// actual:
169-
SerializerFactory::OPTION_SERIALIZE_SNAKS_WITHOUT_HASH
170-
);
171-
}
172-
173162
}

0 commit comments

Comments
 (0)