mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-23 10:29:11 +00:00
Add some missing typehints
Change-Id: Idb111dd907972d9e02dab4b26c3fc106b12b1035
This commit is contained in:
parent
dac8380021
commit
4accd2fc7e
|
@ -461,7 +461,9 @@ class CommentFormatter {
|
|||
* @param UserIdentity $user
|
||||
* @return string
|
||||
*/
|
||||
public static function getSignatureRelativeTime( MWTimestamp $timestamp, Language $lang, UserIdentity $user ) {
|
||||
public static function getSignatureRelativeTime(
|
||||
MWTimestamp $timestamp, Language $lang, UserIdentity $user
|
||||
): string {
|
||||
if ( time() - intval( $timestamp->getTimestamp() ) < 120 ) {
|
||||
$timestamp = new MWTimestamp();
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ class CommentUtils {
|
|||
* @param Node $node Node, should be a leaf node (a node with no children)
|
||||
* @return bool
|
||||
*/
|
||||
public static function isCommentContent( Node $node ) {
|
||||
public static function isCommentContent( Node $node ): bool {
|
||||
return (
|
||||
$node instanceof Text &&
|
||||
static::htmlTrim( $node->nodeValue ?? '' ) !== ''
|
||||
|
|
|
@ -284,7 +284,7 @@ abstract class ThreadItem implements JsonSerializable {
|
|||
* @param Element $node
|
||||
* @return Title|null
|
||||
*/
|
||||
private function getSinglePageTransclusionTitle( Element $node ) {
|
||||
private function getSinglePageTransclusionTitle( Element $node ): ?Title {
|
||||
$dataMw = json_decode( $node->getAttribute( 'data-mw' ) ?? '', true );
|
||||
|
||||
// Only return a page name if this is a simple single-template transclusion.
|
||||
|
@ -311,7 +311,7 @@ abstract class ThreadItem implements JsonSerializable {
|
|||
* @param Element $startNode
|
||||
* @return ImmutableRange
|
||||
*/
|
||||
private function getTransclusionRange( Element $startNode ) {
|
||||
private function getTransclusionRange( Element $startNode ): ImmutableRange {
|
||||
$endNode = $startNode;
|
||||
while (
|
||||
// Phan doesn't realize that the conditions on $nextSibling can terminate the loop
|
||||
|
|
|
@ -25,7 +25,9 @@ class MockCommentFormatter extends CommentFormatter {
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getSignatureRelativeTime( MWTimestamp $timestamp, Language $lang, UserIdentity $user ) {
|
||||
public static function getSignatureRelativeTime(
|
||||
MWTimestamp $timestamp, Language $lang, UserIdentity $user
|
||||
): string {
|
||||
// Relative times can't be used in tests, so just return a plain timestamp
|
||||
return $timestamp->getTimestamp();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue