jenkins-bot has submitted this change and it was merged.

Change subject: Consistently name the $this callback variable "$that"
......................................................................


Consistently name the $this callback variable "$that"

Most are already, but some had differnet names. In PHP 5.4+ this is
redundant as they inherit automatically, but we need these for PHP 5.3
compatibility. Settle on "$that" to make these easier to find.

Change-Id: I0b68b2c550fde9c2da53d844421e34b8df0c42ed
---
M includes/filebackend/SwiftFileBackend.php
M includes/filerepo/LocalRepo.php
M includes/filerepo/file/LocalFile.php
M includes/specials/SpecialContributions.php
M includes/specials/SpecialDeletedContributions.php
M tests/phpunit/includes/libs/ArrayUtilsTest.php
M tests/phpunit/includes/site/CachingSiteStoreTest.php
M tests/phpunit/includes/site/SiteImporterTest.php
8 files changed, 41 insertions(+), 44 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/filebackend/SwiftFileBackend.php 
b/includes/filebackend/SwiftFileBackend.php
index 5f406c9..d6d7e9e 100644
--- a/includes/filebackend/SwiftFileBackend.php
+++ b/includes/filebackend/SwiftFileBackend.php
@@ -235,16 +235,16 @@
                        'body' => $params['content']
                ) );
 
-               $be = $this;
+               $that = $this;
                $method = __METHOD__;
-               $handler = function ( array $request, Status $status ) use ( 
$be, $method, $params ) {
+               $handler = function ( array $request, Status $status ) use ( 
$that, $method, $params ) {
                        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = 
$request['response'];
                        if ( $rcode === 201 ) {
                                // good
                        } elseif ( $rcode === 412 ) {
                                $status->fatal( 'backend-fail-contenttype', 
$params['dst'] );
                        } else {
-                               $be->onError( $status, $method, $params, $rerr, 
$rcode, $rdesc );
+                               $that->onError( $status, $method, $params, 
$rerr, $rcode, $rdesc );
                        }
                };
 
@@ -298,16 +298,16 @@
                        'body' => $handle // resource
                ) );
 
-               $be = $this;
+               $that = $this;
                $method = __METHOD__;
-               $handler = function ( array $request, Status $status ) use ( 
$be, $method, $params ) {
+               $handler = function ( array $request, Status $status ) use ( 
$that, $method, $params ) {
                        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = 
$request['response'];
                        if ( $rcode === 201 ) {
                                // good
                        } elseif ( $rcode === 412 ) {
                                $status->fatal( 'backend-fail-contenttype', 
$params['dst'] );
                        } else {
-                               $be->onError( $status, $method, $params, $rerr, 
$rcode, $rdesc );
+                               $that->onError( $status, $method, $params, 
$rerr, $rcode, $rdesc );
                        }
                };
 
@@ -347,16 +347,16 @@
                        ) + $this->sanitizeHdrs( $params ), // extra headers 
merged into object
                ) );
 
-               $be = $this;
+               $that = $this;
                $method = __METHOD__;
-               $handler = function ( array $request, Status $status ) use ( 
$be, $method, $params ) {
+               $handler = function ( array $request, Status $status ) use ( 
$that, $method, $params ) {
                        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = 
$request['response'];
                        if ( $rcode === 201 ) {
                                // good
                        } elseif ( $rcode === 404 ) {
                                $status->fatal( 'backend-fail-copy', 
$params['src'], $params['dst'] );
                        } else {
-                               $be->onError( $status, $method, $params, $rerr, 
$rcode, $rdesc );
+                               $that->onError( $status, $method, $params, 
$rerr, $rcode, $rdesc );
                        }
                };
 
@@ -405,9 +405,9 @@
                        );
                }
 
-               $be = $this;
+               $that = $this;
                $method = __METHOD__;
-               $handler = function ( array $request, Status $status ) use ( 
$be, $method, $params ) {
+               $handler = function ( array $request, Status $status ) use ( 
$that, $method, $params ) {
                        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = 
$request['response'];
                        if ( $request['method'] === 'PUT' && $rcode === 201 ) {
                                // good
@@ -416,7 +416,7 @@
                        } elseif ( $rcode === 404 ) {
                                $status->fatal( 'backend-fail-move', 
$params['src'], $params['dst'] );
                        } else {
-                               $be->onError( $status, $method, $params, $rerr, 
$rcode, $rdesc );
+                               $that->onError( $status, $method, $params, 
$rerr, $rcode, $rdesc );
                        }
                };
 
@@ -446,9 +446,9 @@
                        'headers' => array()
                ) );
 
-               $be = $this;
+               $that = $this;
                $method = __METHOD__;
-               $handler = function ( array $request, Status $status ) use ( 
$be, $method, $params ) {
+               $handler = function ( array $request, Status $status ) use ( 
$that, $method, $params ) {
                        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = 
$request['response'];
                        if ( $rcode === 204 ) {
                                // good
@@ -457,7 +457,7 @@
                                        $status->fatal( 'backend-fail-delete', 
$params['src'] );
                                }
                        } else {
-                               $be->onError( $status, $method, $params, $rerr, 
$rcode, $rdesc );
+                               $that->onError( $status, $method, $params, 
$rerr, $rcode, $rdesc );
                        }
                };
 
@@ -505,16 +505,16 @@
                        'headers' => $metaHdrs + $customHdrs
                ) );
 
-               $be = $this;
+               $that = $this;
                $method = __METHOD__;
-               $handler = function ( array $request, Status $status ) use ( 
$be, $method, $params ) {
+               $handler = function ( array $request, Status $status ) use ( 
$that, $method, $params ) {
                        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = 
$request['response'];
                        if ( $rcode === 202 ) {
                                // good
                        } elseif ( $rcode === 404 ) {
                                $status->fatal( 'backend-fail-describe', 
$params['src'] );
                        } else {
-                               $be->onError( $status, $method, $params, $rerr, 
$rcode, $rdesc );
+                               $that->onError( $status, $method, $params, 
$rerr, $rcode, $rdesc );
                        }
                };
 
diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php
index 591d684..ef402ea 100644
--- a/includes/filerepo/LocalRepo.php
+++ b/includes/filerepo/LocalRepo.php
@@ -275,14 +275,14 @@
                        );
                };
 
-               $repo = $this;
+               $that = $this;
                $applyMatchingFiles = function ( ResultWrapper $res, 
&$searchSet, &$finalFiles )
-                       use ( $repo, $fileMatchesSearch, $flags )
+                       use ( $that, $fileMatchesSearch, $flags )
                {
                        global $wgContLang;
-                       $info = $repo->getInfo();
+                       $info = $that->getInfo();
                        foreach ( $res as $row ) {
-                               $file = $repo->newFileFromRow( $row );
+                               $file = $that->newFileFromRow( $row );
                                // There must have been a search for this DB 
key, but this has to handle the
                                // cases were title capitalization is different 
on the client and repo wikis.
                                $dbKeysLook = array( str_replace( ' ', '_', 
$file->getName() ) );
diff --git a/includes/filerepo/file/LocalFile.php 
b/includes/filerepo/file/LocalFile.php
index e26f739..fe42c2d 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -1603,21 +1603,21 @@
 
                // Hack: the lock()/unlock() pair is nested in a transaction so 
the locking is not
                // tied to BEGIN/COMMIT. To avoid slow purges in the 
transaction, move them outside.
-               $file = $this;
+               $that = $this;
                $this->getRepo()->getMasterDB()->onTransactionIdle(
-                       function () use ( $file, $archiveNames ) {
+                       function () use ( $that, $archiveNames ) {
                                global $wgUseSquid;
 
-                               $file->purgeEverything();
+                               $that->purgeEverything();
                                foreach ( $archiveNames as $archiveName ) {
-                                       $file->purgeOldThumbnails( $archiveName 
);
+                                       $that->purgeOldThumbnails( $archiveName 
);
                                }
 
                                if ( $wgUseSquid ) {
                                        // Purge the squid
                                        $purgeUrls = array();
                                        foreach ( $archiveNames as $archiveName 
) {
-                                               $purgeUrls[] = 
$file->getArchiveUrl( $archiveName );
+                                               $purgeUrls[] = 
$that->getArchiveUrl( $archiveName );
                                        }
                                        SquidUpdate::purge( $purgeUrls );
                                }
diff --git a/includes/specials/SpecialContributions.php 
b/includes/specials/SpecialContributions.php
index c2cd812..6b918e9 100644
--- a/includes/specials/SpecialContributions.php
+++ b/includes/specials/SpecialContributions.php
@@ -724,7 +724,6 @@
                        $limit,
                        $descending
                );
-               $pager = $this;
 
                /*
                 * This hook will allow extensions to add in additional 
queries, so they can get their data
@@ -749,7 +748,7 @@
                ) );
                Hooks::run(
                        'ContribsPager::reallyDoQuery',
-                       array( &$data, $pager, $offset, $limit, $descending )
+                       array( &$data, $this, $offset, $limit, $descending )
                );
 
                $result = array();
diff --git a/includes/specials/SpecialDeletedContributions.php 
b/includes/specials/SpecialDeletedContributions.php
index 9e4bbbe..387c174 100644
--- a/includes/specials/SpecialDeletedContributions.php
+++ b/includes/specials/SpecialDeletedContributions.php
@@ -88,15 +88,13 @@
         * @return ResultWrapper
         */
        function reallyDoQuery( $offset, $limit, $descending ) {
-               $pager = $this;
-
                $data = array( parent::reallyDoQuery( $offset, $limit, 
$descending ) );
 
                // This hook will allow extensions to add in additional 
queries, nearly
                // identical to ContribsPager::reallyDoQuery.
                Hooks::run(
                        'DeletedContribsPager::reallyDoQuery',
-                       array( &$data, $pager, $offset, $limit, $descending )
+                       array( &$data, $this, $offset, $limit, $descending )
                );
 
                $result = array();
diff --git a/tests/phpunit/includes/libs/ArrayUtilsTest.php 
b/tests/phpunit/includes/libs/ArrayUtilsTest.php
index b5ea7b7..a91cc95 100644
--- a/tests/phpunit/includes/libs/ArrayUtilsTest.php
+++ b/tests/phpunit/includes/libs/ArrayUtilsTest.php
@@ -23,11 +23,11 @@
        }
 
        function provideFindLowerBound() {
-               $self = $this;
-               $indexValueCallback = function ( $size ) use ( $self ) {
-                       return function ( $val ) use ( $self, $size ) {
-                               $self->assertTrue( $val >= 0 );
-                               $self->assertTrue( $val < $size );
+               $that = $this;
+               $indexValueCallback = function ( $size ) use ( $that ) {
+                       return function ( $val ) use ( $that, $size ) {
+                               $that->assertTrue( $val >= 0 );
+                               $that->assertTrue( $val < $size );
                                return $val;
                        };
                };
diff --git a/tests/phpunit/includes/site/CachingSiteStoreTest.php 
b/tests/phpunit/includes/site/CachingSiteStoreTest.php
index d0a7980..4305ceb 100644
--- a/tests/phpunit/includes/site/CachingSiteStoreTest.php
+++ b/tests/phpunit/includes/site/CachingSiteStoreTest.php
@@ -96,17 +96,17 @@
                        ->getMock();
 
                // php 5.3 compatibility!
-               $self = $this;
+               $that = $this;
 
                $dbSiteStore->expects( $this->any() )
                        ->method( 'getSite' )
-                       ->will( $this->returnValue( $self->getTestSite() ) );
+                       ->will( $this->returnValue( $that->getTestSite() ) );
 
                $dbSiteStore->expects( $this->any() )
                        ->method( 'getSites' )
-                       ->will( $this->returnCallback( function() use( $self ) {
+                       ->will( $this->returnCallback( function() use ( $that ) 
{
                                $siteList = new SiteList();
-                               $siteList->setSite( $self->getTestSite() );
+                               $siteList->setSite( $that->getTestSite() );
 
                                return $siteList;
                        } ) );
diff --git a/tests/phpunit/includes/site/SiteImporterTest.php 
b/tests/phpunit/includes/site/SiteImporterTest.php
index cb0316a..64b195d 100644
--- a/tests/phpunit/includes/site/SiteImporterTest.php
+++ b/tests/phpunit/includes/site/SiteImporterTest.php
@@ -34,11 +34,11 @@
        private function newSiteImporter( array $expectedSites, $errorCount ) {
                $store = $this->getMock( 'SiteStore' );
 
-               $self = $this;
+               $that = $this;
                $store->expects( $this->once() )
                        ->method( 'saveSites' )
-                       ->will( $this->returnCallback( function ( $sites ) use 
( $expectedSites, $self ) {
-                               $self->assertSitesEqual( $expectedSites, $sites 
);
+                       ->will( $this->returnCallback( function ( $sites ) use 
( $expectedSites, $that ) {
+                               $that->assertSitesEqual( $expectedSites, $sites 
);
                        } ) );
 
                $store->expects( $this->any() )

-- 
To view, visit https://gerrit.wikimedia.org/r/206505
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0b68b2c550fde9c2da53d844421e34b8df0c42ed
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Cscott <canan...@wikimedia.org>
Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com>
Gerrit-Reviewer: TTO <at.li...@live.com.au>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to