From 76544df40a46e92a74c7f4a0673267fd877760dd Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Fri, 19 Apr 2019 21:57:42 +0100 Subject: [PATCH] Migrate DiscussionParser::getEditExcerpt() to accept only RevisionRecord Follow up on Icfc85167a636bef95daab2. Bug: T221163 Depends-On: I31d819f4453032da8deb117254b954fba058e0a3 Change-Id: I3d997f9e8d4bd1566ec6fd8fe2d33be5161458b3 --- includes/DiscussionParser.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/includes/DiscussionParser.php b/includes/DiscussionParser.php index 11010a648..f69d1328c 100644 --- a/includes/DiscussionParser.php +++ b/includes/DiscussionParser.php @@ -441,12 +441,11 @@ abstract class EchoDiscussionParser { * Given a Revision object, returns a talk-page-centric interpretation * of the changes made in it. * - * @param RevisionRecord|Revision $revision Keeping Revision for back-compat with other extension that - * may need Revision before the full migration. + * @param RevisionRecord $revision * @see EchoDiscussionParser::interpretDiff * @return array[] See {@see interpretDiff} for details. */ - private static function getChangeInterpretationForRevision( $revision ) { + private static function getChangeInterpretationForRevision( RevisionRecord $revision ) { if ( $revision->getId() && isset( self::$revisionInterpretationCache[$revision->getId()] ) ) { return self::$revisionInterpretationCache[$revision->getId()]; } @@ -1213,13 +1212,12 @@ abstract class EchoDiscussionParser { /** * Extract an edit excerpt from a revision * - * @param Revision|RevisionRecord $revision Keeping Revision for back-compat with other extension that - * may need Revision before the full migration. + * @param RevisionRecord $revision * @param Language $lang * @param int $length Length in characters (not bytes); default 150 * @return string */ - public static function getEditExcerpt( $revision, Language $lang, $length = 150 ) { + public static function getEditExcerpt( RevisionRecord $revision, Language $lang, $length = 150 ) { $interpretation = self::getChangeInterpretationForRevision( $revision ); $section = self::detectSectionTitleAndText( $interpretation ); return $lang->truncateForVisual( $section['section-title'] . ' ' . $section['section-text'], $length );