From 5b2d38c750aa3e32b81c7bed739af981c0a31106 Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Sat, 20 Apr 2019 22:54:28 +0100 Subject: [PATCH] MWMessagePack: Deprecate MWMessagePack class and its method Usage ===== https://codesearch.wmflabs.org/search/?q=%5CbMWMessagePack%5Cb&i=nope&files=&repos= Bug: T220313 Change-Id: I3648f8c14116f924d835f68077f46333d892a038 --- RELEASE-NOTES-1.34 | 1 + includes/libs/MWMessagePack.php | 4 ++++ tests/phpunit/includes/libs/MWMessagePackTest.php | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index 5cb3dbe1f0..786dae21df 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -177,6 +177,7 @@ because of Phabricator reports. deprecated. Use MediaWikiServices instead. * The getSubjectPage, getTalkPage, and getOtherPage of Title are deprecated. Use NamespaceInfo's getSubjectPage, getTalkPage, and getAssociatedPage. +* MWMessagePack class, no longer used, has been deprecated in 1.34. === Other changes in 1.34 === * … diff --git a/includes/libs/MWMessagePack.php b/includes/libs/MWMessagePack.php index be7e93d53e..84b7b3e102 100644 --- a/includes/libs/MWMessagePack.php +++ b/includes/libs/MWMessagePack.php @@ -31,6 +31,7 @@ * * @since 1.23 * @file + * @deprecated since 1.34, no longer used */ class MWMessagePack { /** @var bool|null Whether current system is bigendian. **/ @@ -43,11 +44,14 @@ class MWMessagePack { * (both indexed and associative) types. Object serialization is not * supported. * + * @deprecated since 1.34, no longer used + * * @param mixed $value * @return string * @throws InvalidArgumentException if $value is an unsupported type or too long a string */ public static function pack( $value ) { + wfDeprecated( __METHOD__, '1.34' ); if ( self::$bigendian === null ) { self::$bigendian = pack( 'S', 1 ) === pack( 'n', 1 ); } diff --git a/tests/phpunit/includes/libs/MWMessagePackTest.php b/tests/phpunit/includes/libs/MWMessagePackTest.php index 695a734153..3890cf8e19 100644 --- a/tests/phpunit/includes/libs/MWMessagePackTest.php +++ b/tests/phpunit/includes/libs/MWMessagePackTest.php @@ -3,7 +3,7 @@ * PHP Unit tests for MWMessagePack * @covers MWMessagePack */ -class MWMessagePackTest extends PHPUnit\Framework\TestCase { +class MWMessagePackTest extends MediaWikiTestCase { use MediaWikiCoversValidator; @@ -71,6 +71,7 @@ class MWMessagePackTest extends PHPUnit\Framework\TestCase { * @dataProvider providePacks */ public function testPack( $type, $value, $expected ) { + $this->hideDeprecated( MWMessagePack::class . '::pack' ); $actual = bin2hex( MWMessagePack::pack( $value ) ); $this->assertEquals( $expected, $actual, $type ); } -- 2.20.1