Skip to content

Commit 71febe0

Browse files
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 11ff3ca commit 71febe0

File tree

3 files changed

+14
-51
lines changed

3 files changed

+14
-51
lines changed

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.5.0 (2017-08-30)
412

513
* Removed MediaWiki integration files

src/SerializerFactory.php

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

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

11583
/**
@@ -188,8 +156,8 @@ public function newStatementListSerializer() {
188156
*/
189157
public function newStatementSerializer() {
190158
return new StatementSerializer(
191-
$this->newSnakSerializer( $this->shouldSerializeMainSnaksWithHash() ),
192-
$this->newSnakListSerializer( $this->shouldSerializeQualifierSnaksWithHash() ),
159+
$this->newSnakSerializer( $this->shouldSerializeSnaksWithHash() ),
160+
$this->newSnakListSerializer( $this->shouldSerializeSnaksWithHash() ),
193161
$this->newReferencesSerializer()
194162
);
195163
}
@@ -210,9 +178,7 @@ public function newReferencesSerializer() {
210178
*/
211179
public function newReferenceSerializer() {
212180
return new ReferenceSerializer(
213-
$this->newSnakListSerializer(
214-
$this->shouldSerializeReferenceSnaksWithHash()
215-
)
181+
$this->newSnakListSerializer( $this->shouldSerializeSnaksWithHash() )
216182
);
217183
}
218184

tests/unit/SerializerFactoryTest.php

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

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

0 commit comments

Comments
 (0)