Merge "Move some doc comments to real type hints"

This commit is contained in:
jenkins-bot 2024-03-23 01:36:33 +00:00 committed by Gerrit Code Review
commit f22dabfb80
3 changed files with 17 additions and 36 deletions

View file

@ -169,21 +169,16 @@ class CommentFormatter {
* A topic container is the information displayed when the "Show discusion activity" user
* preference is selected. This displays information such as the latest comment time, number
* of comments, and number of editors in the discussion.
*
* @param Element &$wrapperNode
* @param ?ContentCommentItem $latestReplyItem
* @param Document &$doc
* @param ContentHeadingItem &$headingItem
* @param ?Element &$bar
* @param array &$tocInfo
*/
protected static function addTopicContainer(
&$wrapperNode, $latestReplyItem, &$doc, &$headingItem, &$bar, &$tocInfo
Element &$wrapperNode,
?ContentCommentItem $latestReplyItem,
Document &$doc,
ContentHeadingItem &$headingItem,
?Element &$bar,
array &$tocInfo
) {
if ( !(
$wrapperNode instanceof Element &&
DOMCompat::getClassList( $wrapperNode )->contains( 'mw-heading' )
) ) {
if ( !DOMCompat::getClassList( $wrapperNode )->contains( 'mw-heading' ) ) {
DOMCompat::getClassList( $wrapperNode )->add( 'mw-heading' );
DOMCompat::getClassList( $wrapperNode )->add( 'mw-heading2' );
}
@ -224,16 +219,14 @@ class CommentFormatter {
/**
* Add a subscribe/unsubscribe link to the right of a heading element
*
* @param ContentHeadingItem $headingItem
* @param Document $doc
* @param Element $headingElement
* @param Element &$wrapperNode
* @param ?ContentCommentItem $latestReplyItem
* @param ?Element &$bar
*/
protected static function addSubscribeLink(
$headingItem, $doc, $headingElement, &$wrapperNode, $latestReplyItem, &$bar
ContentHeadingItem $headingItem,
Document $doc,
Element $headingElement,
Element &$wrapperNode,
?ContentCommentItem $latestReplyItem,
?Element &$bar
) {
$headingJSONEscaped = htmlspecialchars(
json_encode( static::getJsonForHeadingMarker( $headingItem ) )
@ -459,11 +452,8 @@ class CommentFormatter {
/**
* Replace placeholders for all interactive tools with nothing. This is intended for cases where
* interaction is unexpected, e.g. reply links while previewing an edit.
*
* @param string $text
* @return string
*/
public static function removeInteractiveTools( string $text ) {
public static function removeInteractiveTools( string $text ): string {
$text = strtr( $text, [
'<!--__DTREPLYBUTTONSCONTENT__-->' => '',
] );

View file

@ -19,21 +19,17 @@ class TreeWalker {
public Node $root;
public int $whatToShow;
public Node $currentNode;
/** @var callable */
/** @var callable|null */
public $filter;
private bool $isActive = false;
/**
* See https://dom.spec.whatwg.org/#interface-treewalker
*
* @param Node $root
* @param int $whatToShow
* @param callable|null $filter
*/
public function __construct(
Node $root,
int $whatToShow = NodeFilter::SHOW_ALL,
callable $filter = null
?callable $filter = null
) {
$this->currentNode = $root;
$this->filter = $filter;

View file

@ -125,12 +125,7 @@ trait TestUtils {
file_put_contents( __DIR__ . '/../' . $relPath, $html );
}
/**
* @param array $config
* @param array $data
* @return array
*/
private static function prepareConfig( array $config, array $data ) {
private static function prepareConfig( array $config, array $data ): array {
return [
'LanguageCode' => $config['wgContentLanguage'],
'ArticlePath' => $config['wgArticlePath'],