Skip to content

Commit deff3ba

Browse files
Jaime NucheWMDE bot
authored andcommitted
Revert "EntityId: Hard-deprecate Serializable methods"
This reverts commit 1af704088a038e7d522d34e443bf71c52c72e6c4. Reason for revert: Huge error spike in prod Change-Id: I26ebf9069a5906b6b81305b170d958757a47cb57
1 parent 48ebd96 commit deff3ba

7 files changed

Lines changed: 5 additions & 24 deletions

File tree

RELEASE-NOTES.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
* Removed support for calling `Statement::addNewReference()` and `StatementList` constructor with a
66
single array argument, which was deprecated in `Version 9.6.0 (2021-03-31)`. These should now be
77
called with a variadic argument list.
8-
* Added `__serialize()` and `__unserialize()` methods to the `EntityId` interface,
9-
and deprecated the `serialize()` and `unserialize()` methods.
8+
* Added `__serialize()` and `__unserialize()` methods to the `EntityId` interface.
109
* Added native type hints to the `Statement` and `StatementList` classes
1110
* Added `strict_types=1` to `Statement.php`, `StatementList.php`, and related test files
1211
* Removed support for repository names in entity IDs (e.g. `foo:Q1234`)

src/Entity/ItemId.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public function __serialize(): array {
7171
* @return string
7272
*/
7373
public function serialize() {
74-
wfDeprecated( __METHOD__, '1.41' );
7574
return $this->serialization;
7675
}
7776

@@ -85,7 +84,6 @@ public function __unserialize( array $data ): void {
8584
* @param string $serialized
8685
*/
8786
public function unserialize( $serialized ) {
88-
wfDeprecated( __METHOD__, '1.41' );
8987
$array = json_decode( $serialized );
9088
$this->serialization = is_array( $array ) ? $array[1] : $serialized;
9189
$this->serialization = $this->serialization ?? '';

src/Entity/NumericPropertyId.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public function __serialize(): array {
6565
* @return string
6666
*/
6767
public function serialize() {
68-
wfDeprecated( __METHOD__, '1.41' );
6968
return $this->serialization;
7069
}
7170

@@ -79,7 +78,6 @@ public function __unserialize( array $data ): void {
7978
* @param string $serialized
8079
*/
8180
public function unserialize( $serialized ) {
82-
wfDeprecated( __METHOD__, '1.41' );
8381
$array = json_decode( $serialized );
8482
$this->serialization = is_array( $array ) ? $array[1] : $serialized;
8583
$this->serialization = $this->serialization ?? '';

tests/unit/Entity/EntityIdTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Wikibase\DataModel\Tests\Entity;
44

55
use InvalidArgumentException;
6-
use MediaWikiUnitTestCase;
76
use ReflectionClass;
87
use Wikibase\DataModel\Entity\EntityId;
98
use Wikibase\DataModel\Entity\ItemId;
@@ -22,7 +21,7 @@
2221
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
2322
* @author John Erling Blad < jeblad@gmail.com >
2423
*/
25-
class EntityIdTest extends MediaWikiUnitTestCase {
24+
class EntityIdTest extends \PHPUnit\Framework\TestCase {
2625

2726
public static function instanceProvider() {
2827
$ids = [];
@@ -74,9 +73,6 @@ public static function deserializationCompatibilityProvider(): array {
7473
* @dataProvider deserializationCompatibilityProvider
7574
*/
7675
public function testDeserializationCompatibility( $expected, $serialization ) {
77-
if ( str_starts_with( $serialization, 'C:' ) ) {
78-
$this->expectDeprecationAndContinue( '/::unserialize/' );
79-
}
8076
$this->assertEquals(
8177
$expected,
8278
unserialize( $serialization )

tests/unit/Entity/EntityIdValueTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Wikibase\DataModel\Tests\Entity;
44

55
use DataValues\IllegalValueException;
6-
use MediaWikiUnitTestCase;
76
use Wikibase\DataModel\Entity\EntityId;
87
use Wikibase\DataModel\Entity\EntityIdValue;
98
use Wikibase\DataModel\Entity\ItemId;
@@ -21,7 +20,7 @@
2120
* @author Thiemo Kreuz
2221
* @author Daniel Kinzler
2322
*/
24-
class EntityIdValueTest extends MediaWikiUnitTestCase {
23+
class EntityIdValueTest extends \PHPUnit\Framework\TestCase {
2524

2625
public function testCanConstruct() {
2726
$entityId = new ItemId( 'Q123' );
@@ -161,9 +160,6 @@ public static function provideDeserializationCompatibility() {
161160
* @param EntityIdValue $expected
162161
*/
163162
public function testDeserializationCompatibility( $serialized, EntityIdValue $expected ) {
164-
if ( str_contains( $serialized, 'C:32:"Wikibase\DataModel\Entity\ItemId"' ) ) {
165-
$this->expectDeprecationAndContinue( '/::unserialize/' );
166-
}
167163
$id = unserialize( $serialized );
168164

169165
$this->assertEquals( $expected, $id );

tests/unit/Entity/ItemIdTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Wikibase\DataModel\Tests\Entity;
44

55
use InvalidArgumentException;
6-
use MediaWikiUnitTestCase;
76
use Wikibase\DataModel\Entity\ItemId;
87

98
/**
@@ -15,7 +14,7 @@
1514
* @license GPL-2.0-or-later
1615
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
1716
*/
18-
class ItemIdTest extends MediaWikiUnitTestCase {
17+
class ItemIdTest extends \PHPUnit\Framework\TestCase {
1918

2019
/**
2120
* @dataProvider idSerializationProvider
@@ -87,7 +86,6 @@ public function testGetEntityType() {
8786

8887
public function testSerialize() {
8988
$id = new ItemId( 'Q1' );
90-
$this->expectDeprecationAndContinue( '/ItemId::serialize/' );
9189
$this->assertSame( 'Q1', $id->serialize() );
9290
}
9391

@@ -96,7 +94,6 @@ public function testSerialize() {
9694
*/
9795
public function testUnserialize( $json, $expected ) {
9896
$id = new ItemId( 'Q1' );
99-
$this->expectDeprecationAndContinue( '/ItemId::unserialize/' );
10097
$id->unserialize( $json );
10198
$this->assertSame( $expected, $id->getSerialization() );
10299
}

tests/unit/Entity/NumericPropertyIdTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Wikibase\DataModel\Tests\Entity;
44

55
use InvalidArgumentException;
6-
use MediaWikiUnitTestCase;
76
use Wikibase\DataModel\Entity\NumericPropertyId;
87

98
/**
@@ -14,7 +13,7 @@
1413
*
1514
* @license GPL-2.0-or-later
1615
*/
17-
class NumericPropertyIdTest extends MediaWikiUnitTestCase {
16+
class NumericPropertyIdTest extends \PHPUnit\Framework\TestCase {
1817

1918
/**
2019
* @dataProvider idSerializationProvider
@@ -86,7 +85,6 @@ public function testGetEntityType() {
8685

8786
public function testSerialize() {
8887
$id = new NumericPropertyId( 'P1' );
89-
$this->expectDeprecationAndContinue( '/NumericPropertyId::serialize/' );
9088
$this->assertSame( 'P1', $id->serialize() );
9189
}
9290

@@ -95,7 +93,6 @@ public function testSerialize() {
9593
*/
9694
public function testUnserialize( $json, $expected ) {
9795
$id = new NumericPropertyId( 'P1' );
98-
$this->expectDeprecationAndContinue( '/NumericPropertyId::unserialize/' );
9996
$id->unserialize( $json );
10097
$this->assertSame( $expected, $id->getSerialization() );
10198
}

0 commit comments

Comments
 (0)