From 2d1cc94faafb701461c7ed500c850f391c0ac94f Mon Sep 17 00:00:00 2001 From: Lucas Werkmeister Date: Mon, 27 Feb 2023 11:10:41 +0100 Subject: [PATCH] Update mediawiki/codesniffer to 41.0 And fix the reported violations (all of which I agree with). This should unblock reenabling the FunctionComment sniff, because it should now complain in fewer situations. Change-Id: If95f1adcdca12fb72971b9e57e4426905f69670a --- composer.json | 2 +- .../TermFallbackCacheFacadeTest.php | 2 +- .../PatchItemStatement/PatchItemStatementTest.php | 4 ++-- .../includes/Store/Sql/DispatchStatsTest.php | 14 +++++++------- .../phpunit/includes/WikibasePingbackTest.php | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index ed760b891c2..790e8800987 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "swaggest/json-diff": "^3.10.4" }, "require-dev": { - "mediawiki/mediawiki-codesniffer": "^40.0", + "mediawiki/mediawiki-codesniffer": "^41.0", "mediawiki/mediawiki-phan-config": "^0.12.0", "mediawiki/minus-x": "1.1.1", "php-parallel-lint/php-console-highlighter": "0.5.0", diff --git a/lib/tests/phpunit/TermFallbackCache/TermFallbackCacheFacadeTest.php b/lib/tests/phpunit/TermFallbackCache/TermFallbackCacheFacadeTest.php index b94a644dd7c..7ac5b440bde 100644 --- a/lib/tests/phpunit/TermFallbackCache/TermFallbackCacheFacadeTest.php +++ b/lib/tests/phpunit/TermFallbackCache/TermFallbackCacheFacadeTest.php @@ -52,7 +52,7 @@ public function testGettingNoValue() { ->willReturn( TermFallbackCacheFacade::NO_VALUE ); $value = $facade->get( $entityId, self::REVISION_ID, 'en', TermTypes::TYPE_LABEL ); - $this->assertEquals( $value, TermFallbackCacheFacade::NO_VALUE ); + $this->assertEquals( TermFallbackCacheFacade::NO_VALUE, $value ); } public function setProvider() { diff --git a/repo/rest-api/tests/phpunit/UseCases/PatchItemStatement/PatchItemStatementTest.php b/repo/rest-api/tests/phpunit/UseCases/PatchItemStatement/PatchItemStatementTest.php index 6880e9958b3..1fd0e5dc3cc 100644 --- a/repo/rest-api/tests/phpunit/UseCases/PatchItemStatement/PatchItemStatementTest.php +++ b/repo/rest-api/tests/phpunit/UseCases/PatchItemStatement/PatchItemStatementTest.php @@ -306,7 +306,7 @@ public function testRejectsPropertyIdChange(): void { ); $this->assertInstanceOf( PatchItemStatementErrorResponse::class, $response ); - $this->assertSame( $response->getCode(), ErrorResponse::INVALID_OPERATION_CHANGED_PROPERTY ); + $this->assertSame( ErrorResponse::INVALID_OPERATION_CHANGED_PROPERTY, $response->getCode() ); } public function testRejectsStatementIdChange(): void { @@ -336,7 +336,7 @@ public function testRejectsStatementIdChange(): void { ); $this->assertInstanceOf( PatchItemStatementErrorResponse::class, $response ); - $this->assertSame( $response->getCode(), ErrorResponse::INVALID_OPERATION_CHANGED_STATEMENT_ID ); + $this->assertSame( ErrorResponse::INVALID_OPERATION_CHANGED_STATEMENT_ID, $response->getCode() ); } public function testGivenProtectedItem_returnsErrorResponse(): void { diff --git a/repo/tests/phpunit/includes/Store/Sql/DispatchStatsTest.php b/repo/tests/phpunit/includes/Store/Sql/DispatchStatsTest.php index a42a6c619dc..e96db096768 100644 --- a/repo/tests/phpunit/includes/Store/Sql/DispatchStatsTest.php +++ b/repo/tests/phpunit/includes/Store/Sql/DispatchStatsTest.php @@ -52,7 +52,7 @@ public function testGetDispatchStats_empty(): void { $actualStats = $dispatchStats->getDispatchStats(); - $this->assertSame( $actualStats, [ 'numberOfChanges' => 0 ] ); + $this->assertSame( [ 'numberOfChanges' => 0 ], $actualStats ); } public function testGetDispatchStats_exact(): void { @@ -67,12 +67,12 @@ public function testGetDispatchStats_exact(): void { $actualStats = $dispatchStats->getDispatchStats(); - $this->assertSame( $actualStats, [ + $this->assertSame( [ 'numberOfChanges' => 3, 'numberOfEntities' => 2, 'freshestTime' => '20211018155646', 'stalestTime' => '20211018155100', - ] ); + ], $actualStats ); } public function testGetDispatchStats_estimated(): void { @@ -87,11 +87,11 @@ public function testGetDispatchStats_estimated(): void { $actualStats = $dispatchStats->getDispatchStats(); - $this->assertSame( $actualStats, [ + $this->assertSame( [ 'estimatedNumberOfChanges' => 30000, 'freshestTime' => '20211018155646', 'stalestTime' => '20211018155100', - ] ); + ], $actualStats ); } public function testGetDispatchStats_estimateOutdated(): void { @@ -106,11 +106,11 @@ public function testGetDispatchStats_estimateOutdated(): void { $actualStats = $dispatchStats->getDispatchStats(); - $this->assertSame( $actualStats, [ + $this->assertSame( [ 'minimumNumberOfChanges' => 5001, 'freshestTime' => '20211018155646', 'stalestTime' => '20211018155100', - ] ); + ], $actualStats ); } } diff --git a/repo/tests/phpunit/includes/WikibasePingbackTest.php b/repo/tests/phpunit/includes/WikibasePingbackTest.php index 3007a82187e..bf8cb720667 100644 --- a/repo/tests/phpunit/includes/WikibasePingbackTest.php +++ b/repo/tests/phpunit/includes/WikibasePingbackTest.php @@ -112,18 +112,18 @@ public function testWikibasePingbackSchedules() { $buffer = $logger->getBuffer(); $this->assertCount( 2, $buffer ); $this->assertSame( - $buffer[0], [ LogLevel::DEBUG, 'Wikibase\Repo\WikibasePingback::sendPingback: pingback sent OK (' . self::TEST_KEY . ')', - ] + ], + $buffer[0] ); $this->assertSame( - $buffer[1], [ LogLevel::DEBUG, 'Wikibase\Repo\WikibasePingback::sendPingback: pingback sent OK (' . self::TEST_KEY . ')', - ] + ], + $buffer[1] ); MWTimestamp::setFakeTime( false ); $logger->clearBuffer();