Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Wikibase DataModel Serialization release notes

## 3.0.0 (dev)

* Removed the deprecated `SerializerFactory` options
`OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH`,
`OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH` and
`OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH`
(use `OPTION_SERIALIZE_SNAKS_WITHOUT_HASH` instead)

## 2.7.0 (2018-03-28)

* Fixed `AliasGroupListDeserializer` and `TermListDeserializer` misbehaving when confronted with
Expand Down
46 changes: 6 additions & 40 deletions src/SerializerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,11 @@ class SerializerFactory {
const OPTION_DEFAULT = 0;
/** @since 1.2.0 */
const OPTION_OBJECTS_FOR_MAPS = 1;
/**
* @since 1.7.0
* @deprecated since 2.5 use OPTION_SERIALIZE_SNAKS_WITHOUT_HASH
*/
const OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH = 2;
/**
* @since 1.7.0
* @deprecated since 2.5 use OPTION_SERIALIZE_SNAKS_WITHOUT_HASH
*/
const OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH = 4;
/**
* @since 1.7.0
* @deprecated since 2.5 use OPTION_SERIALIZE_SNAKS_WITHOUT_HASH
*/
const OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH = 8;
/**
* Omit hashes when serializing snaks.
* @since 2.5.0
*/
const OPTION_SERIALIZE_SNAKS_WITHOUT_HASH = 14; /* =
self::OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH |
self::OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH |
self::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH; */
const OPTION_SERIALIZE_SNAKS_WITHOUT_HASH = 2;

/**
* @var int
Expand Down Expand Up @@ -95,22 +77,8 @@ private function shouldUseObjectsForMaps() {
/**
* @return bool
*/
private function shouldSerializeMainSnaksWithHash() {
return !(bool)( $this->options & self::OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH );
}

/**
* @return bool
*/
private function shouldSerializeQualifierSnaksWithHash() {
return !(bool)( $this->options & self::OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH );
}

/**
* @return bool
*/
private function shouldSerializeReferenceSnaksWithHash() {
return !(bool)( $this->options & self::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH );
private function shouldSerializeSnaksWithHash() {
return !(bool)( $this->options & self::OPTION_SERIALIZE_SNAKS_WITHOUT_HASH );
}

/**
Expand Down Expand Up @@ -190,8 +158,8 @@ public function newStatementListSerializer() {
*/
public function newStatementSerializer() {
return new StatementSerializer(
$this->newSnakSerializer( $this->shouldSerializeMainSnaksWithHash() ),
$this->newSnakListSerializer( $this->shouldSerializeQualifierSnaksWithHash() ),
$this->newSnakSerializer( $this->shouldSerializeSnaksWithHash() ),
$this->newSnakListSerializer( $this->shouldSerializeSnaksWithHash() ),
$this->newReferencesSerializer()
);
}
Expand All @@ -212,9 +180,7 @@ public function newReferencesSerializer() {
*/
public function newReferenceSerializer() {
return new ReferenceSerializer(
$this->newSnakListSerializer(
$this->shouldSerializeReferenceSnaksWithHash()
)
$this->newSnakListSerializer( $this->shouldSerializeSnaksWithHash() )
);
}

Expand Down
11 changes: 0 additions & 11 deletions tests/unit/SerializerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,4 @@ public function testNewAliasGroupListSerializer() {
);
}

public function testSerializeSnaksWithoutHashConstant() {
$this->assertSame(
// expected:
SerializerFactory::OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH |
SerializerFactory::OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH |
SerializerFactory::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH,
// actual:
SerializerFactory::OPTION_SERIALIZE_SNAKS_WITHOUT_HASH
);
}

}