Stop doing $that = $this in includes/jobqueue
authorRicordisamoa <ricordisamoa@openmailbox.org>
Wed, 10 Feb 2016 17:43:49 +0000 (18:43 +0100)
committerAddshore <addshorewiki@gmail.com>
Wed, 10 Feb 2016 17:51:47 +0000 (17:51 +0000)
Closures support $this as of PHP 5.4

Change-Id: Icf4eb9ffeab410c01c68a031ec6704cd83c2681e

includes/jobqueue/JobQueueDB.php
includes/jobqueue/JobQueueMemory.php
includes/jobqueue/JobQueueRedis.php

index f10866e..51dec65 100644 (file)
@@ -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 );
                        }
                );
        }
index 7dad748..7e9c0c9 100644 (file)
@@ -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 );
                        }
                );
        }
index eda3e9c..408828d 100644 (file)
@@ -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 );