From c4145b2f087c0d8f46191456aa0e4cf83e7b1ba1 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Fri, 8 Sep 2017 19:12:37 -0700 Subject: [PATCH] Simplify OutputPage constructor Make it impossible to instantiate this class without passing it context. This appears to be the oldest wfDeprecated() in MediaWiki. All callers have been updated. Change-Id: I00b9e283ad22c6274b358063b9f9e60fe93d5ee7 --- RELEASE-NOTES-1.31 | 4 +++- includes/OutputPage.php | 11 +++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index efadf9abb1..498c473bb1 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -45,7 +45,9 @@ changes to languages because of Phabricator reports. * The global function wfBCP47 was renamed to LanguageCode::bcp47. * The global function wfBCP47 is now deprecated. * The global function wfCountDown() is now deprecated in favor of - Maintenance::countDown(). + Maintenance::countDown() +* The OutputPage class constructor now requires a context parameter, + (instantiating without context was deprecated in 1.18) == Compatibility == MediaWiki 1.31 requires PHP 5.5.9 or later. There is experimental support for diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 20b2c3c32d..7a2b7dfe1a 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -314,15 +314,10 @@ class OutputPage extends ContextSource { * Constructor for OutputPage. This should not be called directly. * Instead a new RequestContext should be created and it will implicitly create * a OutputPage tied to that context. - * @param IContextSource|null $context + * @param IContextSource $context */ - function __construct( IContextSource $context = null ) { - if ( $context === null ) { - # Extensions should use `new RequestContext` instead of `new OutputPage` now. - wfDeprecated( __METHOD__, '1.18' ); - } else { - $this->setContext( $context ); - } + function __construct( IContextSource $context ) { + $this->setContext( $context ); } /** -- 2.20.1