From 7dd251691d0ce4695305e9aa5cb8c4e643ed3048 Mon Sep 17 00:00:00 2001 From: DannyS712 Date: Fri, 12 Mar 2021 03:42:40 +0000 Subject: [PATCH] Remove PageProps::overrideInstance() Test-only code Change-Id: Ib9fd9ed315078e42beae7ca24f5eec457b5f48d6 --- RELEASE-NOTES-1.36 | 6 +++--- includes/PageProps.php | 32 -------------------------------- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/RELEASE-NOTES-1.36 b/RELEASE-NOTES-1.36 index 3af50492d44..7938f5f64f9 100644 --- a/RELEASE-NOTES-1.36 +++ b/RELEASE-NOTES-1.36 @@ -416,6 +416,9 @@ because of Phabricator reports. * The following functions from the Title class have been removed: - countRevisionsBetween - getAuthorsBetween +* The PageProps class was converted to a service. PageProps::overrideInstance + was removed, and MediaWikiServices::redefineService should be used + instead. * The $wgContLang variable, deprecated in 1.32, was removed. You can instead use MediaWikiServices::getInstance()->getContentLanguage(). * … @@ -456,9 +459,6 @@ because of Phabricator reports. OutputPage::getIndicators. * Skin::makeVariablesScript() has been deprecated. Use ResourceLoader::makeInlineScript() instead. -* The PageProps class was converted to a service. PageProps::overrideInstance - was deprecated, and MediaWikiServices::redefineService should be used - instead. * Title::nameOf() is deprecated; use Title::newFromID()->getPrefixedDBkey() instead. * DatabaseBlock::insert, DatabaseBlock::update, DatabaseBlock::purgeExpired and diff --git a/includes/PageProps.php b/includes/PageProps.php index da672ff5705..4141790b039 100644 --- a/includes/PageProps.php +++ b/includes/PageProps.php @@ -23,7 +23,6 @@ use MediaWiki\Cache\LinkBatchFactory; use MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\ILoadBalancer; -use Wikimedia\ScopedCallback; /** * Gives access to properties of a page. @@ -45,37 +44,6 @@ class PageProps { /** @var MapCacheLRU */ private $cache = null; - /** - * Overrides the default instance of this class - * This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined. - * - * @since 1.27 - * @deprecated since 1.36 - * - * @param PageProps $store - * - * @return ScopedCallback to reset the overridden value - * @throws MWException - */ - public static function overrideInstance( PageProps $store ) { - if ( !defined( 'MW_PHPUNIT_TEST' ) ) { - throw new MWException( - 'Cannot override ' . __CLASS__ . 'default instance in operation.' - ); - } - - MediaWikiServices::getInstance()->redefineService( - 'PageProps', - static function () use ( $store ) { - return $store; - } - ); - - return new ScopedCallback( static function () { - MediaWikiServices::getInstance()->resetServiceForTesting( 'PageProps' ); - } ); - } - /** * @return PageProps */