mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-13 18:37:07 +00:00
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
This commit is contained in:
parent
23a5647ff4
commit
09d9b179f7
|
@ -54,10 +54,10 @@ abstract class ContentThreadItem implements JsonSerializable, ThreadItem {
|
||||||
$commentCount = 0;
|
$commentCount = 0;
|
||||||
$oldestReply = null;
|
$oldestReply = null;
|
||||||
$latestReply = null;
|
$latestReply = null;
|
||||||
$threadScan = static function ( ThreadItem $comment ) use (
|
$threadScan = static function ( ContentThreadItem $comment ) use (
|
||||||
&$authors, &$commentCount, &$oldestReply, &$latestReply, &$threadScan
|
&$authors, &$commentCount, &$oldestReply, &$latestReply, &$threadScan
|
||||||
) {
|
) {
|
||||||
if ( $comment instanceof CommentItem ) {
|
if ( $comment instanceof ContentCommentItem ) {
|
||||||
$author = $comment->getAuthor();
|
$author = $comment->getAuthor();
|
||||||
if ( $author ) {
|
if ( $author ) {
|
||||||
$authors[ $author ] = true;
|
$authors[ $author ] = true;
|
||||||
|
@ -101,8 +101,8 @@ abstract class ContentThreadItem implements JsonSerializable, ThreadItem {
|
||||||
*/
|
*/
|
||||||
public function getAuthorsBelow(): array {
|
public function getAuthorsBelow(): array {
|
||||||
$authors = [];
|
$authors = [];
|
||||||
$getAuthorSet = static function ( ThreadItem $threadItem ) use ( &$authors, &$getAuthorSet ) {
|
$getAuthorSet = static function ( ContentThreadItem $threadItem ) use ( &$authors, &$getAuthorSet ) {
|
||||||
if ( $threadItem instanceof CommentItem ) {
|
if ( $threadItem instanceof ContentCommentItem ) {
|
||||||
$authors[ $threadItem->getAuthor() ] = true;
|
$authors[ $threadItem->getAuthor() ] = true;
|
||||||
}
|
}
|
||||||
// Get the set of authors in the same format from each reply
|
// 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 {
|
public function getThreadItemsBelow(): array {
|
||||||
$threadItems = [];
|
$threadItems = [];
|
||||||
$getReplies = static function ( ThreadItem $threadItem ) use ( &$threadItems, &$getReplies ) {
|
$getReplies = static function ( ContentThreadItem $threadItem ) use ( &$threadItems, &$getReplies ) {
|
||||||
$threadItems[] = $threadItem;
|
$threadItems[] = $threadItem;
|
||||||
foreach ( $threadItem->getReplies() as $reply ) {
|
foreach ( $threadItem->getReplies() as $reply ) {
|
||||||
$getReplies( $reply );
|
$getReplies( $reply );
|
||||||
|
|
Loading…
Reference in a new issue