From 7a97368c351bffc36af8ca0391821164313a98fe Mon Sep 17 00:00:00 2001 From: Ricordisamoa Date: Wed, 10 Feb 2016 18:43:49 +0100 Subject: [PATCH] Stop doing $that = $this in includes/jobqueue Closures support $this as of PHP 5.4 Change-Id: Icf4eb9ffeab410c01c68a031ec6704cd83c2681e --- includes/jobqueue/JobQueueDB.php | 5 ++--- includes/jobqueue/JobQueueMemory.php | 10 ++++------ includes/jobqueue/JobQueueRedis.php | 6 ++---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/includes/jobqueue/JobQueueDB.php b/includes/jobqueue/JobQueueDB.php index f10866e55a..51dec65d1b 100644 --- a/includes/jobqueue/JobQueueDB.php +++ b/includes/jobqueue/JobQueueDB.php @@ -181,11 +181,10 @@ class JobQueueDB extends JobQueue { protected function doBatchPush( array $jobs, $flags ) { $dbw = $this->getMasterDB(); - $that = $this; $method = __METHOD__; $dbw->onTransactionIdle( - function () use ( $dbw, $that, $jobs, $flags, $method ) { - $that->doBatchPushInternal( $dbw, $jobs, $flags, $method ); + function () use ( $dbw, $jobs, $flags, $method ) { + $this->doBatchPushInternal( $dbw, $jobs, $flags, $method ); } ); } diff --git a/includes/jobqueue/JobQueueMemory.php b/includes/jobqueue/JobQueueMemory.php index 7dad748798..7e9c0c971f 100644 --- a/includes/jobqueue/JobQueueMemory.php +++ b/includes/jobqueue/JobQueueMemory.php @@ -175,11 +175,10 @@ class JobQueueMemory extends JobQueue { return new ArrayIterator( array() ); } - $that = $this; return new MappedIterator( $unclaimed, - function ( $value ) use ( $that ) { - $that->jobFromSpecInternal( $value ); + function ( $value ) { + $this->jobFromSpecInternal( $value ); } ); } @@ -195,11 +194,10 @@ class JobQueueMemory extends JobQueue { return new ArrayIterator( array() ); } - $that = $this; return new MappedIterator( $claimed, - function ( $value ) use ( $that ) { - $that->jobFromSpecInternal( $value ); + function ( $value ) { + $this->jobFromSpecInternal( $value ); } ); } diff --git a/includes/jobqueue/JobQueueRedis.php b/includes/jobqueue/JobQueueRedis.php index eda3e9ccc3..408828dbc2 100644 --- a/includes/jobqueue/JobQueueRedis.php +++ b/includes/jobqueue/JobQueueRedis.php @@ -573,12 +573,10 @@ LUA; * @return MappedIterator */ protected function getJobIterator( RedisConnRef $conn, array $uids ) { - $that = $this; - return new MappedIterator( $uids, - function ( $uid ) use ( $that, $conn ) { - return $that->getJobFromUidInternal( $uid, $conn ); + function ( $uid ) use ( $conn ) { + return $this->getJobFromUidInternal( $uid, $conn ); }, array( 'accept' => function ( $job ) { return is_object( $job ); -- 2.20.1