Merge "CommentItem/HeadingItem: Make more constructor args required"

This commit is contained in:
jenkins-bot 2021-01-08 20:59:24 +00:00 committed by Gerrit Code Review
commit 452c6401d7
2 changed files with 4 additions and 5 deletions

View file

@ -20,12 +20,12 @@ class CommentItem extends ThreadItem {
* timestamps) for this comment. There is always at least one signature, but there may be * timestamps) for this comment. There is always at least one signature, but there may be
* multiple. The author and timestamp of the comment is determined from the first signature. * multiple. The author and timestamp of the comment is determined from the first signature.
* The last node in every signature range is a node containing the timestamp. * The last node in every signature range is a node containing the timestamp.
* @param string|null $timestamp * @param string $timestamp
* @param string|null $author Comment author's username * @param string $author Comment author's username
*/ */
public function __construct( public function __construct(
int $level, ImmutableRange $range, int $level, ImmutableRange $range,
array $signatureRanges = [], ?string $timestamp = null, ?string $author = null array $signatureRanges, string $timestamp, string $author
) { ) {
parent::__construct( 'comment', $level, $range ); parent::__construct( 'comment', $level, $range );
$this->signatureRanges = $signatureRanges; $this->signatureRanges = $signatureRanges;

View file

@ -25,8 +25,7 @@ class ThreadItemTest extends CommentTestCase {
$makeThreadItem = function ( array $arr ) use ( &$makeThreadItem, $range ) : ThreadItem { $makeThreadItem = function ( array $arr ) use ( &$makeThreadItem, $range ) : ThreadItem {
if ( $arr['type'] === 'comment' ) { if ( $arr['type'] === 'comment' ) {
$item = new CommentItem( 1, $range ); $item = new CommentItem( 1, $range, [], 'TIMESTAMP', $arr['author'] );
$item->setAuthor( $arr['author'] );
} else { } else {
$item = new HeadingItem( $range, 2 ); $item = new HeadingItem( $range, 2 );
} }