wiki.techinc.nl/includes/CommentFormatter/StringCommentIterator.php
Aryeh Gregor c435212260 Get rid of warnings on PHP 8.1
This is mostly about adding return types to methods that implement PHP
interfaces, and not passing null to core functions that want a string.
After this patch, and an update to return types in RemexHtml,
tests/phpunit/integration/ has no more errors than in PHP 8.0.

Bug: T289879
Bug: T289926
Change-Id: Ia424f5cc897070f4188ae126b5bf6a1f552db0e1
2022-06-13 04:42:20 -04:00

25 lines
492 B
PHP

<?php
namespace MediaWiki\CommentFormatter;
use ArrayIterator;
/**
* An adaptor which converts an array of strings to an iterator of CommentItem
* objects.
*
* @since 1.38
*/
class StringCommentIterator extends ArrayIterator {
/**
* @internal Use CommentBatch::strings()
* @param string[] $strings
*/
public function __construct( $strings ) {
parent::__construct( $strings );
}
public function current(): CommentItem {
return new CommentItem( parent::current() );
}
}