mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 17:51:09 +00:00
build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0 * php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0 Change-Id: I5c152292e83e7f3441e2c08b7d0ad23ac90f194b
This commit is contained in:
parent
c618139b9c
commit
12fb65b9f1
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"require-dev": {
|
||||
"mediawiki/mediawiki-codesniffer": "35.0.0",
|
||||
"mediawiki/mediawiki-codesniffer": "36.0.0",
|
||||
"mediawiki/mediawiki-phan-config": "0.10.6",
|
||||
"mediawiki/minus-x": "1.1.1",
|
||||
"php-parallel-lint/php-console-highlighter": "0.5.0",
|
||||
"php-parallel-lint/php-parallel-lint": "1.2.0"
|
||||
"php-parallel-lint/php-parallel-lint": "1.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
|
|
|
@ -229,7 +229,7 @@ class CommentFormatter {
|
|||
|
||||
$text = preg_replace_callback(
|
||||
'/<!--__DTSUBSCRIBE__(.*?)-->/',
|
||||
function ( $matches ) use ( $doc, $itemsByName ) {
|
||||
static function ( $matches ) use ( $doc, $itemsByName ) {
|
||||
$itemName = $matches[1];
|
||||
$isSubscribed = isset( $itemsByName[ $itemName ] ) && !$itemsByName[ $itemName ]->isMuted();
|
||||
$subscribe = $doc->createElement( 'span' );
|
||||
|
|
|
@ -162,7 +162,7 @@ class CommentParser {
|
|||
* @return string Regular expression
|
||||
*/
|
||||
private static function regexpAlternateGroup( array $values ) : string {
|
||||
return '(' . implode( '|', array_map( function ( string $x ) {
|
||||
return '(' . implode( '|', array_map( static function ( string $x ) {
|
||||
return preg_quote( $x, '/' );
|
||||
}, $values ) ) . ')';
|
||||
}
|
||||
|
@ -319,13 +319,13 @@ class CommentParser {
|
|||
private function getTimestampParser(
|
||||
string $contLangVariant, string $format, ?array $digits, string $localTimezone, array $tzAbbrs
|
||||
) : callable {
|
||||
$untransformDigits = function ( string $text ) use ( $digits ) {
|
||||
$untransformDigits = static function ( string $text ) use ( $digits ) {
|
||||
if ( !$digits ) {
|
||||
return $text;
|
||||
}
|
||||
return preg_replace_callback(
|
||||
'/[' . implode( '', $digits ) . ']/u',
|
||||
function ( array $m ) use ( $digits ) {
|
||||
static function ( array $m ) use ( $digits ) {
|
||||
return (string)array_search( $m[0], $digits );
|
||||
},
|
||||
$text
|
||||
|
@ -387,7 +387,7 @@ class CommentParser {
|
|||
if ( is_array( $match[0] ) ) {
|
||||
// Strip PREG_OFFSET_CAPTURE data
|
||||
unset( $match['offset'] );
|
||||
$match = array_map( function ( array $tuple ) {
|
||||
$match = array_map( static function ( array $tuple ) {
|
||||
return $tuple[0];
|
||||
}, $match );
|
||||
}
|
||||
|
|
|
@ -317,12 +317,12 @@ class CommentUtils {
|
|||
$startOffset = $item->getRange()->startOffset;
|
||||
$endOffset = $item->getRange()->endOffset;
|
||||
|
||||
$isIgnored = function ( $node ) {
|
||||
$isIgnored = static function ( $node ) {
|
||||
// Ignore empty text nodes
|
||||
return $node->nodeType === XML_TEXT_NODE && CommentUtils::htmlTrim( $node->nodeValue ) === '';
|
||||
};
|
||||
|
||||
$isFirstNonemptyChild = function ( $node ) use ( $isIgnored ) {
|
||||
$isFirstNonemptyChild = static function ( $node ) use ( $isIgnored ) {
|
||||
while ( ( $node = $node->previousSibling ) ) {
|
||||
if ( !$isIgnored( $node ) ) {
|
||||
return false;
|
||||
|
@ -331,7 +331,7 @@ class CommentUtils {
|
|||
return true;
|
||||
};
|
||||
|
||||
$isLastNonemptyChild = function ( $node ) use ( $isIgnored ) {
|
||||
$isLastNonemptyChild = static function ( $node ) use ( $isIgnored ) {
|
||||
while ( ( $node = $node->nextSibling ) ) {
|
||||
if ( !$isIgnored( $node ) ) {
|
||||
return false;
|
||||
|
|
|
@ -78,7 +78,7 @@ class Data {
|
|||
// Avoid DateTimeZone::listAbbreviations(), it returns some half-baked list that is different
|
||||
// from the timezone data used by everything else in PHP.
|
||||
$timezoneAbbrs = array_values( array_unique(
|
||||
array_map( function ( $transition ) {
|
||||
array_map( static function ( $transition ) {
|
||||
return $transition['abbr'];
|
||||
}, ( new DateTimeZone( $localTimezone ) )->getTransitions() )
|
||||
) );
|
||||
|
@ -86,7 +86,7 @@ class Data {
|
|||
$data['timezones'] = [];
|
||||
foreach ( $langConv->getVariants() as $variant ) {
|
||||
$data['timezones'][$variant] = array_combine(
|
||||
array_map( function ( string $tzMsg ) use ( $lang, $langConv, $variant ) {
|
||||
array_map( static function ( string $tzMsg ) use ( $lang, $langConv, $variant ) {
|
||||
// MWTimestamp::getTimezoneMessage()
|
||||
// Parser::pstPass2()
|
||||
// Messages used here: 'timezone-utc' and so on
|
||||
|
@ -119,7 +119,7 @@ class Data {
|
|||
foreach ( $langConv->getVariants() as $variant ) {
|
||||
$data['contLangMessages'][$variant] = array_combine(
|
||||
$messagesKeys,
|
||||
array_map( function ( $key ) use ( $lang, $langConv, $variant ) {
|
||||
array_map( static function ( $key ) use ( $lang, $langConv, $variant ) {
|
||||
$text = wfMessage( $key )->inLanguage( $lang )->text();
|
||||
return $langConv->translate( $text, $variant );
|
||||
}, $messagesKeys )
|
||||
|
@ -229,7 +229,7 @@ class Data {
|
|||
) : array {
|
||||
return array_combine(
|
||||
$messagesKeys,
|
||||
array_map( function ( $key ) {
|
||||
array_map( static function ( $key ) {
|
||||
return wfMessage( $key )->inContentLanguage()->text();
|
||||
}, $messagesKeys )
|
||||
);
|
||||
|
|
|
@ -66,7 +66,7 @@ class PreferenceHooks implements
|
|||
|
||||
$preferences['discussiontools-editmode'] = [
|
||||
'type' => 'api',
|
||||
'validation-callback' => function ( $value ) {
|
||||
'validation-callback' => static function ( $value ) {
|
||||
return in_array( $value, [ '', 'source', 'visual' ], true );
|
||||
},
|
||||
];
|
||||
|
|
|
@ -155,7 +155,7 @@ class EventDispatcher {
|
|||
);
|
||||
|
||||
// TODD: Have this return an Iterator instead?
|
||||
$users = array_map( function ( SubscriptionItem $item ) {
|
||||
$users = array_map( static function ( SubscriptionItem $item ) {
|
||||
return $item->getUserIdentity();
|
||||
}, $subscriptionItems );
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ abstract class ThreadItem implements JsonSerializable {
|
|||
'type' => $this->type,
|
||||
'level' => $this->level,
|
||||
'id' => $this->id,
|
||||
'replies' => array_map( function ( ThreadItem $comment ) {
|
||||
'replies' => array_map( static function ( ThreadItem $comment ) {
|
||||
return $comment->getId();
|
||||
}, $this->replies )
|
||||
];
|
||||
|
@ -63,7 +63,7 @@ abstract class ThreadItem implements JsonSerializable {
|
|||
*/
|
||||
public function getAuthorsBelow() : array {
|
||||
$authors = [];
|
||||
$getAuthorSet = function ( ThreadItem $comment ) use ( &$authors, &$getAuthorSet ) {
|
||||
$getAuthorSet = static function ( ThreadItem $comment ) use ( &$authors, &$getAuthorSet ) {
|
||||
if ( $comment instanceof CommentItem ) {
|
||||
$author = $comment->getAuthor();
|
||||
if ( $author ) {
|
||||
|
|
|
@ -23,7 +23,7 @@ class ThreadItemTest extends IntegrationTestCase {
|
|||
$node = $doc->createElement( 'div' );
|
||||
$range = new ImmutableRange( $node, 0, $node, 0 );
|
||||
|
||||
$makeThreadItem = function ( array $arr ) use ( &$makeThreadItem, $range ) : ThreadItem {
|
||||
$makeThreadItem = static function ( array $arr ) use ( &$makeThreadItem, $range ) : ThreadItem {
|
||||
if ( $arr['type'] === 'comment' ) {
|
||||
$item = new CommentItem( 1, $range, [], 'TIMESTAMP', $arr['author'] );
|
||||
} else {
|
||||
|
|
|
@ -28,12 +28,12 @@ class CommentUtilsTest extends MediaWikiUnitTestCase {
|
|||
$expected = self::getJson( $expectedPath );
|
||||
|
||||
$actual = [];
|
||||
CommentUtils::linearWalk( $fragment, function ( $event, $node ) use ( &$actual ) {
|
||||
CommentUtils::linearWalk( $fragment, static function ( $event, $node ) use ( &$actual ) {
|
||||
$actual[] = "$event {$node->nodeName}({$node->nodeType})";
|
||||
} );
|
||||
|
||||
$actualBackwards = [];
|
||||
CommentUtils::linearWalkBackwards( $fragment, function ( $event, $node ) use ( &$actualBackwards ) {
|
||||
CommentUtils::linearWalkBackwards( $fragment, static function ( $event, $node ) use ( &$actualBackwards ) {
|
||||
$actualBackwards[] = "$event {$node->nodeName}({$node->nodeType})";
|
||||
} );
|
||||
|
||||
|
@ -44,7 +44,7 @@ class CommentUtilsTest extends MediaWikiUnitTestCase {
|
|||
|
||||
self::assertEquals( $expected, $actual, $name );
|
||||
|
||||
$expectedBackwards = array_map( function ( $a ) {
|
||||
$expectedBackwards = array_map( static function ( $a ) {
|
||||
return ( substr( $a, 0, 5 ) === 'enter' ? 'leave' : 'enter' ) . substr( $a, 5 );
|
||||
}, array_reverse( $expected ) );
|
||||
self::assertEquals( $expectedBackwards, $actualBackwards, $name . ' (backwards)' );
|
||||
|
|
Loading…
Reference in a new issue