build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0

Change-Id: I889efe00ac06fa857fc3ae063193368927bcff7a
This commit is contained in:
Umherirrender 2024-03-10 17:36:18 +01:00
parent dc5919fefe
commit 8b00546749
6 changed files with 22 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"require-dev": {
"mediawiki/mediawiki-codesniffer": "41.0.0",
"mediawiki/mediawiki-codesniffer": "43.0.0",
"mediawiki/mediawiki-phan-config": "0.14.0",
"mediawiki/minus-x": "1.1.1",
"php-parallel-lint/php-console-highlighter": "1.0.0",
@ -31,5 +31,10 @@
"php": ">=7.4.3",
"ext-json": "*",
"ext-dom": "*"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}

View file

@ -148,6 +148,7 @@ class CommentModifier {
$transclusionNode = CommentUtils::getTranscludedFromElement( $target );
if ( $transclusionNode ) {
while (
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
( $nextSibling = $transclusionNode->nextSibling ) &&
$nextSibling instanceof Element &&
$nextSibling->getAttribute( 'about' ) === $transclusionNode->getAttribute( 'about' )
@ -490,6 +491,7 @@ class CommentModifier {
(
// This would be easier to check in prepareWikitextReply(), but that would result
// in an empty list item being added at the end if we don't need to add a signature.
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
( $wtNode = $wrapperNode->lastChild ) &&
$wtNode instanceof Element &&
static::isWikitextNodeListItem( $wtNode )
@ -562,6 +564,7 @@ class CommentModifier {
// By request from the community, avoid this if possible after bullet indentation (T259864).
if ( !(
$replyIndentation === 'bullet' &&
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
( $wtNode = $container->firstChild->lastChild ) &&
$wtNode instanceof Element &&
!static::isWikitextNodeListItem( $wtNode )
@ -595,6 +598,7 @@ class CommentModifier {
// By request from the community, avoid this if possible after bullet indentation (T259864).
if ( !(
$replyIndentation === 'bullet' &&
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
( $wtNode = $container->firstChild->lastChild ) &&
$wtNode instanceof Element &&
!static::isWikitextNodeListItem( $wtNode )

View file

@ -800,6 +800,7 @@ class CommentParser {
// which apparently are often turned into   entities by buggy editing tools. To handle
// this, we must piece together the text, so that our regexp can match those timestamps.
if (
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
( $previousSibling = $node->previousSibling ) &&
$previousSibling instanceof Element &&
$previousSibling->getAttribute( 'typeof' ) === 'mw:Entity'
@ -908,6 +909,7 @@ class CommentParser {
NodeFilter::SHOW_ELEMENT | NodeFilter::SHOW_TEXT,
[ static::class, 'acceptOnlyNodesAllowingComments' ]
);
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
while ( $node = $treeWalker->nextNode() ) {
if ( $node instanceof Element && preg_match( '/^h([1-6])$/i', $node->tagName, $match ) ) {
$headingNodeAndOffset = CommentUtils::getHeadlineNodeAndOffset( $node );
@ -921,6 +923,7 @@ class CommentParser {
$curComment->setRootNode( $this->rootNode );
$result->addThreadItem( $curComment );
$curCommentEnd = $node;
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
} elseif ( $node instanceof Text && ( $match = $this->findTimestamp( $node, $timestampRegexps ) ) ) {
$warnings = [];
$foundSignature = $this->findSignature( $node, $curCommentEnd );
@ -965,6 +968,7 @@ class CommentParser {
if (
$event === 'leave' &&
$n instanceof Text && $n !== $node &&
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
( $match2 = $this->findTimestamp( $n, $timestampRegexps ) )
) {
// If this skips over another potential signature, also skip it in the main TreeWalker loop
@ -1258,6 +1262,7 @@ class CommentParser {
// Phan doesn't realize that the conditions on $nextSibling can terminate the loop
// @phan-suppress-next-line PhanInfiniteLoop
$endNode &&
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
( $nextSibling = $endNode->nextSibling ) &&
$nextSibling instanceof Element &&
$nextSibling->getAttribute( 'about' ) === $endNode->getAttribute( 'about' )

View file

@ -215,6 +215,7 @@ class CommentUtils {
*/
public static function childIndexOf( Node $child ): int {
$i = 0;
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
while ( ( $child = $child->previousSibling ) ) {
$i++;
}
@ -301,6 +302,7 @@ class CommentUtils {
// 2.
while (
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
( $previousSibling = $node->previousSibling ) &&
$previousSibling instanceof Element &&
$previousSibling->getAttribute( 'about' ) === $about
@ -453,6 +455,7 @@ class CommentUtils {
if ( $matches ) {
// If these are all of the children (or the only child), go up one more level
while (
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
( $parent = $siblings[ 0 ]->parentNode ) &&
$parent !== $excludedAncestorNode &&
static::compareRanges( $makeRange( [ $parent ] ), $item->getRange() ) === 'equal'

View file

@ -54,6 +54,7 @@ class ImmutableRange {
return $b;
}
$ancestorsA[] = $parent;
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
} while ( $parent = $parent->parentNode );
$parent = $b;
@ -63,6 +64,7 @@ class ImmutableRange {
return $a;
}
$ancestorsB[] = $parent;
// @phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
} while ( $parent = $parent->parentNode );
$node = null;

View file

@ -104,12 +104,12 @@ class PersistRevisionThreadItems extends Maintenance {
if ( $this->getOption( 'touched-after' ) ) {
$qb->where( $dbr->expr(
'page_touched', '>', $dbr->timestamp( $this->getOption( 'touched-after' ) )
) );
) );
}
if ( $this->getOption( 'touched-before' ) ) {
$qb->where( $dbr->expr(
'page_touched', '<', $dbr->timestamp( $this->getOption( 'touched-before' ) )
) );
) );
}
} else {