From 09d9b179f76924d1d04ce3627c6cc30e11b68936 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 6 Sep 2022 14:35:52 +0100 Subject: [PATCH] Content*Item: Use more specific Content*Item classes within functions We can't use these is class method function signatures, but we can use within the functions themselves. Change-Id: Ic24e47d6647226172a3bfacd81398d26143d98e4 --- includes/ThreadItem/ContentThreadItem.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/ThreadItem/ContentThreadItem.php b/includes/ThreadItem/ContentThreadItem.php index f78e01f62..d581d6b26 100644 --- a/includes/ThreadItem/ContentThreadItem.php +++ b/includes/ThreadItem/ContentThreadItem.php @@ -54,10 +54,10 @@ abstract class ContentThreadItem implements JsonSerializable, ThreadItem { $commentCount = 0; $oldestReply = null; $latestReply = null; - $threadScan = static function ( ThreadItem $comment ) use ( + $threadScan = static function ( ContentThreadItem $comment ) use ( &$authors, &$commentCount, &$oldestReply, &$latestReply, &$threadScan ) { - if ( $comment instanceof CommentItem ) { + if ( $comment instanceof ContentCommentItem ) { $author = $comment->getAuthor(); if ( $author ) { $authors[ $author ] = true; @@ -101,8 +101,8 @@ abstract class ContentThreadItem implements JsonSerializable, ThreadItem { */ public function getAuthorsBelow(): array { $authors = []; - $getAuthorSet = static function ( ThreadItem $threadItem ) use ( &$authors, &$getAuthorSet ) { - if ( $threadItem instanceof CommentItem ) { + $getAuthorSet = static function ( ContentThreadItem $threadItem ) use ( &$authors, &$getAuthorSet ) { + if ( $threadItem instanceof ContentCommentItem ) { $authors[ $threadItem->getAuthor() ] = true; } // Get the set of authors in the same format from each reply @@ -126,7 +126,7 @@ abstract class ContentThreadItem implements JsonSerializable, ThreadItem { */ public function getThreadItemsBelow(): array { $threadItems = []; - $getReplies = static function ( ThreadItem $threadItem ) use ( &$threadItems, &$getReplies ) { + $getReplies = static function ( ContentThreadItem $threadItem ) use ( &$threadItems, &$getReplies ) { $threadItems[] = $threadItem; foreach ( $threadItem->getReplies() as $reply ) { $getReplies( $reply );