X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fjobqueue%2FJobQueueMemory.php;h=2866c7f2fa1e2420d5a0f55fc41533c9840ca397;hb=022d6ab817b3e66262d97317e25644fc5b4594af;hp=7dad748798531bb68016c5410b882dc10c6d674d;hpb=a1ac862ba974ee0dc54c52662b0bbaee166c13e9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobQueueMemory.php b/includes/jobqueue/JobQueueMemory.php index 7dad748798..2866c7f2fa 100644 --- a/includes/jobqueue/JobQueueMemory.php +++ b/includes/jobqueue/JobQueueMemory.php @@ -31,7 +31,7 @@ */ class JobQueueMemory extends JobQueue { /** @var array[] */ - protected static $data = array(); + protected static $data = []; /** * @see JobQueue::doBatchPush @@ -40,7 +40,7 @@ class JobQueueMemory extends JobQueue { * @param int $flags */ protected function doBatchPush( array $jobs, $flags ) { - $unclaimed =& $this->getQueueData( 'unclaimed', array() ); + $unclaimed =& $this->getQueueData( 'unclaimed', [] ); foreach ( $jobs as $job ) { if ( $job->ignoreDuplicates() ) { @@ -63,7 +63,7 @@ class JobQueueMemory extends JobQueue { * @return string[] */ protected function supportedOrders() { - return array( 'random', 'timestamp', 'fifo' ); + return [ 'random', 'timestamp', 'fifo' ]; } /** @@ -117,7 +117,7 @@ class JobQueueMemory extends JobQueue { } $unclaimed =& $this->getQueueData( 'unclaimed' ); - $claimed =& $this->getQueueData( 'claimed', array() ); + $claimed =& $this->getQueueData( 'claimed', [] ); if ( $this->order === 'random' ) { $key = array_rand( $unclaimed ); @@ -172,14 +172,13 @@ class JobQueueMemory extends JobQueue { public function getAllQueuedJobs() { $unclaimed = $this->getQueueData( 'unclaimed' ); if ( !$unclaimed ) { - return new ArrayIterator( array() ); + return new ArrayIterator( [] ); } - $that = $this; return new MappedIterator( $unclaimed, - function ( $value ) use ( $that ) { - $that->jobFromSpecInternal( $value ); + function ( $value ) { + $this->jobFromSpecInternal( $value ); } ); } @@ -192,14 +191,13 @@ class JobQueueMemory extends JobQueue { public function getAllAcquiredJobs() { $claimed = $this->getQueueData( 'claimed' ); if ( !$claimed ) { - return new ArrayIterator( array() ); + return new ArrayIterator( [] ); } - $that = $this; return new MappedIterator( $claimed, - function ( $value ) use ( $that ) { - $that->jobFromSpecInternal( $value ); + function ( $value ) { + $this->jobFromSpecInternal( $value ); } ); }