diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2021-02-07 14:10:36 +0100 |
---|---|---|
committer | Krinkle <krinklemail@gmail.com> | 2021-02-09 02:55:57 +0000 |
commit | a1de8b8700f4aa9e27bb571fac1705ff8dac161a (patch) | |
tree | 504ec50953e1bc7fbd92fb2959564ddce02062a0 /tests/phpunit/includes/api/query | |
parent | 20f44cb1ea0fc957c83e01e438b4c4fc04053fb7 (diff) | |
download | mediawikicore-a1de8b8700f4aa9e27bb571fac1705ff8dac161a.tar.gz mediawikicore-a1de8b8700f4aa9e27bb571fac1705ff8dac161a.zip |
Tests: Mark more more closures as static
Result of a new sniff I25a17fb22b6b669e817317a0f45051ae9c608208
Bug: T274036
Change-Id: I695873737167a75f0d94901fa40383a33984ca55
Diffstat (limited to 'tests/phpunit/includes/api/query')
4 files changed, 13 insertions, 13 deletions
diff --git a/tests/phpunit/includes/api/query/ApiQueryBlockInfoTraitTest.php b/tests/phpunit/includes/api/query/ApiQueryBlockInfoTraitTest.php index dc4d2adcad8b..4b374487d8f4 100644 --- a/tests/phpunit/includes/api/query/ApiQueryBlockInfoTraitTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryBlockInfoTraitTest.php @@ -30,16 +30,16 @@ class ApiQueryBlockInfoTraitTest extends MediaWikiIntegrationTestCase { ->willReturn( MediaWikiServices::getInstance()->getPermissionManager() ); $mock->method( 'getUser' ) ->willReturn( $this->getMutableTestUser()->getUser() ); - $mock->method( 'addTables' )->willReturnCallback( function ( $v ) use ( &$data ) { + $mock->method( 'addTables' )->willReturnCallback( static function ( $v ) use ( &$data ) { $data['tables'] = array_merge( $data['tables'] ?? [], (array)$v ); } ); - $mock->method( 'addFields' )->willReturnCallback( function ( $v ) use ( &$data ) { + $mock->method( 'addFields' )->willReturnCallback( static function ( $v ) use ( &$data ) { $data['fields'] = array_merge( $data['fields'] ?? [], (array)$v ); } ); - $mock->method( 'addWhere' )->willReturnCallback( function ( $v ) use ( &$data ) { + $mock->method( 'addWhere' )->willReturnCallback( static function ( $v ) use ( &$data ) { $data['where'] = array_merge( $data['where'] ?? [], (array)$v ); } ); - $mock->method( 'addJoinConds' )->willReturnCallback( function ( $v ) use ( &$data ) { + $mock->method( 'addJoinConds' )->willReturnCallback( static function ( $v ) use ( &$data ) { $data['joins'] = array_merge( $data['joins'] ?? [], (array)$v ); } ); diff --git a/tests/phpunit/includes/api/query/ApiQueryLanguageinfoTest.php b/tests/phpunit/includes/api/query/ApiQueryLanguageinfoTest.php index 23e60349951c..cbf6d67495be 100644 --- a/tests/phpunit/includes/api/query/ApiQueryLanguageinfoTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryLanguageinfoTest.php @@ -15,7 +15,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { // register custom language names so this test is independent of CLDR $this->setTemporaryHook( 'LanguageGetTranslatedLanguageNames', - function ( array &$names, $code ) { + static function ( array &$names, $code ) { switch ( $code ) { case 'en': $names['sh'] = 'Serbo-Croatian'; @@ -41,13 +41,13 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { // so we can call the constructor with the custom $microtimeFunction $this->setTemporaryHook( 'ApiQuery::moduleManager', - function ( ApiModuleManager $moduleManager ) use ( $microtimeFunction ) { + static function ( ApiModuleManager $moduleManager ) use ( $microtimeFunction ) { $moduleManager->addModule( 'languageinfo', 'meta', [ 'class' => ApiQueryLanguageinfo::class, - 'factory' => function ( $parent, $name ) use ( $microtimeFunction ) { + 'factory' => static function ( $parent, $name ) use ( $microtimeFunction ) { $services = MediaWikiServices::getInstance(); return new ApiQueryLanguageinfo( $parent, @@ -122,7 +122,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { public function testContinuationNecessary() { $time = 0; - $microtimeFunction = function () use ( &$time ) { + $microtimeFunction = static function () use ( &$time ) { return $time += 0.75; }; @@ -134,7 +134,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { public function testContinuationNotNecessary() { $time = 0; - $microtimeFunction = function () use ( &$time ) { + $microtimeFunction = static function () use ( &$time ) { return $time += 1.5; }; @@ -147,7 +147,7 @@ class ApiQueryLanguageinfoTest extends ApiTestCase { public function testContinuationInAlphabeticalOrderNotParameterOrder() { $time = 0; - $microtimeFunction = function () use ( &$time ) { + $microtimeFunction = static function () use ( &$time ) { return $time += 0.75; }; $params = [ 'licode' => 'en|ru|zh|de|yue' ]; diff --git a/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php b/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php index 2829a0cb89cd..a3ac493eef58 100644 --- a/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php +++ b/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php @@ -283,7 +283,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase { public function testStatistics() { $this->setTemporaryHook( 'APIQuerySiteInfoStatisticsInfo', - function ( &$data ) { + static function ( &$data ) { $data['addedstats'] = 42; } ); @@ -666,7 +666,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase { // Make sure there's something to report on $this->setTemporaryHook( 'somehook', - function () { + static function () { return; } ); diff --git a/tests/phpunit/includes/api/query/ApiQueryTest.php b/tests/phpunit/includes/api/query/ApiQueryTest.php index 4bb38ede150c..f46853bb1e7a 100644 --- a/tests/phpunit/includes/api/query/ApiQueryTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryTest.php @@ -154,7 +154,7 @@ class ApiQueryTest extends ApiTestCase { $this->insertPage( $title ); $this->setTemporaryHook( 'getUserPermissionsErrors', - function ( Title $page, &$user, $action, &$result ) use ( $title ) { + static function ( Title $page, &$user, $action, &$result ) use ( $title ) { if ( $page->equals( $title ) && $action === 'read' ) { $result = false; return false; |