build: Updating mediawiki/mediawiki-codesniffer to 23.0.0
authorUmherirrender <umherirrender_de.wp@web.de>
Fri, 16 Nov 2018 23:30:28 +0000 (00:30 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 1 Dec 2018 22:11:16 +0000 (23:11 +0100)
Avoid use of __METHOD__ magic constant in closure

Change-Id: I28d519530ca2fcde026a6cbb419848098d4617ca

composer.json
includes/actions/RollbackAction.php
includes/api/ApiRollback.php
includes/changetags/ChangeTags.php
includes/deferred/UserEditCountUpdate.php

index d923db1..01f2108 100644 (file)
@@ -64,7 +64,7 @@
                "jakub-onderka/php-parallel-lint": "0.9.2",
                "jetbrains/phpstorm-stubs": "dev-master#38ff1a581b297f7901e961b8c923862ea80c3b96",
                "justinrainbow/json-schema": "~5.2",
-               "mediawiki/mediawiki-codesniffer": "22.0.0",
+               "mediawiki/mediawiki-codesniffer": "23.0.0",
                "monolog/monolog": "~1.22.1",
                "nikic/php-parser": "3.1.3",
                "seld/jsonlint": "1.7.1",
index dec3e61..3e6d402 100644 (file)
@@ -70,11 +70,12 @@ class RollbackAction extends FormlessAction {
                }
 
                // @TODO: remove this hack once rollback uses POST (T88044)
+               $fname = __METHOD__;
                $trxLimits = $this->context->getConfig()->get( 'TrxProfilerLimits' );
                $trxProfiler = Profiler::instance()->getTransactionProfiler();
-               $trxProfiler->setExpectations( $trxLimits['POST'], __METHOD__ );
-               DeferredUpdates::addCallableUpdate( function () use ( $trxProfiler, $trxLimits ) {
-                       $trxProfiler->setExpectations( $trxLimits['PostSend-POST'], __METHOD__ );
+               $trxProfiler->setExpectations( $trxLimits['POST'], $fname );
+               DeferredUpdates::addCallableUpdate( function () use ( $trxProfiler, $trxLimits, $fname ) {
+                       $trxProfiler->setExpectations( $trxLimits['PostSend-POST'], $fname );
                } );
 
                $data = null;
index 10ba478..78696da 100644 (file)
@@ -56,11 +56,12 @@ class ApiRollback extends ApiBase {
                }
 
                // @TODO: remove this hack once rollback uses POST (T88044)
+               $fname = __METHOD__;
                $trxLimits = $this->getConfig()->get( 'TrxProfilerLimits' );
                $trxProfiler = Profiler::instance()->getTransactionProfiler();
-               $trxProfiler->setExpectations( $trxLimits['POST'], __METHOD__ );
-               DeferredUpdates::addCallableUpdate( function () use ( $trxProfiler, $trxLimits ) {
-                       $trxProfiler->setExpectations( $trxLimits['PostSend-POST'], __METHOD__ );
+               $trxProfiler->setExpectations( $trxLimits['POST'], $fname );
+               DeferredUpdates::addCallableUpdate( function () use ( $trxProfiler, $trxLimits, $fname ) {
+                       $trxProfiler->setExpectations( $trxLimits['PostSend-POST'], $fname );
                } );
 
                $retval = $pageObj->doRollback(
index 5e83f95..17b445d 100644 (file)
@@ -348,13 +348,14 @@ class ChangeTags {
                        foreach ( $tagsToAdd as $tag ) {
                                $changeTagMapping[$tag] = $changeTagDefStore->acquireId( $tag );
                        }
+                       $fname = __METHOD__;
                        // T207881: update the counts at the end of the transaction
-                       $dbw->onTransactionPreCommitOrIdle( function () use ( $dbw, $tagsToAdd ) {
+                       $dbw->onTransactionPreCommitOrIdle( function () use ( $dbw, $tagsToAdd, $fname ) {
                                $dbw->update(
                                        'change_tag_def',
                                        [ 'ctd_count = ctd_count + 1' ],
                                        [ 'ctd_name' => $tagsToAdd ],
-                                       __METHOD__
+                                       $fname
                                );
                        } );
 
@@ -381,6 +382,7 @@ class ChangeTags {
 
                // delete from change_tag
                if ( count( $tagsToRemove ) ) {
+                       $fname = __METHOD__;
                        foreach ( $tagsToRemove as $tag ) {
                                $conds = array_filter(
                                        [
@@ -393,18 +395,18 @@ class ChangeTags {
                                $dbw->delete( 'change_tag', $conds, __METHOD__ );
                                if ( $dbw->affectedRows() ) {
                                        // T207881: update the counts at the end of the transaction
-                                       $dbw->onTransactionPreCommitOrIdle( function () use ( $dbw, $tag ) {
+                                       $dbw->onTransactionPreCommitOrIdle( function () use ( $dbw, $tag, $fname ) {
                                                $dbw->update(
                                                        'change_tag_def',
                                                        [ 'ctd_count = ctd_count - 1' ],
                                                        [ 'ctd_name' => $tag ],
-                                                       __METHOD__
+                                                       $fname
                                                );
 
                                                $dbw->delete(
                                                        'change_tag_def',
                                                        [ 'ctd_name' => $tag, 'ctd_count' => 0, 'ctd_user_defined' => 0 ],
-                                                       __METHOD__
+                                                       $fname
                                                );
                                        } );
                                }
@@ -1459,7 +1461,7 @@ class ChangeTags {
                                        'change_tag_def',
                                        'ctd_name',
                                        [ 'ctd_user_defined' => 1 ],
-                                       __METHOD__
+                                       $fname
                                );
 
                                return array_filter( array_unique( $tags ) );
index 5194e4f..4ce0b18 100644 (file)
@@ -68,14 +68,15 @@ class UserEditCountUpdate implements DeferrableUpdate, MergeableUpdate {
        public function doUpdate() {
                $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
                $dbw = $lb->getConnection( DB_MASTER );
+               $fname = __METHOD__;
 
-               ( new AutoCommitUpdate( $dbw, __METHOD__, function () use ( $lb, $dbw ) {
+               ( new AutoCommitUpdate( $dbw, __METHOD__, function () use ( $lb, $dbw, $fname ) {
                        foreach ( $this->infoByUser as $userId => $info ) {
                                $dbw->update(
                                        'user',
                                        [ 'user_editcount=user_editcount+' . (int)$info['increment'] ],
                                        [ 'user_id' => $userId, 'user_editcount IS NOT NULL' ],
-                                       __METHOD__
+                                       $fname
                                );
                                /** @var User[] $affectedInstances */
                                $affectedInstances = $info['instances'];
@@ -87,7 +88,7 @@ class UserEditCountUpdate implements DeferrableUpdate, MergeableUpdate {
                                        if ( $dbr !== $dbw ) {
                                                // This method runs after the new revisions were committed.
                                                // Wait for the replica to catch up so they will all be counted.
-                                               $dbr->flushSnapshot( __METHOD__ );
+                                               $dbr->flushSnapshot( $fname );
                                                $lb->safeWaitForMasterPos( $dbr );
                                        }
                                        $affectedInstances[0]->initEditCountInternal();
@@ -96,7 +97,7 @@ class UserEditCountUpdate implements DeferrableUpdate, MergeableUpdate {
                                        'user',
                                        [ 'user_editcount' ],
                                        [ 'user_id' => $userId ],
-                                       __METHOD__
+                                       $fname
                                );
 
                                // Update the edit count in the instance caches. This is mostly useful