diff --git a/composer.json b/composer.json index c9257499..226daa01 100644 --- a/composer.json +++ b/composer.json @@ -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": [ diff --git a/includes/Database.php b/includes/Database.php index ac5a20a8..2f18b633 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -170,7 +170,7 @@ class Database { */ public function setForPage( $errors ) { $previous = $this->getForPage(); - $dbw = wfGetDB( DB_MASTER ); + $dbw = wfGetDB( DB_PRIMARY ); if ( !$previous && !$errors ) { return [ 'deleted' => [], 'added' => [] ]; } elseif ( !$previous && $errors ) { diff --git a/includes/Hooks.php b/includes/Hooks.php index 0e9d52b5..450293ea 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -97,7 +97,7 @@ class Hooks { Content $content, array &$updates ) { $title = $wikiPage->getTitle(); - $updates[] = new MWCallableUpdate( function () use ( $title ) { + $updates[] = new MWCallableUpdate( static function () use ( $title ) { $job = new RecordLintJob( $title, [ 'errors' => [] ] ); diff --git a/includes/LintErrorsPager.php b/includes/LintErrorsPager.php index 89dec557..8ab2ea39 100644 --- a/includes/LintErrorsPager.php +++ b/includes/LintErrorsPager.php @@ -174,7 +174,7 @@ class LintErrorsPager extends TablePager { isset( $lintError->params['name'] ) ) { return Html::element( 'code', [], $lintError->params['name'] ); } elseif ( $this->category === 'bogus-image-options' && isset( $lintError->params['items'] ) ) { - $list = array_map( function ( $in ) { + $list = array_map( static function ( $in ) { return Html::element( 'code', [], $in ); }, $lintError->params['items'] ); return $this->getLanguage()->commaList( $list ); diff --git a/includes/TotalsLookup.php b/includes/TotalsLookup.php index b8533ab8..757c76ee 100644 --- a/includes/TotalsLookup.php +++ b/includes/TotalsLookup.php @@ -69,7 +69,7 @@ class TotalsLookup { $totals[$cat] = $this->cache->getWithSetCallback( $this->makeKey( $cat ), WANObjectCache::TTL_INDEFINITE, - function ( $oldValue, &$ttl, &$setOpts, $oldAsOf ) use ( $cat, &$fetchedTotals ) { + static function ( $oldValue, &$ttl, &$setOpts, $oldAsOf ) use ( $cat, &$fetchedTotals ) { $setOpts += MWDatabase::getCacheSetOptions( wfGetDB( DB_REPLICA ) ); if ( $fetchedTotals === false ) { $fetchedTotals = ( new Database( 0 ) )->getTotals(); diff --git a/tests/phpunit/DatabaseTest.php b/tests/phpunit/DatabaseTest.php index 0837e27e..32745c7f 100644 --- a/tests/phpunit/DatabaseTest.php +++ b/tests/phpunit/DatabaseTest.php @@ -52,10 +52,10 @@ class DatabaseTest extends MediaWikiTestCase { } private function assertLintErrorsEqual( $expected, $actual ) { - $expectedIds = array_map( function ( LintError $error ) { + $expectedIds = array_map( static function ( LintError $error ) { return $error->id(); }, $expected ); - $actualIds = array_map( function ( LintError $error ) { + $actualIds = array_map( static function ( LintError $error ) { return $error->id(); }, $actual ); $this->assertArrayEquals( $expectedIds, $actualIds );