From 0de3f468c3acd5248cf7f1038410e1705f7961bd Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Thu, 20 Jul 2023 10:27:06 -0400 Subject: [PATCH] Remove unnecessary use of Parser Change-Id: Ib86ed6300ae85d7d69557a11bbd8f7b409e11d6c --- includes/CommentFormatter.php | 6 ++---- includes/Hooks/ParserHooks.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/includes/CommentFormatter.php b/includes/CommentFormatter.php index 891cf443c..69f18d80b 100644 --- a/includes/CommentFormatter.php +++ b/includes/CommentFormatter.php @@ -12,7 +12,6 @@ use MediaWiki\MediaWikiServices; use MediaWiki\User\UserIdentity; use MWExceptionHandler; use MWTimestamp; -use Parser; use ParserOutput; use Sanitizer; use Throwable; @@ -49,10 +48,9 @@ class CommentFormatter { * * @param string &$text Parser text output (modified by reference) * @param ParserOutput $pout ParserOutput object for metadata, e.g. parser limit report - * @param Parser $parser + * @param Title $title */ - public static function addDiscussionTools( string &$text, ParserOutput $pout, Parser $parser ): void { - $title = $parser->getTitle(); + public static function addDiscussionTools( string &$text, ParserOutput $pout, Title $title ): void { $start = microtime( true ); $requestId = null; diff --git a/includes/Hooks/ParserHooks.php b/includes/Hooks/ParserHooks.php index 10628b447..6bcbffcc4 100644 --- a/includes/Hooks/ParserHooks.php +++ b/includes/Hooks/ParserHooks.php @@ -65,7 +65,7 @@ class ParserHooks implements // the user doesn't have DiscussionTools features enabled. if ( HookUtils::isAvailableForTitle( $title ) ) { // This modifies $text - CommentFormatter::addDiscussionTools( $text, $pout, $parser ); + CommentFormatter::addDiscussionTools( $text, $pout, $title ); if ( $parser->getOptions()->getIsPreview() ) { $text = CommentFormatter::removeInteractiveTools( $text );