From e0914efdd541b7ee107cee6eea78ff900fffc5bb Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 27 May 2018 14:46:49 +1200 Subject: [PATCH 01/45] Add version 1.4.0 to composer --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 88acec7..880fde2 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "name": "idanoo/php-resque", + "version": "1.4.0", "type": "library", "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", "keywords": ["job", "background", "redis", "resque"], From 2a3dcd8537b55536ca7594d265760efcc01fca27 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 27 May 2018 14:52:05 +1200 Subject: [PATCH 02/45] Clean up bin/resque file --- bin/resque | 56 +++++++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/bin/resque b/bin/resque index 1d60485..421ce33 100755 --- a/bin/resque +++ b/bin/resque @@ -2,12 +2,12 @@ 1) { +if (!empty($COUNT) && $COUNT > 1) { $count = $COUNT; } $PREFIX = getenv('PREFIX'); -if(!empty($PREFIX)) { - $logger->log(Psr\Log\LogLevel::INFO, 'Prefix set to {prefix}', array('prefix' => $PREFIX)); +if (!empty($PREFIX)) { + $logger->log(Psr\Log\LogLevel::INFO, 'Prefix set to {prefix}', ['prefix' => $PREFIX]); Resque_Redis::prefix($PREFIX); } -if($count > 1) { - for($i = 0; $i < $count; ++$i) { +if ($count > 1) { + for ($i = 0; $i < $count; ++$i) { $pid = Resque::fork(); - if($pid === false || $pid === -1) { - $logger->log(Psr\Log\LogLevel::EMERGENCY, 'Could not fork worker {count}', array('count' => $i)); + if ($pid === false || $pid === -1) { + $logger->log(Psr\Log\LogLevel::EMERGENCY, 'Could not fork worker {count}', ['count' => $i]); die(); - } - // Child, start the worker - else if(!$pid) { + } elseif (!$pid) { + // Child, start the worker $queues = explode(',', $QUEUE); $worker = new Resque_Worker($queues); $worker->setLogger($logger); - $logger->log(Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', array('worker' => $worker)); + $logger->log(Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', ['worker' => $worker]); $worker->work($interval, $BLOCKING); break; } } -} -// Start a single worker -else { +} else { + // Start a single worker $queues = explode(',', $QUEUE); $worker = new Resque_Worker($queues); $worker->setLogger($logger); @@ -120,10 +117,9 @@ else { $PIDFILE = getenv('PIDFILE'); if ($PIDFILE) { file_put_contents($PIDFILE, getmypid()) or - die('Could not write PID information to ' . $PIDFILE); + die('Could not write PID information to ' . $PIDFILE); } - $logger->log(Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', array('worker' => $worker)); + $logger->log(Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', ['worker' => $worker]); $worker->work($interval, $BLOCKING); } -?> From 177f8e3c1915b30987878176c8ac92002fada3ab Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 27 May 2018 14:53:24 +1200 Subject: [PATCH 03/45] Fix up readme with composer package --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8bc8fc..1ea7b58 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ If you're not familiar with Composer, please see . ```json { "require": { - "iDanoo/php-resque": "dev-master" + "idanoo/php-resque": "dev-master" } } ``` From 0d0c0d0a7e0c6f6c006db69707939cb1b2dcc60a Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Tue, 29 May 2018 22:20:56 +1200 Subject: [PATCH 04/45] - Updated travis builds to run on PHP 7.0, 7.1 and 7.2. - Added ability to specify multiple log levels. [DEBUG/INFO/NOTICE/WARNING/ERROR/CRITICAL/ALERT/EMERGENCY] - Default is now . - Removed VERBOSE / VVERBOSE flags. - Enabled date/time logging by default. --- .travis.yml | 1 - CHANGELOG.md | 13 +++++++--- README.md | 13 ++++++---- bin/resque | 10 +++----- demo/queue.php | 8 +++---- lib/Resque/Log.php | 25 ++++++++----------- lib/Resque/Redis.php | 10 ++++---- lib/Resque/Worker.php | 56 +++++++++++++++++++++---------------------- 8 files changed, 68 insertions(+), 68 deletions(-) diff --git a/.travis.yml b/.travis.yml index b7b7a22..91c26ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ php: - 7.0 - 7.1 - 7.2 - - hhvm services: - redis-server diff --git a/CHANGELOG.md b/CHANGELOG.md index 04eb5dd..f93fb99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,15 @@ +## 1.4.1 (2018-05-29) +- Updated travis builds to run on PHP 7.0, 7.1 and 7.2. +- Added ability to specify multiple log levels. [DEBUG/INFO/NOTICE/WARNING/ERROR/CRITICAL/ALERT/EMERGENCY] +- Default `LOGLEVEL` is now `WARNING`. +- Removed VERBOSE / VVERBOSE flags. +- Enabled date/time logging by default. + ## 1.4 (2018-05-25) +- Replaced credis (rather unmaintained) in favour of phpredis. +- Reformatted codebase to be PSR2 compliant. - - -## 1.3 (2013) ## +## 1.3 (2013) ## **Note:** This release introduces backwards incompatible changes with all previous versions of php-resque. Please see below for details. diff --git a/README.md b/README.md index 1ea7b58..ac6077e 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ pre and post jobs ## Requirements ## -* PHP 5.6+ +* PHP 7.0+ (May work with 5.6+, Untested) * phpredis * Redis 2.2+ @@ -232,12 +232,15 @@ variables are set (`setenv`) before you do. ### Logging ### The port supports the same environment variables for logging to STDOUT. -Setting `VERBOSE` will print basic debugging information and `VVERBOSE` -will print detailed information. +Setting `LOGLEVEL` will print different logs depending on levels. +Valid loglevels are listed below with an example. +Default `LOGLEVEL` is `WARNING`. +```bash +[DEBUG/INFO/NOTICE/WARNING/ERROR/CRITICAL/ALERT/EMERGENCY] +``` ```sh -$ VERBOSE=1 QUEUE=file_serve bin/resque -$ VVERBOSE=1 QUEUE=file_serve bin/resque +$ LOGLEVEL=DEBUG QUEUE=file_serve bin/resque ``` ### Priorities and Queue Lists ### diff --git a/bin/resque b/bin/resque index 421ce33..5867c60 100755 --- a/bin/resque +++ b/bin/resque @@ -48,13 +48,9 @@ if (!empty($REDIS_BACKEND)) { } $logLevel = false; -$LOGGING = getenv('LOGGING'); -$VERBOSE = getenv('VERBOSE'); -$VVERBOSE = getenv('VVERBOSE'); -if (!empty($LOGGING) || !empty($VERBOSE)) { - $logLevel = true; -} else if (!empty($VVERBOSE)) { - $logLevel = true; +$LOGGING = getenv('LOGLEVEL'); +if (!empty($LOGGING) ) { + $logLevel = $LOGGING; } $APP_INCLUDE = getenv('APP_INCLUDE'); diff --git a/demo/queue.php b/demo/queue.php index 60c0c48..e7b5c63 100644 --- a/demo/queue.php +++ b/demo/queue.php @@ -11,12 +11,12 @@ Resque::setBackend('127.0.0.1:6379'); //Resque::setBackend('redis://user:pass@127.0.0.1:6379'); //Resque::setBackend('redis://user:pass@a.host.name:3432/2'); -$args = array( +$args = [ 'time' => time(), - 'array' => array( + 'array' => [ 'test' => 'test', - ), -); + ], +]; if (empty($argv[2])) { $jobId = Resque::enqueue('default', $argv[1], $args, true); } else { diff --git a/lib/Resque/Log.php b/lib/Resque/Log.php index fd7d5f5..e0238e2 100644 --- a/lib/Resque/Log.php +++ b/lib/Resque/Log.php @@ -10,11 +10,11 @@ class Resque_Log extends Psr\Log\AbstractLogger { - public $verbose; + public $logLevel; - public function __construct($verbose = false) + public function __construct($logLevel = "warning") { - $this->verbose = $verbose; + $this->logLevel = strtolower($logLevel); } /** @@ -25,22 +25,17 @@ class Resque_Log extends Psr\Log\AbstractLogger * @param array $context Variables to replace { placeholder } * @return null */ - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { - if ($this->verbose) { + $logLevels = ["emergency", "alert", "critical", "error", "warning", "notice", "info", "debug"]; + if (array_search($level, $logLevels) <= array_search($this->logLevel, $logLevels)) { fwrite( STDOUT, - '[' . $level . '] [' . strftime('%T %Y-%m-%d') . '] ' . $this->interpolate($message, $context) . PHP_EOL + '[' . $level . '][' . strftime('%T %Y-%m-%d') . '] ' . $this->interpolate($message, $context) . PHP_EOL ); - return; } + return; - if (!($level === Psr\Log\LogLevel::INFO || $level === Psr\Log\LogLevel::DEBUG)) { - fwrite( - STDOUT, - '[' . $level . '] ' . $this->interpolate($message, $context) . PHP_EOL - ); - } } /** @@ -51,10 +46,10 @@ class Resque_Log extends Psr\Log\AbstractLogger * @param array $context Array of variables to use in message * @return string */ - public function interpolate($message, array $context = array()) + public function interpolate($message, array $context = []) { // build a replacement array with braces around the context keys - $replace = array(); + $replace = []; foreach ($context as $key => $val) { $replace['{' . $key . '}'] = $val; } diff --git a/lib/Resque/Redis.php b/lib/Resque/Redis.php index b68f4f3..1df4433 100644 --- a/lib/Resque/Redis.php +++ b/lib/Resque/Redis.php @@ -181,7 +181,7 @@ class Resque_Redis $parts = parse_url($dsn); // Check the URI scheme - $validSchemes = array('redis', 'tcp'); + $validSchemes = ['redis', 'tcp']; if (isset($parts['scheme']) && !in_array($parts['scheme'], $validSchemes)) { throw new \InvalidArgumentException("Invalid DSN. Supported schemes are " . implode(', ', $validSchemes)); } @@ -207,20 +207,20 @@ class Resque_Redis $pass = isset($parts['pass']) ? $parts['pass'] : false; // Convert the query string into an associative array - $options = array(); + $options = []; if (isset($parts['query'])) { // Parse the query string into an array parse_str($parts['query'], $options); } - return array( + return [ $parts['host'], $port, $database, $user, $pass, $options, - ); + ]; } /** @@ -244,7 +244,7 @@ class Resque_Redis } } try { - return call_user_func_array(array($this->redisConnection, $name), $args); + return call_user_func_array([$this->redisConnection, $name], $args); } catch (Exception $e) { throw new Resque_RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); } diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index 37f0fad..8137eed 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -21,7 +21,7 @@ class Resque_Worker /** * @var array Array of all associated queues for this worker. */ - private $queues = array(); + private $queues = []; /** * @var string The hostname of this worker. @@ -69,7 +69,7 @@ class Resque_Worker $this->logger = new Resque_Log(); if (!is_array($queues)) { - $queues = array($queues); + $queues = [$queues]; } $this->queues = $queues; @@ -86,10 +86,10 @@ class Resque_Worker { $workers = Resque::redis()->smembers('workers'); if (!is_array($workers)) { - $workers = array(); + $workers = []; } - $instances = array(); + $instances = []; foreach ($workers as $workerId) { $instances[] = self::find($workerId); } @@ -158,7 +158,7 @@ class Resque_Worker $job = false; if (!$this->paused) { if ($blocking === true) { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Starting blocking with timeout of {interval}', array('interval' => $interval)); + $this->logger->log(Psr\Log\LogLevel::INFO, 'Starting blocking with timeout of {interval}', ['interval' => $interval]); $this->updateProcLine('Waiting for ' . implode(',', $this->queues) . ' with blocking timeout ' . $interval); } else { $this->updateProcLine('Waiting for ' . implode(',', $this->queues) . ' with interval ' . $interval); @@ -175,7 +175,7 @@ class Resque_Worker if ($blocking === false) { // If no job was found, we sleep for $interval before continuing and checking again - $this->logger->log(Psr\Log\LogLevel::INFO, 'Sleeping for {interval}', array('interval' => $interval)); + $this->logger->log(Psr\Log\LogLevel::INFO, 'Sleeping for {interval}', ['interval' => $interval]); if ($this->paused) { $this->updateProcLine('Paused'); } else { @@ -188,7 +188,7 @@ class Resque_Worker continue; } - $this->logger->log(Psr\Log\LogLevel::NOTICE, 'Starting work on {job}', array('job' => $job)); + $this->logger->log(Psr\Log\LogLevel::NOTICE, 'Starting work on {job}', ['job' => $job]); Resque_Event::trigger('beforeFork', $job); $this->workingOn($job); @@ -239,13 +239,13 @@ class Resque_Worker Resque_Event::trigger('afterFork', $job); $job->perform(); } catch (Exception $e) { - $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => $e)); + $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', ['job' => $job, 'stack' => $e]); $job->fail($e); return; } $job->updateStatus(Resque_Job_Status::STATUS_COMPLETE); - $this->logger->log(Psr\Log\LogLevel::NOTICE, '{job} has finished', array('job' => $job)); + $this->logger->log(Psr\Log\LogLevel::NOTICE, '{job} has finished', ['job' => $job]); } /** @@ -257,21 +257,21 @@ class Resque_Worker { $queues = $this->queues(); if (!is_array($queues)) { - return; + return false; } if ($blocking === true) { $job = Resque_Job::reserveBlocking($queues, $timeout); if ($job) { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Found job on {queue}', array('queue' => $job->queue)); + $this->logger->log(Psr\Log\LogLevel::INFO, 'Found job on {queue}', ['queue' => $job->queue]); return $job; } } else { foreach ($queues as $queue) { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Checking {queue} for jobs', array('queue' => $queue)); + $this->logger->log(Psr\Log\LogLevel::INFO, 'Checking {queue} for jobs', ['queue' => $queue]); $job = Resque_Job::reserve($queue); if ($job) { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Found job on {queue}', array('queue' => $job->queue)); + $this->logger->log(Psr\Log\LogLevel::INFO, 'Found job on {queue}', ['queue' => $job->queue]); return $job; } } @@ -344,12 +344,12 @@ class Resque_Worker return; } - pcntl_signal(SIGTERM, array($this, 'shutDownNow')); - pcntl_signal(SIGINT, array($this, 'shutDownNow')); - pcntl_signal(SIGQUIT, array($this, 'shutdown')); - pcntl_signal(SIGUSR1, array($this, 'killChild')); - pcntl_signal(SIGUSR2, array($this, 'pauseProcessing')); - pcntl_signal(SIGCONT, array($this, 'unPauseProcessing')); + pcntl_signal(SIGTERM, [$this, 'shutDownNow']); + pcntl_signal(SIGINT, [$this, 'shutDownNow']); + pcntl_signal(SIGQUIT, [$this, 'shutdown']); + pcntl_signal(SIGUSR1, [$this, 'killChild']); + pcntl_signal(SIGUSR2, [$this, 'pauseProcessing']); + pcntl_signal(SIGCONT, [$this, 'unPauseProcessing']); $this->logger->log(Psr\Log\LogLevel::DEBUG, 'Registered signals'); } @@ -403,13 +403,13 @@ class Resque_Worker return; } - $this->logger->log(Psr\Log\LogLevel::INFO, 'Killing child at {child}', array('child' => $this->child)); + $this->logger->log(Psr\Log\LogLevel::INFO, 'Killing child at {child}', ['child' => $this->child]); if (exec('ps -o pid,state -p ' . $this->child, $output, $returnCode) && $returnCode != 1) { - $this->logger->log(Psr\Log\LogLevel::DEBUG, 'Child {child} found, killing.', array('child' => $this->child)); + $this->logger->log(Psr\Log\LogLevel::DEBUG, 'Child {child} found, killing.', ['child' => $this->child]); posix_kill($this->child, SIGKILL); $this->child = null; } else { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Child {child} not found, restarting.', array('child' => $this->child)); + $this->logger->log(Psr\Log\LogLevel::INFO, 'Child {child} not found, restarting.', ['child' => $this->child]); $this->shutdown(); } } @@ -432,7 +432,7 @@ class Resque_Worker if ($host != $this->hostname || in_array($pid, $workerPids) || $pid == getmypid()) { continue; } - $this->logger->log(Psr\Log\LogLevel::INFO, 'Pruning dead worker: {worker}', array('worker' => (string)$worker)); + $this->logger->log(Psr\Log\LogLevel::INFO, 'Pruning dead worker: {worker}', ['worker' => (string)$worker]); $worker->unregisterWorker(); } } @@ -446,7 +446,7 @@ class Resque_Worker */ public function workerPids() { - $pids = array(); + $pids = []; exec('ps -A -o pid,command | grep [r]esque', $cmdOutput); foreach ($cmdOutput as $line) { list($pids[],) = explode(' ', trim($line), 2); @@ -490,11 +490,11 @@ class Resque_Worker $job->worker = $this; $this->currentJob = $job; $job->updateStatus(Resque_Job_Status::STATUS_RUNNING); - $data = json_encode(array( + $data = json_encode([ 'queue' => $job->queue, 'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'), 'payload' => $job->payload - )); + ]); Resque::redis()->set('worker:' . $job->worker, $data); } @@ -523,13 +523,13 @@ class Resque_Worker /** * Return an object describing the job this worker is currently working on. * - * @return object Object with details of current job. + * @return array Array with details of current job. */ public function job() { $job = Resque::redis()->get('worker:' . $this); if (!$job) { - return array(); + return []; } else { return json_decode($job, true); } From b235fce1bd9310afc465f5d2b91a3cfeeb5eda55 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Tue, 29 May 2018 22:24:38 +1200 Subject: [PATCH 05/45] Updated Composer to 1.4.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 880fde2..d6f89be 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "idanoo/php-resque", - "version": "1.4.0", + "version": "1.4.1", "type": "library", "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", "keywords": ["job", "background", "redis", "resque"], From 493d6dc6d84200cd17dd9aea686ed56361fa6311 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 30 May 2018 08:25:02 +1200 Subject: [PATCH 06/45] Added 48 hour TTL to worker:xxx:started keys to prevent db pollution --- CHANGELOG.md | 12 ++-- build.xml | 3 +- demo/init.php | 4 +- demo/php_error_job.php | 2 +- extras/sample-plugin.php | 14 ++-- lib/Resque.php | 15 +++-- lib/Resque/Failure.php | 4 +- lib/Resque/Job.php | 19 +++--- lib/Resque/Job/Status.php | 8 +-- lib/Resque/Redis.php | 1 + lib/Resque/Worker.php | 15 +++-- test/Resque/Tests/EventTest.php | 66 +++++++++--------- test/Resque/Tests/JobStatusTest.php | 2 +- test/Resque/Tests/JobTest.php | 100 ++++++++++++++-------------- test/Resque/Tests/LogTest.php | 4 +- test/Resque/Tests/RedisTest.php | 6 +- test/Resque/Tests/WorkerTest.php | 24 +++---- 17 files changed, 158 insertions(+), 141 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f93fb99..3079d35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,17 @@ -## 1.4.1 (2018-05-29) +## 1.4.1 (2018-05-29) - Updated travis builds to run on PHP 7.0, 7.1 and 7.2. - Added ability to specify multiple log levels. [DEBUG/INFO/NOTICE/WARNING/ERROR/CRITICAL/ALERT/EMERGENCY] -- Default `LOGLEVEL` is now `WARNING`. -- Removed VERBOSE / VVERBOSE flags. -- Enabled date/time logging by default. +- Default `LOGLEVEL` is now `WARNING`. +- Removed VERBOSE / VVERBOSE flags and always output timestamp in logs. +- Added 48 hour TTL to the worker started timestamp to prevent db pollution on server termination. ## 1.4 (2018-05-25) +- Forked from chrisboulton/php-resque. - Replaced credis (rather unmaintained) in favour of phpredis. - Reformatted codebase to be PSR2 compliant. -## 1.3 (2013) ## + +## 1.3 (2013) **Note:** This release introduces backwards incompatible changes with all previous versions of php-resque. Please see below for details. diff --git a/build.xml b/build.xml index 7289999..b51c486 100644 --- a/build.xml +++ b/build.xml @@ -1,3 +1,4 @@ + @@ -7,7 +8,7 @@ - + diff --git a/demo/init.php b/demo/init.php index 62dff24..bdad7e5 100644 --- a/demo/init.php +++ b/demo/init.php @@ -2,11 +2,11 @@ // Find and initialize Composer // NOTE: You should NOT use this when developing against php-resque. // The autoload code below is specifically for this demo. -$files = array( +$files = [ __DIR__ . '/../../vendor/autoload.php', __DIR__ . '/../../../../autoload.php', __DIR__ . '/../vendor/autoload.php', -); +]; $found = false; foreach ($files as $file) { diff --git a/demo/php_error_job.php b/demo/php_error_job.php index 35af1b2..ceecdfb 100644 --- a/demo/php_error_job.php +++ b/demo/php_error_job.php @@ -1,4 +1,4 @@ -blpop($list, (int)$timeout); if (!$item) { - return; + return false; } /** @@ -244,7 +245,7 @@ class Resque * Reserve and return the next available job in the specified queue. * * @param string $queue Queue to fetch next available job from. - * @return Resque_Job Instance of Resque_Job to be processed, false if none or error. + * @return false|object|Resque_Job */ public static function reserve($queue) { @@ -325,7 +326,9 @@ class Resque * @params string $string redis result in json * @params $items * - * @return (bool) + * @param $string + * @param $items + * @return bool (bool) */ private static function matchItem($string, $items) { @@ -360,7 +363,9 @@ class Resque * @private * * @params string $queue the name of the queue + * @param $queue * @return integer number of deleted items belongs to this list + * @throws Resque_RedisException */ private static function removeList($queue) { diff --git a/lib/Resque/Failure.php b/lib/Resque/Failure.php index adf02a3..d73fb6d 100644 --- a/lib/Resque/Failure.php +++ b/lib/Resque/Failure.php @@ -18,7 +18,7 @@ class Resque_Failure /** * Create a new failed job on the backend. * - * @param object $payload The contents of the job that has just failed. + * @param array $payload The contents of the job that has just failed. * @param \Exception $exception The exception generated when the job failed to run. * @param \Resque_Worker $worker Instance of Resque_Worker that was running this job when it failed. * @param string $queue The name of the queue that this job was fetched from. @@ -32,7 +32,7 @@ class Resque_Failure /** * Return an instance of the backend for saving job failures. * - * @return object Instance of backend object. + * @return object|string */ public static function getBackend() { diff --git a/lib/Resque/Job.php b/lib/Resque/Job.php index b47b515..3a91cbc 100755 --- a/lib/Resque/Job.php +++ b/lib/Resque/Job.php @@ -70,12 +70,12 @@ class Resque_Job 'Supplied $args must be an array.' ); } - Resque::push($queue, array( + Resque::push($queue, [ 'class' => $class, - 'args' => array($args), + 'args' => [$args], 'id' => $id, 'queue_time' => microtime(true), - )); + ]); if ($monitor) { Resque_Job_Status::create($id); @@ -153,7 +153,7 @@ class Resque_Job public function getArguments() { if (!isset($this->payload['args'])) { - return array(); + return []; } return $this->payload['args'][0]; @@ -162,7 +162,6 @@ class Resque_Job /** * Get the instantiated object for this job that will be performing work. * @return Resque_JobInterface Instance of the object that this job belongs to. - * @throws Resque_Exception */ public function getInstance() { @@ -200,7 +199,7 @@ class Resque_Job Resque_Event::trigger('afterPerform', $this); } // beforePerform/setUp have said don't perform this job. Return. - catch (Resque_Job_DontPerform $e) { + /** @noinspection PhpRedundantCatchClauseInspection */ catch (Resque_Job_DontPerform $e) { return false; } @@ -214,10 +213,10 @@ class Resque_Job */ public function fail($exception) { - Resque_Event::trigger('onFailure', array( + Resque_Event::trigger('onFailure', [ 'exception' => $exception, 'job' => $this, - )); + ]); $this->updateStatus(Resque_Job_Status::STATUS_FAILED); Resque_Failure::create( @@ -252,9 +251,9 @@ class Resque_Job */ public function __toString() { - $name = array( + $name = [ 'Job{' . $this->queue . '}' - ); + ]; if (!empty($this->payload['id'])) { $name[] = 'ID: ' . $this->payload['id']; } diff --git a/lib/Resque/Job/Status.php b/lib/Resque/Job/Status.php index 8987fd7..730677b 100644 --- a/lib/Resque/Job/Status.php +++ b/lib/Resque/Job/Status.php @@ -29,10 +29,10 @@ class Resque_Job_Status /** * @var array Array of statuses that are considered final/complete. */ - private static $completeStatuses = array( + private static $completeStatuses = [ self::STATUS_FAILED, self::STATUS_COMPLETE - ); + ]; /** * Setup a new instance of the job monitor class for the supplied job ID. @@ -52,11 +52,11 @@ class Resque_Job_Status */ public static function create($id) { - $statusPacket = array( + $statusPacket = [ 'status' => self::STATUS_WAITING, 'updated' => time(), 'started' => time(), - ); + ]; Resque::redis()->set('job:' . $id . ':status', json_encode($statusPacket)); } diff --git a/lib/Resque/Redis.php b/lib/Resque/Redis.php index 1df4433..56b55c9 100644 --- a/lib/Resque/Redis.php +++ b/lib/Resque/Redis.php @@ -119,6 +119,7 @@ class Resque_Redis if (is_object($client)) { $this->redisConnection = $client; } else { + /** @noinspection PhpUnusedLocalVariableInspection */ list($host, $port, $dsnDatabase, $user, $password, $options) = self::parseDsn($server); // $user is not used, only $password $timeout = isset($options['timeout']) ? intval($options['timeout']) : null; diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index 8137eed..d7a7aa9 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -101,6 +101,7 @@ class Resque_Worker * * @param string $workerId ID of the worker. * @return boolean True if the worker exists, false if not. + * @throws Resque_RedisException */ public static function exists($workerId) { @@ -111,14 +112,15 @@ class Resque_Worker * Given a worker ID, find it and return an instantiated worker class for it. * * @param string $workerId The ID of the worker. - * @return Resque_Worker Instance of the worker. False if the worker does not exist. + * @return bool|Resque_Worker + * @throws Resque_RedisException */ public static function find($workerId) { if (!self::exists($workerId) || false === strpos($workerId, ":")) { return false; } - + /** @noinspection PhpUnusedLocalVariableInspection */ list($hostname, $pid, $queues) = explode(':', $workerId, 3); $queues = explode(',', $queues); $worker = new self($queues); @@ -143,6 +145,8 @@ class Resque_Worker * Queues are checked every $interval (seconds) for new jobs. * * @param int $interval How often to check for new jobs across the queues. + * @param bool $blocking + * @throws Resque_RedisException */ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false) { @@ -199,6 +203,7 @@ class Resque_Worker $status = 'Processing ' . $job->queue . ' since ' . strftime('%F %T'); $this->updateProcLine($status); $this->logger->log(Psr\Log\LogLevel::INFO, $status); + /** @noinspection PhpParamsInspection */ $this->perform($job); if ($this->child === 0) { exit(0); @@ -456,11 +461,12 @@ class Resque_Worker /** * Register this worker in Redis. + * 48 hour TTL so we don't pollute the db on server termination. */ public function registerWorker() { Resque::redis()->sadd('workers', (string)$this); - Resque::redis()->set('worker:' . (string)$this . ':started', strftime('%a %b %d %H:%M:%S %Z %Y')); + Resque::redis()->setex('worker:' . (string)$this . ':started', 172800, strftime('%a %b %d %H:%M:%S %Z %Y')); } /** @@ -483,7 +489,8 @@ class Resque_Worker /** * Tell Redis which job we're currently working on. * - * @param object $job Resque_Job instance containing the job we're working on. + * @param Resque_Job $job Resque_Job instance containing the job we're working on. + * @throws Resque_RedisException */ public function workingOn(Resque_Job $job) { diff --git a/test/Resque/Tests/EventTest.php b/test/Resque/Tests/EventTest.php index 941cfbd..24a83c7 100644 --- a/test/Resque/Tests/EventTest.php +++ b/test/Resque/Tests/EventTest.php @@ -10,7 +10,7 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase { - private $callbacksHit = array(); + private $callbacksHit = []; private $worker; public function setUp() @@ -26,17 +26,17 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase public function tearDown() { Resque_Event::clearListeners(); - $this->callbacksHit = array(); + $this->callbacksHit = []; } public function getEventTestJob() { - $payload = array( + $payload = [ 'class' => 'Test_Job', - 'args' => array( - array('somevar'), - ), - ); + 'args' => [ + ['somevar'], + ], + ]; $job = new Resque_Job('jobs', $payload); $job->worker = $this->worker; return $job; @@ -44,19 +44,21 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase public function eventCallbackProvider() { - return array( - array('beforePerform', 'beforePerformEventCallback'), - array('afterPerform', 'afterPerformEventCallback'), - array('afterFork', 'afterForkEventCallback'), - ); + return [ + ['beforePerform', 'beforePerformEventCallback'], + ['afterPerform', 'afterPerformEventCallback'], + ['afterFork', 'afterForkEventCallback'], + ]; } /** * @dataProvider eventCallbackProvider + * @param $event + * @param $callback */ public function testEventCallbacksFire($event, $callback) { - Resque_Event::listen($event, array($this, $callback)); + Resque_Event::listen($event, [$this, $callback]); $job = $this->getEventTestJob(); $this->worker->perform($job); @@ -70,11 +72,11 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase $event = 'beforeFork'; $callback = 'beforeForkEventCallback'; - Resque_Event::listen($event, array($this, $callback)); - Resque::enqueue('jobs', 'Test_Job', array( + Resque_Event::listen($event, [$this, $callback]); + Resque::enqueue('jobs', 'Test_Job', [ 'somevar' - )); - $job = $this->getEventTestJob(); + ]); + $this->getEventTestJob(); $this->worker->work(0); $this->assertContains($callback, $this->callbacksHit, $event . ' callback (' . $callback . ') was not called'); } @@ -84,17 +86,17 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase $event = 'beforeEnqueue'; $callback = 'beforeEnqueueEventCallback'; - Resque_Event::listen($event, array($this, $callback)); - Resque::enqueue('jobs', 'Test_Job', array( + Resque_Event::listen($event, [$this, $callback]); + Resque::enqueue('jobs', 'Test_Job', [ 'somevar' - )); + ]); $this->assertContains($callback, $this->callbacksHit, $event . ' callback (' . $callback . ') was not called'); } public function testBeforePerformEventCanStopWork() { $callback = 'beforePerformEventDontPerformCallback'; - Resque_Event::listen('beforePerform', array($this, $callback)); + Resque_Event::listen('beforePerform', [$this, $callback]); $job = $this->getEventTestJob(); @@ -106,8 +108,8 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase public function testBeforeEnqueueEventStopsJobCreation() { $callback = 'beforeEnqueueEventDontCreateCallback'; - Resque_Event::listen('beforeEnqueue', array($this, $callback)); - Resque_Event::listen('afterEnqueue', array($this, 'afterEnqueueEventCallback')); + Resque_Event::listen('beforeEnqueue', [$this, $callback]); + Resque_Event::listen('afterEnqueue', [$this, 'afterEnqueueEventCallback']); $result = Resque::enqueue('test_job', 'TestClass'); $this->assertContains($callback, $this->callbacksHit, $callback . ' callback was not called'); @@ -120,10 +122,10 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase $callback = 'afterEnqueueEventCallback'; $event = 'afterEnqueue'; - Resque_Event::listen($event, array($this, $callback)); - Resque::enqueue('jobs', 'Test_Job', array( + Resque_Event::listen($event, [$this, $callback]); + Resque::enqueue('jobs', 'Test_Job', [ 'somevar' - )); + ]); $this->assertContains($callback, $this->callbacksHit, $event . ' callback (' . $callback . ') was not called'); } @@ -132,8 +134,8 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase $callback = 'beforePerformEventCallback'; $event = 'beforePerform'; - Resque_Event::listen($event, array($this, $callback)); - Resque_Event::stopListening($event, array($this, $callback)); + Resque_Event::listen($event, [$this, $callback]); + Resque_Event::stopListening($event, [$this, $callback]); $job = $this->getEventTestJob(); $this->worker->perform($job); @@ -144,13 +146,13 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase ); } - public function beforePerformEventDontPerformCallback($instance) + public function beforePerformEventDontPerformCallback() { $this->callbacksHit[] = __FUNCTION__; throw new Resque_Job_DontPerform(); } - public function beforeEnqueueEventDontCreateCallback($queue, $class, $args, $track = false) + public function beforeEnqueueEventDontCreateCallback() { $this->callbacksHit[] = __FUNCTION__; throw new Resque_Job_DontCreate(); @@ -170,9 +172,9 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase { $this->callbacksHit[] = __FUNCTION__; $this->assertEquals('Test_Job', $class); - $this->assertEquals(array( + $this->assertEquals([ 'somevar', - ), $args); + ], $args); } public function beforeEnqueueEventCallback($job) diff --git a/test/Resque/Tests/JobStatusTest.php b/test/Resque/Tests/JobStatusTest.php index 36729dd..b2120ba 100644 --- a/test/Resque/Tests/JobStatusTest.php +++ b/test/Resque/Tests/JobStatusTest.php @@ -33,7 +33,7 @@ class Resque_Tests_JobStatusTest extends Resque_Tests_TestCase public function testJobStatusIsReturnedViaJobInstance() { - $token = Resque::enqueue('jobs', 'Test_Job', null, true); + Resque::enqueue('jobs', 'Test_Job', null, true); $job = Resque_Job::reserve('jobs'); $this->assertEquals(Resque_Job_Status::STATUS_WAITING, $job->getStatus()); diff --git a/test/Resque/Tests/JobTest.php b/test/Resque/Tests/JobTest.php index 18d9674..ada26cb 100644 --- a/test/Resque/Tests/JobTest.php +++ b/test/Resque/Tests/JobTest.php @@ -51,17 +51,17 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase public function testQueuedJobReturnsExactSamePassedInArguments() { - $args = array( + $args = [ 'int' => 123, - 'numArray' => array( + 'numArray' => [ 1, 2, - ), - 'assocArray' => array( + ], + 'assocArray' => [ 'key1' => 'value1', 'key2' => 'value2' - ), - ); + ], + ]; Resque::enqueue('jobs', 'Test_Job', $args); $job = Resque_Job::reserve('jobs'); @@ -77,17 +77,17 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase public function testRecreatedJobMatchesExistingJob() { - $args = array( + $args = [ 'int' => 123, - 'numArray' => array( + 'numArray' => [ 1, 2, - ), - 'assocArray' => array( + ], + 'assocArray' => [ 'key1' => 'value1', 'key2' => 'value2' - ), - ); + ], + ]; Resque::enqueue('jobs', 'Test_Job', $args); $job = Resque_Job::reserve('jobs'); @@ -103,10 +103,10 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase public function testFailedJobExceptionsAreCaught() { - $payload = array( + $payload = [ 'class' => 'Failing_Job', 'args' => null - ); + ]; $job = new Resque_Job('jobs', $payload); $job->worker = $this->worker; @@ -140,13 +140,13 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase public function testJobWithSetUpCallbackFiresSetUp() { - $payload = array( + $payload = [ 'class' => 'Test_Job_With_SetUp', - 'args' => array( + 'args' => [ 'somevar', 'somevar2', - ), - ); + ], + ]; $job = new Resque_Job('jobs', $payload); $job->perform(); @@ -155,13 +155,13 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase public function testJobWithTearDownCallbackFiresTearDown() { - $payload = array( + $payload = [ 'class' => 'Test_Job_With_TearDown', - 'args' => array( + 'args' => [ 'somevar', 'somevar2', - ), - ); + ], + ]; $job = new Resque_Job('jobs', $payload); $job->perform(); @@ -170,12 +170,12 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase public function testNamespaceNaming() { - $fixture = array( - array('test' => 'more:than:one:with:', 'assertValue' => 'more:than:one:with:'), - array('test' => 'more:than:one:without', 'assertValue' => 'more:than:one:without:'), - array('test' => 'resque', 'assertValue' => 'resque:'), - array('test' => 'resque:', 'assertValue' => 'resque:'), - ); + $fixture = [ + ['test' => 'more:than:one:with:', 'assertValue' => 'more:than:one:with:'], + ['test' => 'more:than:one:without', 'assertValue' => 'more:than:one:without:'], + ['test' => 'resque', 'assertValue' => 'resque:'], + ['test' => 'resque:', 'assertValue' => 'resque:'], + ]; foreach ($fixture as $item) { Resque_Redis::prefix($item['test']); @@ -187,10 +187,10 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase { Resque_Redis::prefix('php'); $queue = 'jobs'; - $payload = array('another_value'); + $payload = ['another_value']; Resque::enqueue($queue, 'Test_Job_With_TearDown', $payload); - $this->assertEquals(Resque::queues(), array('jobs')); + $this->assertEquals(Resque::queues(), ['jobs']); $this->assertEquals(Resque::size($queue), 1); Resque_Redis::prefix('resque'); @@ -228,7 +228,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase Resque::enqueue($queue, 'Test_Job_Dequeue1'); Resque::enqueue($queue, 'Test_Job_Dequeue2'); $this->assertEquals(Resque::size($queue), 2); - $test = array('Test_Job_Dequeue2'); + $test = ['Test_Job_Dequeue2']; $this->assertEquals(Resque::dequeue($queue, $test), 1); $this->assertEquals(Resque::size($queue), 1); } @@ -240,7 +240,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase Resque::enqueue($queue, 'Test_Job_Dequeue2'); Resque::enqueue($queue, 'Test_Job_Dequeue3'); $this->assertEquals(Resque::size($queue), 3); - $test = array('Test_Job_Dequeue2', 'Test_Job_Dequeue3'); + $test = ['Test_Job_Dequeue2', 'Test_Job_Dequeue3']; $this->assertEquals(Resque::dequeue($queue, $test), 2); $this->assertEquals(Resque::size($queue), 1); } @@ -252,7 +252,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase Resque::enqueue($queue, 'Test_Job_Dequeue2'); Resque::enqueue($queue, 'Test_Job_Dequeue3'); $this->assertEquals(Resque::size($queue), 3); - $test = array('Test_Job_Dequeue4'); + $test = ['Test_Job_Dequeue4']; $this->assertEquals(Resque::dequeue($queue, $test), 0); $this->assertEquals(Resque::size($queue), 3); } @@ -264,7 +264,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase Resque::enqueue($queue, 'Test_Job_Dequeue2'); Resque::enqueue($queue, 'Test_Job_Dequeue3'); $this->assertEquals(Resque::size($queue), 3); - $test = array('Test_Job_Dequeue4', 'Test_Job_Dequeue1'); + $test = ['Test_Job_Dequeue4', 'Test_Job_Dequeue1']; $this->assertEquals(Resque::dequeue($queue, $test), 1); $this->assertEquals(Resque::size($queue), 2); } @@ -275,7 +275,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase Resque::enqueue($queue, 'Test_Job_Dequeue'); $qid = Resque::enqueue($queue, 'Test_Job_Dequeue'); $this->assertEquals(Resque::size($queue), 2); - $test = array('Test_Job_Dequeue' => $qid); + $test = ['Test_Job_Dequeue' => $qid]; $this->assertEquals(Resque::dequeue($queue, $test), 1); $this->assertEquals(Resque::size($queue), 1); } @@ -287,7 +287,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase $qid = Resque::enqueue($queue, 'Test_Job_Dequeue'); $this->assertEquals(Resque::size($queue), 2); #qid right but class name is wrong - $test = array('Test_Job_Dequeue1' => $qid); + $test = ['Test_Job_Dequeue1' => $qid]; $this->assertEquals(Resque::dequeue($queue, $test), 0); $this->assertEquals(Resque::size($queue), 2); } @@ -296,9 +296,9 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase { $queue = 'jobs'; Resque::enqueue($queue, 'Test_Job_Dequeue'); - $qid = Resque::enqueue($queue, 'Test_Job_Dequeue'); + Resque::enqueue($queue, 'Test_Job_Dequeue'); $this->assertEquals(Resque::size($queue), 2); - $test = array('Test_Job_Dequeue' => 'r4nD0mH4sh3dId'); + $test = ['Test_Job_Dequeue' => 'r4nD0mH4sh3dId']; $this->assertEquals(Resque::dequeue($queue, $test), 0); $this->assertEquals(Resque::size($queue), 2); } @@ -328,7 +328,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase // WHEN $test = ['Test_Job_Dequeue9' => $removeArgs]; - $removedItems = Resque::dequeue($queue, $test, "Dequeue one failed!"); + $removedItems = Resque::dequeue($queue, $test); // THEN $this->assertEquals($removedItems, 2); @@ -341,12 +341,12 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase public function testDequeueItemWithUnorderedArg() { $queue = 'jobs'; - $arg = array('foo' => 1, 'bar' => 2); - $arg2 = array('bar' => 2, 'foo' => 1); + $arg = ['foo' => 1, 'bar' => 2]; + $arg2 = ['bar' => 2, 'foo' => 1]; Resque::enqueue($queue, 'Test_Job_Dequeue'); Resque::enqueue($queue, 'Test_Job_Dequeue', $arg); $this->assertEquals(Resque::size($queue), 2); - $test = array('Test_Job_Dequeue' => $arg2); + $test = ['Test_Job_Dequeue' => $arg2]; $this->assertEquals(Resque::dequeue($queue, $test), 1); $this->assertEquals(Resque::size($queue), 1); } @@ -354,22 +354,22 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase public function testDequeueItemWithiWrongArg() { $queue = 'jobs'; - $arg = array('foo' => 1, 'bar' => 2); - $arg2 = array('foo' => 2, 'bar' => 3); + $arg = ['foo' => 1, 'bar' => 2]; + $arg2 = ['foo' => 2, 'bar' => 3]; Resque::enqueue($queue, 'Test_Job_Dequeue'); Resque::enqueue($queue, 'Test_Job_Dequeue', $arg); $this->assertEquals(Resque::size($queue), 2); - $test = array('Test_Job_Dequeue' => $arg2); + $test = ['Test_Job_Dequeue' => $arg2]; $this->assertEquals(Resque::dequeue($queue, $test), 0); $this->assertEquals(Resque::size($queue), 2); } public function testUseDefaultFactoryToGetJobInstance() { - $payload = array( + $payload = [ 'class' => 'Some_Job_Class', 'args' => null - ); + ]; $job = new Resque_Job('jobs', $payload); $instance = $job->getInstance(); $this->assertInstanceOf('Some_Job_Class', $instance); @@ -377,10 +377,10 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase public function testUseFactoryToGetJobInstance() { - $payload = array( + $payload = [ 'class' => 'Some_Job_Class', - 'args' => array(array()) - ); + 'args' => [[]] + ]; $job = new Resque_Job('jobs', $payload); $factory = new Some_Stub_Factory(); $job->setJobFactory($factory); diff --git a/test/Resque/Tests/LogTest.php b/test/Resque/Tests/LogTest.php index 05310eb..76a74d1 100644 --- a/test/Resque/Tests/LogTest.php +++ b/test/Resque/Tests/LogTest.php @@ -13,7 +13,7 @@ class Resque_Tests_LogTest extends Resque_Tests_TestCase public function testLogInterpolate() { $logger = new Resque_Log(); - $actual = $logger->interpolate('string {replace}', array('replace' => 'value')); + $actual = $logger->interpolate('string {replace}', ['replace' => 'value']); $expected = 'string value'; $this->assertEquals($expected, $actual); @@ -24,7 +24,7 @@ class Resque_Tests_LogTest extends Resque_Tests_TestCase $logger = new Resque_Log(); $actual = $logger->interpolate( 'string {replace1} {replace2}', - array('replace1' => 'value1', 'replace2' => 'value2') + ['replace1' => 'value1', 'replace2' => 'value2'] ); $expected = 'string value1 value2'; diff --git a/test/Resque/Tests/RedisTest.php b/test/Resque/Tests/RedisTest.php index 2caffc2..7e9a346 100644 --- a/test/Resque/Tests/RedisTest.php +++ b/test/Resque/Tests/RedisTest.php @@ -10,9 +10,6 @@ class Resque_Tests_RedisTest extends Resque_Tests_TestCase { - /** - * @expectedException Test basic redis functionality. - */ public function testRedisGetSet() { $this->redis->set("testKey", 24); @@ -173,6 +170,8 @@ class Resque_Tests_RedisTest extends Resque_Tests_TestCase /** * @dataProvider validDsnStringProvider + * @param $dsn + * @param $expected */ public function testParsingValidDsnString($dsn, $expected) { @@ -183,6 +182,7 @@ class Resque_Tests_RedisTest extends Resque_Tests_TestCase /** * @dataProvider bogusDsnStringProvider * @expectedException InvalidArgumentException + * @param $dsn */ public function testParsingBogusDsnStringThrowsException($dsn) { diff --git a/test/Resque/Tests/WorkerTest.php b/test/Resque/Tests/WorkerTest.php index 3dc4e2f..6dbd38b 100644 --- a/test/Resque/Tests/WorkerTest.php +++ b/test/Resque/Tests/WorkerTest.php @@ -57,8 +57,8 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase $worker->unregisterWorker(); $this->assertFalse(Resque_Worker::exists((string)$worker)); - $this->assertEquals(array(), Resque_Worker::all()); - $this->assertEquals(array(), $this->redis->smembers('resque:workers')); + $this->assertEquals([], Resque_Worker::all()); + $this->assertEquals([], $this->redis->smembers('resque:workers')); } public function testPausedWorkerDoesNotPickUpJobs() @@ -87,10 +87,10 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase public function testWorkerCanWorkOverMultipleQueues() { - $worker = new Resque_Worker(array( + $worker = new Resque_Worker([ 'queue1', 'queue2' - )); + ]); $worker->setLogger(new Resque_Log()); $worker->registerWorker(); Resque::enqueue('queue1', 'Test_Job_1'); @@ -105,11 +105,11 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase public function testWorkerWorksQueuesInSpecifiedOrder() { - $worker = new Resque_Worker(array( + $worker = new Resque_Worker([ 'high', 'medium', 'low' - )); + ]); $worker->setLogger(new Resque_Log()); $worker->registerWorker(); @@ -163,7 +163,7 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase $job = $worker->reserve(); $worker->workingOn($job); $worker->doneWorking(); - $this->assertEquals(array(), $worker->job()); + $this->assertEquals([], $worker->job()); } public function testWorkerRecordsWhatItIsWorkingOn() @@ -172,9 +172,9 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase $worker->setLogger(new Resque_Log()); $worker->registerWorker(); - $payload = array( + $payload = [ 'class' => 'Test_Job' - ); + ]; $job = new Resque_Job('jobs', $payload); $worker->workingOn($job); @@ -214,7 +214,7 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase $worker->setId($workerId[0] . ':1:jobs'); $worker->registerWorker(); - $worker = new Resque_Worker(array('high', 'low')); + $worker = new Resque_Worker(['high', 'low']); $worker->setLogger(new Resque_Log()); $worker->setId($workerId[0] . ':2:high,low'); $worker->registerWorker(); @@ -258,9 +258,9 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase $worker->setLogger(new Resque_Log()); $worker->registerWorker(); - $payload = array( + $payload = [ 'class' => 'Test_Job' - ); + ]; $job = new Resque_Job('jobs', $payload); $worker->workingOn($job); From bd0a0c2dc86f04fc493f644c07aff16341be43f0 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 30 May 2018 19:05:13 +1200 Subject: [PATCH 07/45] Readd Credis --- CHANGELOG.md | 5 +- composer.json | 7 +- composer.lock | 1570 ++++++++++++++++++++++++++++++++ lib/Resque/Redis.php | 37 +- test/Resque/Tests/TestCase.php | 6 +- 5 files changed, 1599 insertions(+), 26 deletions(-) create mode 100644 composer.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index 3079d35..d69f841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.4.2 (2018-05-30) +- Reimplemented credis due to issues with Redis: Connection Closed. + ## 1.4.1 (2018-05-29) - Updated travis builds to run on PHP 7.0, 7.1 and 7.2. - Added ability to specify multiple log levels. [DEBUG/INFO/NOTICE/WARNING/ERROR/CRITICAL/ALERT/EMERGENCY] @@ -7,7 +10,7 @@ ## 1.4 (2018-05-25) - Forked from chrisboulton/php-resque. -- Replaced credis (rather unmaintained) in favour of phpredis. +- Replaced credis in favour of phpredis. - Reformatted codebase to be PSR2 compliant. diff --git a/composer.json b/composer.json index d6f89be..045bb40 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "idanoo/php-resque", - "version": "1.4.1", + "version": "1.4.2", "type": "library", "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", "keywords": ["job", "background", "redis", "resque"], @@ -13,10 +13,11 @@ } ], "require": { - "php": ">=7.0.0", + "php": "^7.0", "ext-pcntl": "*", "ext-redis": "*", - "psr/log": "~1.0" + "psr/log": "~1.0", + "colinmollenhour/credis": "^1.10" }, "suggest": { "ext-proctitle": "Allows php-resque to rename the title of UNIX processes to show the status of a worker." diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..7998f24 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1570 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "03d0a28e51a17824e04b53fc8c00ba84", + "packages": [ + { + "name": "colinmollenhour/credis", + "version": "1.10.0", + "source": { + "type": "git", + "url": "https://github.com/colinmollenhour/credis.git", + "reference": "8ab6db707c821055f9856b8cf76d5f44beb6fd8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/8ab6db707c821055f9856b8cf76d5f44beb6fd8a", + "reference": "8ab6db707c821055f9856b8cf76d5f44beb6fd8a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "Client.php", + "Cluster.php", + "Sentinel.php", + "Module.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Colin Mollenhour", + "email": "colin@mollenhour.com" + } + ], + "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", + "homepage": "https://github.com/colinmollenhour/credis", + "time": "2018-05-07T14:45:04+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2017-07-22T11:58:36+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/478465659fd987669df0bd8a9bf22a8710e5f1b6", + "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2018-05-29T17:25:09+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.7.6", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-04-18T13:57:24+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "5.3.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^2.0.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-xdebug": "^2.5.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-04-06T15:36:58+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2017-11-27T13:52:08+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "791198a2c6254db10131eecfe8c06670700904db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-11-27T05:48:46+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "6.5.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b", + "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^5.0.5", + "sebastian/comparator": "^2.1", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2018-04-10T11:38:34+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "5.0.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", + "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.1" + }, + "conflict": { + "phpunit/phpunit": "<6.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2018-05-29T13:50:43+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/diff": "^2.0 || ^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-02-01T13:46:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-08-03T08:09:46+00:00" + }, + { + "name": "sebastian/environment", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2017-07-01T08:51:00+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2017-04-03T13:19:02+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-01-29T19:49:41+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.0", + "ext-pcntl": "*", + "ext-redis": "*" + }, + "platform-dev": [] +} diff --git a/lib/Resque/Redis.php b/lib/Resque/Redis.php index 56b55c9..169e010 100644 --- a/lib/Resque/Redis.php +++ b/lib/Resque/Redis.php @@ -10,6 +10,12 @@ class Resque_Redis { + /** + * Redis Client + * @var Credis_Client + */ + private $driver; + /** * Redis namespace * @var string @@ -110,41 +116,36 @@ class Resque_Redis * @param string|array $server A DSN or array * @param int $database A database number to select. However, if we find a valid database number in the DSN the * DSN-supplied value will be used instead and this parameter is ignored. - * @param object $client Optional Credis_Cluster or Credis_Client instance instantiated by you + * @param object $client Optional Credis_Client instance instantiated by you * @throws Resque_RedisException */ public function __construct($server, $database = null, $client = null) { try { if (is_object($client)) { - $this->redisConnection = $client; + $this->driver = $client; } else { /** @noinspection PhpUnusedLocalVariableInspection */ list($host, $port, $dsnDatabase, $user, $password, $options) = self::parseDsn($server); // $user is not used, only $password $timeout = isset($options['timeout']) ? intval($options['timeout']) : null; - - $this->redisConnection = new Redis(); - - if (!$this->redisConnection->connect($host, $port, $timeout)) { - throw new RedisException("Connection Failed to Redis!"); - }; - + $persistent = isset($options['persistent']) ? $options['persistent'] : ''; + $maxRetries = isset($options['max_connect_retries']) ? $options['max_connect_retries'] : 0; + $this->driver = new Credis_Client($host, $port, $timeout, $persistent); + $this->driver->setMaxConnectRetries($maxRetries); if ($password) { - $this->redisConnection->auth($password); + $this->driver->auth($password); } - // If we have found a database in our DSN, use it instead of the `$database` // value passed into the constructor. if ($dsnDatabase !== false) { $database = $dsnDatabase; } - - if ($database) { - $this->redisConnection->select($database); - } } - } catch (RedisException $e) { + if ($database !== null) { + $this->driver->select($database); + } + } catch (Exception $e) { throw new Resque_RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); } } @@ -245,8 +246,8 @@ class Resque_Redis } } try { - return call_user_func_array([$this->redisConnection, $name], $args); - } catch (Exception $e) { + return $this->driver->__call($name, $args); + } catch (CredisException $e) { throw new Resque_RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); } } diff --git a/test/Resque/Tests/TestCase.php b/test/Resque/Tests/TestCase.php index 478a27c..aa348d5 100644 --- a/test/Resque/Tests/TestCase.php +++ b/test/Resque/Tests/TestCase.php @@ -20,10 +20,8 @@ class Resque_Tests_TestCase extends PHPUnit\Framework\TestCase public function setUp() { - // Setup redis connection on DB 9 for testing. - $this->redis = new Redis(); - $this->redis->connect('localhost'); - + // Setup redis connection for testing. + $this->redis = new Credis_Client('localhost', '6379'); Resque::setBackend('localhost'); $this->redis->flushAll(); } From 44646e91bd672aed029b7773dd258df83b9d658c Mon Sep 17 00:00:00 2001 From: vagrant Date: Wed, 30 May 2018 07:09:14 +0000 Subject: [PATCH 08/45] Remove composer.lock --- composer.lock | 1570 ------------------------------------------------- 1 file changed, 1570 deletions(-) delete mode 100644 composer.lock diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 7998f24..0000000 --- a/composer.lock +++ /dev/null @@ -1,1570 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "03d0a28e51a17824e04b53fc8c00ba84", - "packages": [ - { - "name": "colinmollenhour/credis", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/colinmollenhour/credis.git", - "reference": "8ab6db707c821055f9856b8cf76d5f44beb6fd8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/8ab6db707c821055f9856b8cf76d5f44beb6fd8a", - "reference": "8ab6db707c821055f9856b8cf76d5f44beb6fd8a", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "Client.php", - "Cluster.php", - "Sentinel.php", - "Module.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Colin Mollenhour", - "email": "colin@mollenhour.com" - } - ], - "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", - "homepage": "https://github.com/colinmollenhour/credis", - "time": "2018-05-07T14:45:04+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2017-07-22T11:58:36+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.8.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/478465659fd987669df0bd8a9bf22a8710e5f1b6", - "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2018-05-29T17:25:09+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" - }, - { - "name": "phar-io/version", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2017-09-11T18:02:19+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2017-07-14T14:27:02+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.7.6", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2018-04-18T13:57:24+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "5.3.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.4.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-xdebug": "^2.5.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2018-04-06T15:36:58+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2017-11-27T13:52:08+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-11-27T05:48:46+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "6.5.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b", - "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.0", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.3", - "phpunit/php-file-iterator": "^1.4.3", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.5", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^2.0", - "sebastian/environment": "^3.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.5.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2018-04-10T11:38:34+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.7", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", - "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.0", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" - }, - "conflict": { - "phpunit/phpunit": "<6.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2018-05-29T13:50:43+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "2.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/diff": "^2.0 || ^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2018-02-01T13:46:46+00:00" - }, - { - "name": "sebastian/diff", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-08-03T08:09:46+00:00" - }, - { - "name": "sebastian/environment", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2017-07-01T08:51:00+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2017-04-03T13:19:02+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2018-01-29T19:49:41+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^7.0", - "ext-pcntl": "*", - "ext-redis": "*" - }, - "platform-dev": [] -} From c906d1ed08fdc96040d4aa2b393751f7dd40f8ad Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 30 May 2018 19:11:06 +1200 Subject: [PATCH 09/45] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac6077e..32e5db7 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ If you're not familiar with Composer, please see . ```json { "require": { - "idanoo/php-resque": "dev-master" + "idanoo/php-resque": "^1.4" } } ``` From f69330d6379cc616d17e10b228a521ec182332e8 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 22 Jun 2018 20:13:16 +1200 Subject: [PATCH 10/45] Update Docs --- CHANGELOG.md | 1 + README.md | 9 ++++----- bin/resque | 7 ++++--- lib/Resque.php | 2 +- lib/Resque/Failure/Redis.php | 1 + lib/Resque/Log.php | 4 ++++ 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d69f841..203d10a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 1.4.2 (2018-05-30) - Reimplemented credis due to issues with Redis: Connection Closed. +- Updated Docs. ## 1.4.1 (2018-05-29) - Updated travis builds to run on PHP 7.0, 7.1 and 7.2. diff --git a/README.md b/README.md index 32e5db7..7bc468f 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,8 @@ Jobs are queued as follows: // Required if redis is located elsewhere Resque::setBackend('localhost:6379'); -$args = array( - 'name' => 'TestName' - ); +$args = ['name' => 'TestName']; + Resque::enqueue('default', 'My_Job', $args); ``` @@ -141,7 +140,7 @@ Resque::dequeue('default', ['My_Job']); Resque::dequeue('default', ['My_Job' => '087df5819a790ac666c9608e2234b21e']); // Removes job class 'My_Job' with arguments of queue 'default' -Resque::dequeue('default', ['My_Job' => array('foo' => 1, 'bar' => 2)]); +Resque::dequeue('default', ['My_Job' => ['foo' => 1, 'bar' => 2]]); // Removes multiple jobs Resque::dequeue('default', ['My_Job', 'My_Job2']); @@ -345,7 +344,7 @@ Resque_Event::listen('eventName', [callback]); * A string with the name of a function * An array containing an object and method to call * An array containing an object and a static method to call -* A closure (PHP 5.3+) +* A closure Events may pass arguments (documented below), so your callback should accept these arguments. diff --git a/bin/resque b/bin/resque index 5867c60..23ff6d6 100755 --- a/bin/resque +++ b/bin/resque @@ -41,15 +41,16 @@ $REDIS_BACKEND = getenv('REDIS_BACKEND'); // A redis database number $REDIS_BACKEND_DB = getenv('REDIS_BACKEND_DB'); if (!empty($REDIS_BACKEND)) { - if (empty($REDIS_BACKEND_DB)) + if (empty($REDIS_BACKEND_DB)) { Resque::setBackend($REDIS_BACKEND); - else + } else { Resque::setBackend($REDIS_BACKEND, $REDIS_BACKEND_DB); + } } $logLevel = false; $LOGGING = getenv('LOGLEVEL'); -if (!empty($LOGGING) ) { +if (!empty($LOGGING)) { $logLevel = $LOGGING; } diff --git a/lib/Resque.php b/lib/Resque.php index cb30123..222336f 100644 --- a/lib/Resque.php +++ b/lib/Resque.php @@ -10,7 +10,7 @@ class Resque { - const VERSION = '1.4'; + const VERSION = '1.4.2'; const DEFAULT_INTERVAL = 5; diff --git a/lib/Resque/Failure/Redis.php b/lib/Resque/Failure/Redis.php index caff0d5..dacde7e 100644 --- a/lib/Resque/Failure/Redis.php +++ b/lib/Resque/Failure/Redis.php @@ -16,6 +16,7 @@ class Resque_Failure_Redis implements Resque_Failure_Interface * @param object $exception Instance of the exception that was thrown by the failed job. * @param object $worker Instance of Resque_Worker that received the job. * @param string $queue The name of the queue the job was fetched from. + * @throws Resque_RedisException */ public function __construct($payload, $exception, $worker, $queue) { diff --git a/lib/Resque/Log.php b/lib/Resque/Log.php index e0238e2..6735418 100644 --- a/lib/Resque/Log.php +++ b/lib/Resque/Log.php @@ -28,6 +28,10 @@ class Resque_Log extends Psr\Log\AbstractLogger public function log($level, $message, array $context = []) { $logLevels = ["emergency", "alert", "critical", "error", "warning", "notice", "info", "debug"]; + /** + * Only log things with a higher rating than the current log level. + * e.g If set as 'alert' will only alert for 'emergency' and 'alert' logs. + */ if (array_search($level, $logLevels) <= array_search($this->logLevel, $logLevels)) { fwrite( STDOUT, From 4e87677517192f9605fafe6a7dc689a11604d5ea Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Mon, 16 Jul 2018 09:59:58 +1200 Subject: [PATCH 11/45] - Updated README to include supervisor configuration. - Change logfile date format to `%Y-%m-%d %T`. - Added return types to more functions. --- CHANGELOG.md | 6 +++++- README.md | 24 ++++++++++++++++++++++++ composer.json | 11 ++++++----- lib/Resque.php | 4 ++-- lib/Resque/Job.php | 5 +++-- lib/Resque/Job/Status.php | 4 ++-- lib/Resque/Log.php | 16 +++++++++++++--- lib/Resque/Redis.php | 4 ++-- lib/Resque/Stat.php | 8 ++++---- lib/Resque/Worker.php | 12 ++++-------- 10 files changed, 65 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 203d10a..4e628f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.4.3 (2018-07-16) +- Updated README to include supervisor configuration. +- Change logfile date format to `%Y-%m-%d %T`. +- Added return types to more functions. + ## 1.4.2 (2018-05-30) - Reimplemented credis due to issues with Redis: Connection Closed. - Updated Docs. @@ -14,7 +19,6 @@ - Replaced credis in favour of phpredis. - Reformatted codebase to be PSR2 compliant. - ## 1.3 (2013) **Note:** This release introduces backwards incompatible changes with all previous versions of php-resque. Please see below for details. diff --git a/README.md b/README.md index 7bc468f..acac87b 100644 --- a/README.md +++ b/README.md @@ -432,6 +432,30 @@ Called after a job has been queued using the `Resque::enqueue` method. Arguments * Queue - string containing the name of the queue the job was added to * ID - string containing the new token of the enqueued job +## Supervisor Configuration ## + +You may like to run php-resque on a supervisor task to manage the processes. +The following is a default config that can be modified to suit. + +```sh +[program:resque-dev] +directory=/var/www # Project root +command=php vendor/bin/resque +numprocs=2 # Change this value for more threads +environment=LOGLEVEL=NOTICE,QUEUE='*',BLOCKING=1,COUNT=1,APP_INCLUDE='includes/autoload.php',REDIS_BACKEND=127.0.0.1,REDIS_BACKEND_DB=0 +redirect_stderr=true # Output stderr to logfile +stdout_logfile=/var/log/resque.log +autostart=true +autorestart=true +stopsignal=QUIT +process_name = %(program_name)s_%(process_num)02d +``` + +Issues: +- Restarting worker doesn't always make it use updated code, I find on a dev-environment issuing +the following command works well to restart everything. +`sudo /etc/init.d/supervisor force-stop && sleep 1 && sudo /etc/init.d/supervisor restart` + ## Step-By-Step ## For a more in-depth look at what php-resque does under the hood (without diff --git a/composer.json b/composer.json index 045bb40..e53bff1 100644 --- a/composer.json +++ b/composer.json @@ -1,10 +1,10 @@ { "name": "idanoo/php-resque", - "version": "1.4.2", + "version": "1.4.3", "type": "library", "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", "keywords": ["job", "background", "redis", "resque"], - "homepage": "http://www.github.com/iDanoo/php-resque/", + "homepage": "http://www.github.com/idanoo/php-resque/", "license": "MIT", "authors": [ { @@ -19,9 +19,6 @@ "psr/log": "~1.0", "colinmollenhour/credis": "^1.10" }, - "suggest": { - "ext-proctitle": "Allows php-resque to rename the title of UNIX processes to show the status of a worker." - }, "require-dev": { "phpunit/phpunit": "^6" }, @@ -32,5 +29,9 @@ "psr-0": { "Resque": "lib" } + }, + "support": { + "issues": "https://github.com/idanoo/php-resque/issues", + "source": "https://github.com/idanoo/php-resque" } } diff --git a/lib/Resque.php b/lib/Resque.php index 222336f..a7bff07 100644 --- a/lib/Resque.php +++ b/lib/Resque.php @@ -1,4 +1,4 @@ -payload['id'])) { - return; + return false; } $statusInstance = new Resque_Job_Status($this->payload['id']); $statusInstance->update($status); + return true; } /** diff --git a/lib/Resque/Job/Status.php b/lib/Resque/Job/Status.php index 730677b..257e6df 100644 --- a/lib/Resque/Job/Status.php +++ b/lib/Resque/Job/Status.php @@ -66,7 +66,7 @@ class Resque_Job_Status * * @return boolean True if the status is being monitored, false if not. */ - public function isTracking() + public function isTracking(): bool { if ($this->isTracking === false) { return false; @@ -137,7 +137,7 @@ class Resque_Job_Status * * @return string String representation of the current job status class. */ - public function __toString() + public function __toString(): string { return 'job:' . $this->id . ':status'; } diff --git a/lib/Resque/Log.php b/lib/Resque/Log.php index 6735418..4182b23 100644 --- a/lib/Resque/Log.php +++ b/lib/Resque/Log.php @@ -27,15 +27,25 @@ class Resque_Log extends Psr\Log\AbstractLogger */ public function log($level, $message, array $context = []) { - $logLevels = ["emergency", "alert", "critical", "error", "warning", "notice", "info", "debug"]; + $logLevels = [ + "emergency", + "alert", + "critical", + "error", + "warning", + "notice", + "info", + "debug" + ]; + /** - * Only log things with a higher rating than the current log level. + * Only log things with a higher level than the current log level. * e.g If set as 'alert' will only alert for 'emergency' and 'alert' logs. */ if (array_search($level, $logLevels) <= array_search($this->logLevel, $logLevels)) { fwrite( STDOUT, - '[' . $level . '][' . strftime('%T %Y-%m-%d') . '] ' . $this->interpolate($message, $context) . PHP_EOL + '[' . $level . '][' . strftime('%Y-%m-%d %T') . '] ' . $this->interpolate($message, $context) . PHP_EOL ); } return; diff --git a/lib/Resque/Redis.php b/lib/Resque/Redis.php index 169e010..ee21223 100644 --- a/lib/Resque/Redis.php +++ b/lib/Resque/Redis.php @@ -252,12 +252,12 @@ class Resque_Redis } } - public static function getPrefix() + public static function getPrefix(): string { return self::$defaultNamespace; } - public static function removePrefix($string) + public static function removePrefix($string): string { $prefix = self::getPrefix(); diff --git a/lib/Resque/Stat.php b/lib/Resque/Stat.php index 9855638..0cca826 100644 --- a/lib/Resque/Stat.php +++ b/lib/Resque/Stat.php @@ -16,7 +16,7 @@ class Resque_Stat * @param string $stat The name of the statistic to get the stats for. * @return mixed Value of the statistic. */ - public static function get($stat) + public static function get($stat): int { return (int)Resque::redis()->get('stat:' . $stat); } @@ -28,7 +28,7 @@ class Resque_Stat * @param int $by The amount to increment the statistic by. * @return boolean True if successful, false if not. */ - public static function incr($stat, $by = 1) + public static function incr($stat, $by = 1): bool { return (bool)Resque::redis()->incrby('stat:' . $stat, $by); } @@ -40,7 +40,7 @@ class Resque_Stat * @param int $by The amount to decrement the statistic by. * @return boolean True if successful, false if not. */ - public static function decr($stat, $by = 1) + public static function decr($stat, $by = 1): bool { return (bool)Resque::redis()->decrby('stat:' . $stat, $by); } @@ -51,7 +51,7 @@ class Resque_Stat * @param string $stat The name of the statistic to delete. * @return boolean True if successful, false if not. */ - public static function clear($stat) + public static function clear($stat): bool { return (bool)Resque::redis()->del('stat:' . $stat); } diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index d7a7aa9..d4e385b 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -82,7 +82,7 @@ class Resque_Worker * Return all workers known to Resque as instantiated instances. * @return array */ - public static function all() + public static function all(): array { $workers = Resque::redis()->smembers('workers'); if (!is_array($workers)) { @@ -103,7 +103,7 @@ class Resque_Worker * @return boolean True if the worker exists, false if not. * @throws Resque_RedisException */ - public static function exists($workerId) + public static function exists($workerId): bool { return (bool)Resque::redis()->sismember('workers', $workerId); } @@ -532,14 +532,10 @@ class Resque_Worker * * @return array Array with details of current job. */ - public function job() + public function job(): array { $job = Resque::redis()->get('worker:' . $this); - if (!$job) { - return []; - } else { - return json_decode($job, true); - } + return $job ? json_decode($job, true) : []; } /** From 9a97a29aa30f7f3b14ab5b85580c725eeee83ee7 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sat, 13 Oct 2018 12:45:53 +1300 Subject: [PATCH 12/45] Re-added disabled test --- .gitignore | 2 +- composer.lock | 1570 ++++++++++++++++++++++++++++++ test/Resque/Tests/WorkerTest.php | 3 - 3 files changed, 1571 insertions(+), 4 deletions(-) create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index a793d95..924bb34 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ vendor/ -*.swp phpunit.xml +*.swp \ No newline at end of file diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..e89c818 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1570 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "f7e4ae15d649e761fe2c5c3f6a466221", + "packages": [ + { + "name": "colinmollenhour/credis", + "version": "1.10.0", + "source": { + "type": "git", + "url": "https://github.com/colinmollenhour/credis.git", + "reference": "8ab6db707c821055f9856b8cf76d5f44beb6fd8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/8ab6db707c821055f9856b8cf76d5f44beb6fd8a", + "reference": "8ab6db707c821055f9856b8cf76d5f44beb6fd8a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "Client.php", + "Cluster.php", + "Sentinel.php", + "Module.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Colin Mollenhour", + "email": "colin@mollenhour.com" + } + ], + "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", + "homepage": "https://github.com/colinmollenhour/credis", + "time": "2018-05-07T14:45:04+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2017-07-22T11:58:36+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2018-06-11T23:09:50+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-08-05T17:53:17+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "5.3.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^2.0.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-xdebug": "^2.5.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-04-06T15:36:58+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2017-11-27T13:52:08+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "791198a2c6254db10131eecfe8c06670700904db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-11-27T05:48:46+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "6.5.13", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "0973426fb012359b2f18d3bd1e90ef1172839693" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0973426fb012359b2f18d3bd1e90ef1172839693", + "reference": "0973426fb012359b2f18d3bd1e90ef1172839693", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^5.0.9", + "sebastian/comparator": "^2.1", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2018-09-08T15:10:43+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "5.0.10", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.1" + }, + "conflict": { + "phpunit/phpunit": "<6.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5.11" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2018-08-09T05:50:03+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/diff": "^2.0 || ^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-02-01T13:46:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-08-03T08:09:46+00:00" + }, + { + "name": "sebastian/environment", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2017-07-01T08:51:00+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2017-04-03T13:19:02+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-01-29T19:49:41+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.0", + "ext-pcntl": "*", + "ext-redis": "*" + }, + "platform-dev": [] +} diff --git a/test/Resque/Tests/WorkerTest.php b/test/Resque/Tests/WorkerTest.php index 6dbd38b..44f9c4c 100644 --- a/test/Resque/Tests/WorkerTest.php +++ b/test/Resque/Tests/WorkerTest.php @@ -271,9 +271,6 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase public function testBlockingListPop() { - $this->markTestSkipped("Skip temporarily"); - return; - $worker = new Resque_Worker('jobs'); $worker->setLogger(new Resque_Log()); $worker->registerWorker(); From 6232aff129dcb2bd1821c567584161e6187bf265 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sat, 13 Oct 2018 12:53:14 +1300 Subject: [PATCH 13/45] Add gitlab CI file --- .gitlab-ci.yml | 21 +++++++++++++++++++++ test/docker_install.sh | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 test/docker_install.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..c97831d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,21 @@ +before_script: +- bash test/docker_install.sh > /dev/null +- cp test/misc/redis.conf /usr/local/etc/redis/redis.conf + +# Test PHP 7.0 +test:7.0: + image: php:7.0 + script: + - phpunit --configuration phpunit.xml.dist + +# Test PHP 7.2 +test:7.1: + image: php:7.1 + script: + - phpunit --configuration phpunit.xml.dist + +# Test PHP 7.2 +test:7.2: + image: php:7.2 + script: + - phpunit --configuration phpunit.xml.dist diff --git a/test/docker_install.sh b/test/docker_install.sh new file mode 100644 index 0000000..a4a3a0b --- /dev/null +++ b/test/docker_install.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# We need to install dependencies only for Docker +[[ ! -e /.dockerenv ]] && exit 0 + +set -xe + +# Install git (the php image doesn't have it) which is required by composer +apt-get update -yqq +apt-get install git -yqq + +# Install phpunit, the tool that we will use for testing +curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar +chmod +x /usr/local/bin/phpunit + +# Install mysql driver +# Here you can install any other extension that you need +docker-php-ext-install redis \ No newline at end of file From 939f4e58a60dd2b4ef9f6dabc6b5cd4c4a6494af Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sat, 13 Oct 2018 12:55:06 +1300 Subject: [PATCH 14/45] Add redis to docker_install.sh --- test/docker_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/docker_install.sh b/test/docker_install.sh index a4a3a0b..28b213f 100644 --- a/test/docker_install.sh +++ b/test/docker_install.sh @@ -7,7 +7,7 @@ set -xe # Install git (the php image doesn't have it) which is required by composer apt-get update -yqq -apt-get install git -yqq +apt-get install git redis php-redis -yqq # Install phpunit, the tool that we will use for testing curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar From 4a396bdb78deaf4fa963d8b3338347a0ce723b79 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 31 May 2019 11:47:42 +1200 Subject: [PATCH 15/45] Tidying up GitLab CI file --- .gitlab-ci.yml | 36 ++++++++++++++++++++++++++++++------ test/docker_install.sh | 18 ------------------ test/misc/redis.conf | 8 -------- 3 files changed, 30 insertions(+), 32 deletions(-) delete mode 100644 test/docker_install.sh delete mode 100644 test/misc/redis.conf diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c97831d..8b90d0b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,21 +1,45 @@ -before_script: -- bash test/docker_install.sh > /dev/null -- cp test/misc/redis.conf /usr/local/etc/redis/redis.conf +.docker_boostrap: &docker_boostrap | + [[ ! -e /.dockerenv ]] && exit 0 + set -xe + + # Install git (the php image doesn't have it) which is required by composer + apt-get update -yq + apt-get install git redis-server php-redis -y + + # Install phpunit, the tool that we will use for testing + curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar + chmod +x /usr/local/bin/phpunit + + # Install mysql driver + # Here you can install any other extension that you need + docker-php-ext-install redis # Test PHP 7.0 test:7.0: image: php:7.0 + before_script: + - *docker_boostrap script: - - phpunit --configuration phpunit.xml.dist + - phpunit --configuration phpunit.xml.dist + tag: + - docker # Test PHP 7.2 test:7.1: image: php:7.1 + before_script: + - *docker_boostrap script: - - phpunit --configuration phpunit.xml.dist + - phpunit --configuration phpunit.xml.dist + tag: + - docker # Test PHP 7.2 test:7.2: image: php:7.2 + before_script: + - *docker_boostrap script: - - phpunit --configuration phpunit.xml.dist + - phpunit --configuration phpunit.xml.dist + tag: + - docker diff --git a/test/docker_install.sh b/test/docker_install.sh deleted file mode 100644 index 28b213f..0000000 --- a/test/docker_install.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# We need to install dependencies only for Docker -[[ ! -e /.dockerenv ]] && exit 0 - -set -xe - -# Install git (the php image doesn't have it) which is required by composer -apt-get update -yqq -apt-get install git redis php-redis -yqq - -# Install phpunit, the tool that we will use for testing -curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar -chmod +x /usr/local/bin/phpunit - -# Install mysql driver -# Here you can install any other extension that you need -docker-php-ext-install redis \ No newline at end of file diff --git a/test/misc/redis.conf b/test/misc/redis.conf deleted file mode 100644 index 971f66e..0000000 --- a/test/misc/redis.conf +++ /dev/null @@ -1,8 +0,0 @@ -daemonize yes -pidfile ./redis.pid -port 6379 -bind 127.0.0.1 -timeout 300 -dbfilename dump.rdb -dir ./ -loglevel debug \ No newline at end of file From d76fd1a7e010ec09a60873a890f15e491224a10d Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 31 May 2019 11:49:08 +1200 Subject: [PATCH 16/45] Tag != Tags --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b90d0b..ee7b5e1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ test:7.0: - *docker_boostrap script: - phpunit --configuration phpunit.xml.dist - tag: + tags: - docker # Test PHP 7.2 @@ -31,7 +31,7 @@ test:7.1: - *docker_boostrap script: - phpunit --configuration phpunit.xml.dist - tag: + tags: - docker # Test PHP 7.2 @@ -41,5 +41,5 @@ test:7.2: - *docker_boostrap script: - phpunit --configuration phpunit.xml.dist - tag: + tags: - docker From 6bedeaab5f7763bc6a89a243645f165fb57b0f63 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 31 May 2019 11:50:32 +1200 Subject: [PATCH 17/45] php-redis != phpredis --- .gitlab-ci.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee7b5e1..2f4b724 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,19 +1,3 @@ -.docker_boostrap: &docker_boostrap | - [[ ! -e /.dockerenv ]] && exit 0 - set -xe - - # Install git (the php image doesn't have it) which is required by composer - apt-get update -yq - apt-get install git redis-server php-redis -y - - # Install phpunit, the tool that we will use for testing - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar - chmod +x /usr/local/bin/phpunit - - # Install mysql driver - # Here you can install any other extension that you need - docker-php-ext-install redis - # Test PHP 7.0 test:7.0: image: php:7.0 @@ -43,3 +27,19 @@ test:7.2: - phpunit --configuration phpunit.xml.dist tags: - docker + +.docker_boostrap: &docker_boostrap | + [[ ! -e /.dockerenv ]] && exit 0 + set -xe + + # Install git (the php image doesn't have it) which is required by composer + apt-get update -yq + apt-get install git redis-server phpredis -y + + # Install phpunit, the tool that we will use for testing + curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar + chmod +x /usr/local/bin/phpunit + + # Install mysql driver + # Here you can install any other extension that you need + docker-php-ext-install redis From 70090b4d66bbeb7488bcfebc3223481f3896be6e Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 31 May 2019 11:51:06 +1200 Subject: [PATCH 18/45] .gitlab-ci.yml ordering --- .gitlab-ci.yml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f4b724..170c0c2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,20 @@ +.docker_boostrap: &docker_boostrap | + [[ ! -e /.dockerenv ]] && exit 0 + set -xe + + # Install git (the php image doesn't have it) which is required by composer + apt-get update -yq + apt-get install git redis-server phpredis -y + + # Install phpunit, the tool that we will use for testing + curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar + chmod +x /usr/local/bin/phpunit + + # Install mysql driver + # Here you can install any other extension that you need + docker-php-ext-install redis + + # Test PHP 7.0 test:7.0: image: php:7.0 @@ -26,20 +43,4 @@ test:7.2: script: - phpunit --configuration phpunit.xml.dist tags: - - docker - -.docker_boostrap: &docker_boostrap | - [[ ! -e /.dockerenv ]] && exit 0 - set -xe - - # Install git (the php image doesn't have it) which is required by composer - apt-get update -yq - apt-get install git redis-server phpredis -y - - # Install phpunit, the tool that we will use for testing - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar - chmod +x /usr/local/bin/phpunit - - # Install mysql driver - # Here you can install any other extension that you need - docker-php-ext-install redis + - docker \ No newline at end of file From d702f498bff84edf2e859577ca544eae0af0b9f5 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 31 May 2019 11:52:23 +1200 Subject: [PATCH 19/45] Remove phpredis --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 170c0c2..49244bb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ # Install git (the php image doesn't have it) which is required by composer apt-get update -yq - apt-get install git redis-server phpredis -y + apt-get install git redis-server -y # Install phpunit, the tool that we will use for testing curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar From 3b4d2e4c1f9dec474fa2ac4a8d74749d8ae06701 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 2 Jun 2019 22:21:42 +1200 Subject: [PATCH 20/45] Fix bootstrap.php for tests --- .gitlab-ci.yml | 38 +++++++++++++---- CHANGELOG.md | 4 ++ README.md | 8 +++- composer.json | 2 +- test/Resque/Tests/TestCase.php | 6 ++- test/bootstrap.php | 77 ++++++---------------------------- 6 files changed, 58 insertions(+), 77 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 49244bb..628e8ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,16 +4,18 @@ # Install git (the php image doesn't have it) which is required by composer apt-get update -yq - apt-get install git redis-server -y + apt-get install git wget -y - # Install phpunit, the tool that we will use for testing - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar - chmod +x /usr/local/bin/phpunit + pecl install -o -f redis \ + && rm -rf /tmp/pear \ + && docker-php-ext-enable redis + docker-php-ext-install pcntl - # Install mysql driver - # Here you can install any other extension that you need - docker-php-ext-install redis + wget https://getcomposer.org/composer.phar + php composer.phar install +services: + - redis:latest # Test PHP 7.0 test:7.0: @@ -21,16 +23,20 @@ test:7.0: before_script: - *docker_boostrap script: + - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-6.5.9.phar + - chmod +x /usr/local/bin/phpunit - phpunit --configuration phpunit.xml.dist tags: - docker -# Test PHP 7.2 +# Test PHP 7.1 test:7.1: image: php:7.1 before_script: - *docker_boostrap script: + - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.5.9.phar + - chmod +x /usr/local/bin/phpunit - phpunit --configuration phpunit.xml.dist tags: - docker @@ -41,6 +47,20 @@ test:7.2: before_script: - *docker_boostrap script: + - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar + - chmod +x /usr/local/bin/phpunit - phpunit --configuration phpunit.xml.dist tags: - - docker \ No newline at end of file + - docker + +# Test PHP 7.3 +test:7.3: + image: php:7.3 + before_script: + - *docker_boostrap + script: + - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar + - chmod +x /usr/local/bin/phpunit + - phpunit --configuration phpunit.xml.dist + tags: + - docker diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e628f4..90225ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.4.4 (2019-06-02) +- Updated tests to run on GitLab CI. +- Can now run tests locally using `gitlab-runner exec docker test:7.0` + ## 1.4.3 (2018-07-16) - Updated README to include supervisor configuration. - Change logfile date format to `%Y-%m-%d %T`. diff --git a/README.md b/README.md index acac87b..79bc9a3 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,15 @@ not exit with a status code as 0 * Has built in support for `setUp` and `tearDown` methods, called pre and post jobs +On top of the original fork (chrisboulton/php-resque) I have added: + +* Custom log levels +* PHP7.0+ compatibility + + ## Requirements ## -* PHP 7.0+ (May work with 5.6+, Untested) +* PHP 7.0+ * phpredis * Redis 2.2+ diff --git a/composer.json b/composer.json index e53bff1..85352af 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "idanoo/php-resque", - "version": "1.4.3", + "version": "1.4.4", "type": "library", "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", "keywords": ["job", "background", "redis", "resque"], diff --git a/test/Resque/Tests/TestCase.php b/test/Resque/Tests/TestCase.php index aa348d5..a428d12 100644 --- a/test/Resque/Tests/TestCase.php +++ b/test/Resque/Tests/TestCase.php @@ -21,8 +21,10 @@ class Resque_Tests_TestCase extends PHPUnit\Framework\TestCase public function setUp() { // Setup redis connection for testing. - $this->redis = new Credis_Client('localhost', '6379'); - Resque::setBackend('localhost'); + global $redisTestServer; + + $this->redis = new Credis_Client($redisTestServer, '6379'); + Resque::setBackend($redisTestServer); $this->redis->flushAll(); } } diff --git a/test/bootstrap.php b/test/bootstrap.php index a92611c..81b8e69 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -3,82 +3,30 @@ * Resque test bootstrap file - sets up a test environment. * * @package Resque/Tests - * @author Chris Boulton + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ $loader = require __DIR__ . '/../vendor/autoload.php'; $loader->add('Resque_Tests', __DIR__); -define('TEST_MISC', realpath(__DIR__ . '/misc/')); -define('REDIS_CONF', TEST_MISC . '/redis.conf'); +# Redis configuration +global $redisTestServer; +$redisTestServer = getenv("REDIS_SERVER") ?? "redis"; +Resque::setBackend($redisTestServer); -// Attempt to start our own redis instance for tesitng. -exec('which redis-server', $output, $returnVar); -if ($returnVar != 0) { - echo "Cannot find redis-server in path. Please make sure redis is installed.\n"; - exit(1); +# Check Redis is accessable locally +try { + $redisTest = new Resque_Redis($redisTestServer); +} catch (Exception $e) { + throw new Exception("Unable to connect to redis. Please check there is a redis-server running."); } +$redisTest = null; -exec('cd ' . TEST_MISC . '; redis-server ' . REDIS_CONF, $output, $returnVar); -usleep(500000); -if ($returnVar != 0) { - echo "Cannot start redis-server.\n"; - exit(1); -} - -// Get redis port from conf -$config = file_get_contents(REDIS_CONF); -if (!preg_match('#^\s*port\s+([0-9]+)#m', $config, $matches)) { - echo "Could not determine redis port from redis.conf"; - exit(1); -} - -Resque::setBackend('localhost:' . $matches[1]); - -// Shutdown -function killRedis($pid) -{ - if (getmypid() !== $pid) { - return; // don't kill from a forked worker - } - $config = file_get_contents(REDIS_CONF); - if (!preg_match('#^\s*pidfile\s+([^\s]+)#m', $config, $matches)) { - return; - } - - $pidFile = TEST_MISC . '/' . $matches[1]; - if (file_exists($pidFile)) { - $pid = trim(file_get_contents($pidFile)); - posix_kill((int)$pid, 9); - - if (is_file($pidFile)) { - unlink($pidFile); - } - } - - // Remove the redis database - if (!preg_match('#^\s*dir\s+([^\s]+)#m', $config, $matches)) { - return; - } - $dir = $matches[1]; - - if (!preg_match('#^\s*dbfilename\s+([^\s]+)#m', $config, $matches)) { - return; - } - - $filename = TEST_MISC . '/' . $dir . '/' . $matches[1]; - if (is_file($filename)) { - unlink($filename); - } -} - -register_shutdown_function('killRedis', getmypid()); +# Cleanup forked workers cleanly if (function_exists('pcntl_signal')) { - // Override INT and TERM signals, so they do a clean shutdown and also - // clean up redis-server as well. function sigint() { exit; @@ -88,6 +36,7 @@ if (function_exists('pcntl_signal')) { pcntl_signal(SIGTERM, 'sigint'); } +# Bootstrap it class Test_Job { public static $called = false; From 5a94c021da7865c9e5a1fe1fa765e7e8ee480766 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 2 Jun 2019 23:01:52 +1200 Subject: [PATCH 21/45] Fix paths --- .gitlab-ci.yml | 17 +++++++++++------ test/bootstrap.php | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 628e8ee..c7bb222 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,13 +4,18 @@ # Install git (the php image doesn't have it) which is required by composer apt-get update -yq - apt-get install git wget -y + apt-get install git wget procps -y + # Install pcntl and redis extentions pecl install -o -f redis \ && rm -rf /tmp/pear \ && docker-php-ext-enable redis docker-php-ext-install pcntl + # Hack to fix mismatched php versions + rm composer.lock + + # Install Composer wget https://getcomposer.org/composer.phar php composer.phar install @@ -25,7 +30,7 @@ test:7.0: script: - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-6.5.9.phar - chmod +x /usr/local/bin/phpunit - - phpunit --configuration phpunit.xml.dist + - phpunit --verbose --configuration phpunit.xml.dist tags: - docker @@ -37,7 +42,7 @@ test:7.1: script: - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.5.9.phar - chmod +x /usr/local/bin/phpunit - - phpunit --configuration phpunit.xml.dist + - phpunit --verbose --configuration phpunit.xml.dist tags: - docker @@ -47,9 +52,9 @@ test:7.2: before_script: - *docker_boostrap script: - - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar + - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.5.9.phar - chmod +x /usr/local/bin/phpunit - - phpunit --configuration phpunit.xml.dist + - phpunit --verbose --configuration phpunit.xml.dist tags: - docker @@ -61,6 +66,6 @@ test:7.3: script: - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar - chmod +x /usr/local/bin/phpunit - - phpunit --configuration phpunit.xml.dist + - phpunit --verbose --configuration phpunit.xml.dist tags: - docker diff --git a/test/bootstrap.php b/test/bootstrap.php index 81b8e69..7488ff8 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -12,7 +12,7 @@ $loader->add('Resque_Tests', __DIR__); # Redis configuration global $redisTestServer; -$redisTestServer = getenv("REDIS_SERVER") ?? "redis"; +$redisTestServer = getenv("REDIS_SERVER") ?: "redis"; Resque::setBackend($redisTestServer); # Check Redis is accessable locally From 19f21219f8c1ba7df9956e77574fe5c969f05af8 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 28 Aug 2019 09:46:50 +1200 Subject: [PATCH 22/45] 1.4.5 patch - formatting + composer replace --- CHANGELOG.md | 4 ++++ README.md | 2 +- composer.json | 6 +++++- lib/Resque.php | 2 +- lib/Resque/Failure.php | 4 ++-- lib/Resque/Job.php | 2 +- lib/Resque/Job/Factory.php | 2 +- lib/Resque/Log.php | 4 ++-- lib/Resque/Redis.php | 2 +- lib/Resque/Worker.php | 10 +++++----- test/Resque/Tests/JobStatusTest.php | 2 +- 11 files changed, 24 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90225ac..143bbc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.4.5 (2019-08-28) +- Added 'replaced' composer tag. +- Formatting changes. + ## 1.4.4 (2019-06-02) - Updated tests to run on GitLab CI. - Can now run tests locally using `gitlab-runner exec docker test:7.0` diff --git a/README.md b/README.md index 79bc9a3..6b9ce07 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -php-resque: PHP Resque Worker (and Enqueue) [![Build Status](https://travis-ci.org/iDanoo/php-resque.svg?branch=master)](https://travis-ci.org/iDanoo/php-resque) +php-resque: PHP Resque Worker (and Enqueue) =========================================== Resque is a Redis-backed library for creating background jobs, placing diff --git a/composer.json b/composer.json index 85352af..f4518c2 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,11 @@ { "name": "idanoo/php-resque", - "version": "1.4.4", + "version": "1.4.5", "type": "library", + "replace": { + "chrisboulton/php-resque": "*", + "danhunsaker/php-resque": "*" + }, "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", "keywords": ["job", "background", "redis", "resque"], "homepage": "http://www.github.com/idanoo/php-resque/", diff --git a/lib/Resque.php b/lib/Resque.php index a7bff07..07c7806 100644 --- a/lib/Resque.php +++ b/lib/Resque.php @@ -10,7 +10,7 @@ class Resque { - const VERSION = '1.4.3'; + const VERSION = '1.4.5'; const DEFAULT_INTERVAL = 5; diff --git a/lib/Resque/Failure.php b/lib/Resque/Failure.php index d73fb6d..24a3908 100644 --- a/lib/Resque/Failure.php +++ b/lib/Resque/Failure.php @@ -19,8 +19,8 @@ class Resque_Failure * Create a new failed job on the backend. * * @param array $payload The contents of the job that has just failed. - * @param \Exception $exception The exception generated when the job failed to run. - * @param \Resque_Worker $worker Instance of Resque_Worker that was running this job when it failed. + * @param Exception $exception The exception generated when the job failed to run. + * @param Resque_Worker $worker Instance of Resque_Worker that was running this job when it failed. * @param string $queue The name of the queue that this job was fetched from. */ public static function create($payload, Exception $exception, Resque_Worker $worker, $queue) diff --git a/lib/Resque/Job.php b/lib/Resque/Job.php index d96fadc..5ffe995 100755 --- a/lib/Resque/Job.php +++ b/lib/Resque/Job.php @@ -57,7 +57,7 @@ class Resque_Job * @param string $id Unique identifier for tracking the job. Generated if not supplied. * * @return string - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public static function create($queue, $class, $args = null, $monitor = false, $id = null) { diff --git a/lib/Resque/Job/Factory.php b/lib/Resque/Job/Factory.php index cf17294..9e89169 100644 --- a/lib/Resque/Job/Factory.php +++ b/lib/Resque/Job/Factory.php @@ -8,7 +8,7 @@ class Resque_Job_Factory implements Resque_Job_FactoryInterface * @param array $args * @param $queue * @return Resque_JobInterface - * @throws \Resque_Exception + * @throws Resque_Exception */ public function create($className, $args, $queue) { diff --git a/lib/Resque/Log.php b/lib/Resque/Log.php index 4182b23..741ab8e 100644 --- a/lib/Resque/Log.php +++ b/lib/Resque/Log.php @@ -45,11 +45,11 @@ class Resque_Log extends Psr\Log\AbstractLogger if (array_search($level, $logLevels) <= array_search($this->logLevel, $logLevels)) { fwrite( STDOUT, - '[' . $level . '][' . strftime('%Y-%m-%d %T') . '] ' . $this->interpolate($message, $context) . PHP_EOL + '[' . $level . '][' . strftime('%Y-%m-%d %T') . '] ' . + $this->interpolate($message, $context) . PHP_EOL ); } return; - } /** diff --git a/lib/Resque/Redis.php b/lib/Resque/Redis.php index ee21223..dc4515a 100644 --- a/lib/Resque/Redis.php +++ b/lib/Resque/Redis.php @@ -185,7 +185,7 @@ class Resque_Redis // Check the URI scheme $validSchemes = ['redis', 'tcp']; if (isset($parts['scheme']) && !in_array($parts['scheme'], $validSchemes)) { - throw new \InvalidArgumentException("Invalid DSN. Supported schemes are " . implode(', ', $validSchemes)); + throw new InvalidArgumentException("Invalid DSN. Supported schemes are " . implode(', ', $validSchemes)); } // Allow simple 'hostname' format, which `parse_url` treats as a path, not host. diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index d4e385b..add97ec 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -254,8 +254,8 @@ class Resque_Worker } /** - * @param bool $blocking - * @param int $timeout + * @param bool $blocking + * @param int $timeout * @return object|boolean Instance of Resque_Job if a job is found, false if not. */ public function reserve($blocking = false, $timeout = null) @@ -290,11 +290,11 @@ class Resque_Worker * when searching for jobs. * * If * is found in the list of queues, every queue will be searched in - * alphabetic order. (@see $fetch) - * - * @param boolean $fetch If true, and the queue is set to *, will fetch + * alphabetic order. (@param boolean $fetch If true, and the queue is set to *, will fetch * all queue names from redis. * @return array Array of associated queues. + * @see $fetch) + * */ public function queues($fetch = true) { diff --git a/test/Resque/Tests/JobStatusTest.php b/test/Resque/Tests/JobStatusTest.php index b2120ba..d573456 100644 --- a/test/Resque/Tests/JobStatusTest.php +++ b/test/Resque/Tests/JobStatusTest.php @@ -11,7 +11,7 @@ class Resque_Tests_JobStatusTest extends Resque_Tests_TestCase { /** - * @var \Resque_Worker + * @var Resque_Worker */ protected $worker; From 493c12846af740364891574ff80a90c81510e072 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 10 Jan 2020 11:35:56 +1300 Subject: [PATCH 23/45] Switched IF Statement order to prevent excess calls to redis. --- CHANGELOG.md | 3 +++ composer.json | 2 +- lib/Resque.php | 2 +- lib/Resque/Worker.php | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 143bbc6..3d58049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.4.6 (2020-01-10) +- Switched IF Statement order to prevent excess calls to redis. + ## 1.4.5 (2019-08-28) - Added 'replaced' composer tag. - Formatting changes. diff --git a/composer.json b/composer.json index f4518c2..d4327b8 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "idanoo/php-resque", - "version": "1.4.5", + "version": "1.4.6", "type": "library", "replace": { "chrisboulton/php-resque": "*", diff --git a/lib/Resque.php b/lib/Resque.php index 07c7806..68b0067 100644 --- a/lib/Resque.php +++ b/lib/Resque.php @@ -10,7 +10,7 @@ class Resque { - const VERSION = '1.4.5'; + const VERSION = '1.4.6'; const DEFAULT_INTERVAL = 5; diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index add97ec..e81015c 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -117,7 +117,7 @@ class Resque_Worker */ public static function find($workerId) { - if (!self::exists($workerId) || false === strpos($workerId, ":")) { + if (false === strpos($workerId, ":") || !self::exists($workerId)) { return false; } /** @noinspection PhpUnusedLocalVariableInspection */ From b99217f2c0a9fda5ed13c5b17f3165d0e674ce83 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sat, 11 Apr 2020 09:24:18 +1200 Subject: [PATCH 24/45] Update for PHP7.4 compatibility + UnitTests --- .gitlab-ci.yml | 52 ++++------------------------- CHANGELOG.md | 4 +++ composer.json | 6 ++-- lib/Resque.php | 40 ++++++++++++---------- test/Resque/Tests/EventTest.php | 4 +-- test/Resque/Tests/JobStatusTest.php | 2 +- test/Resque/Tests/JobTest.php | 10 ++++-- test/Resque/Tests/RedisTest.php | 4 ++- test/Resque/Tests/TestCase.php | 4 +-- 9 files changed, 51 insertions(+), 75 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c7bb222..ed4b864 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ # Install git (the php image doesn't have it) which is required by composer apt-get update -yq - apt-get install git wget procps -y + apt-get install git wget procps unzip -y # Install pcntl and redis extentions pecl install -o -f redis \ @@ -17,55 +17,17 @@ # Install Composer wget https://getcomposer.org/composer.phar - php composer.phar install + php composer.phar install --dev services: - redis:latest -# Test PHP 7.0 -test:7.0: - image: php:7.0 +# Test PHP 7.4 +test:7.4: + image: php:7.4 before_script: - *docker_boostrap script: - - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-6.5.9.phar - - chmod +x /usr/local/bin/phpunit - - phpunit --verbose --configuration phpunit.xml.dist + - php vendor/bin/phpunit --verbose --configuration phpunit.xml.dist tags: - - docker - -# Test PHP 7.1 -test:7.1: - image: php:7.1 - before_script: - - *docker_boostrap - script: - - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.5.9.phar - - chmod +x /usr/local/bin/phpunit - - phpunit --verbose --configuration phpunit.xml.dist - tags: - - docker - -# Test PHP 7.2 -test:7.2: - image: php:7.2 - before_script: - - *docker_boostrap - script: - - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-7.5.9.phar - - chmod +x /usr/local/bin/phpunit - - phpunit --verbose --configuration phpunit.xml.dist - tags: - - docker - -# Test PHP 7.3 -test:7.3: - image: php:7.3 - before_script: - - *docker_boostrap - script: - - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar - - chmod +x /usr/local/bin/phpunit - - phpunit --verbose --configuration phpunit.xml.dist - tags: - - docker + - docker \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d58049..84ef43f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.4.7 (2020-04-11) +- Update PHPUnit to 9 +- Start adding return types + ## 1.4.6 (2020-01-10) - Switched IF Statement order to prevent excess calls to redis. diff --git a/composer.json b/composer.json index d4327b8..887fa57 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,13 @@ { "name": "idanoo/php-resque", - "version": "1.4.6", + "version": "1.4.7", "type": "library", "replace": { "chrisboulton/php-resque": "*", "danhunsaker/php-resque": "*" }, "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", - "keywords": ["job", "background", "redis", "resque"], + "keywords": ["job", "background", "redis", "resque", "php"], "homepage": "http://www.github.com/idanoo/php-resque/", "license": "MIT", "authors": [ @@ -24,7 +24,7 @@ "colinmollenhour/credis": "^1.10" }, "require-dev": { - "phpunit/phpunit": "^6" + "phpunit/phpunit": "^9" }, "bin": [ "bin/resque" diff --git a/lib/Resque.php b/lib/Resque.php index 68b0067..49770e4 100644 --- a/lib/Resque.php +++ b/lib/Resque.php @@ -10,7 +10,7 @@ class Resque { - const VERSION = '1.4.6'; + const VERSION = '1.4.7'; const DEFAULT_INTERVAL = 5; @@ -51,6 +51,7 @@ class Resque * Return an instance of the Resque_Redis class instantiated for Resque. * * @return Resque_Redis Instance of Resque_Redis. + * * @throws Resque_RedisException */ public static function redis() @@ -101,9 +102,10 @@ class Resque * * @param string $queue The name of the queue to add the job to. * @param array $item Job description as an array to be JSON encoded. + * * @return bool */ - public static function push($queue, $item) + public static function push($queue, $item): bool { $encodedItem = json_encode($item); if ($encodedItem === false) { @@ -122,6 +124,7 @@ class Resque * return it. * * @param string $queue The name of the queue to fetch an item from. + * * @return mixed Decoded item from the queue. */ public static function pop($queue) @@ -142,7 +145,7 @@ class Resque * @param array $items * @return integer number of deleted items */ - public static function dequeue($queue, $items = Array()) + public static function dequeue($queue, $items = []) { if (count($items) > 0) { return self::removeItems($queue, $items); @@ -155,13 +158,14 @@ class Resque * Remove specified queue * * @param string $queue The name of the queue to remove. - * @return integer Number of deleted items + * + * @return int Number of deleted items */ - public static function removeQueue($queue) + public static function removeQueue($queue): int { $num = self::removeList($queue); self::redis()->srem('queues', $queue); - return $num; + return intval($num); } /** @@ -170,12 +174,13 @@ class Resque * * @param array $queues * @param int $timeout + * * @return array|null|void */ public static function blpop(array $queues, $timeout) { $list = array(); - foreach ($queues AS $queue) { + foreach ($queues as $queue) { $list[] = 'queue:' . $queue; } @@ -192,10 +197,10 @@ class Resque */ $queue = substr($item[0], strlen(self::redis()->getPrefix() . 'queue:')); - return array( + return [ 'queue' => $queue, 'payload' => json_decode($item[1], true) - ); + ]; } /** @@ -205,9 +210,9 @@ class Resque * * @return int The size of the queue. */ - public static function size($queue) + public static function size($queue): int { - return self::redis()->llen('queue:' . $queue); + return intval(self::redis()->llen('queue:' . $queue)); } /** @@ -245,6 +250,7 @@ class Resque * Reserve and return the next available job in the specified queue. * * @param string $queue Queue to fetch next available job from. + * * @return false|object|Resque_Job */ public static function reserve($queue) @@ -257,13 +263,10 @@ class Resque * * @return array Array of queues. */ - public static function queues() + public static function queues(): array { $queues = self::redis()->smembers('queues'); - if (!is_array($queues)) { - $queues = array(); - } - return $queues; + return is_array($queues) ? $queues : []; } /** @@ -276,9 +279,10 @@ class Resque * * @param string $queue The name of the queue * @param array $items - * @return integer number of deleted items + * + * @return int number of deleted items */ - private static function removeItems($queue, $items = Array()) + private static function removeItems($queue, $items = []): int { $counter = 0; $originalQueue = 'queue:' . $queue; diff --git a/test/Resque/Tests/EventTest.php b/test/Resque/Tests/EventTest.php index 24a83c7..2bb4f40 100644 --- a/test/Resque/Tests/EventTest.php +++ b/test/Resque/Tests/EventTest.php @@ -13,7 +13,7 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase private $callbacksHit = []; private $worker; - public function setUp() + public function setUp(): void { Test_Job::$called = false; @@ -23,7 +23,7 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase $this->worker->registerWorker(); } - public function tearDown() + public function tearDown(): void { Resque_Event::clearListeners(); $this->callbacksHit = []; diff --git a/test/Resque/Tests/JobStatusTest.php b/test/Resque/Tests/JobStatusTest.php index d573456..3cb0ca8 100644 --- a/test/Resque/Tests/JobStatusTest.php +++ b/test/Resque/Tests/JobStatusTest.php @@ -15,7 +15,7 @@ class Resque_Tests_JobStatusTest extends Resque_Tests_TestCase */ protected $worker; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/test/Resque/Tests/JobTest.php b/test/Resque/Tests/JobTest.php index ada26cb..67865f8 100644 --- a/test/Resque/Tests/JobTest.php +++ b/test/Resque/Tests/JobTest.php @@ -12,7 +12,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase { protected $worker; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -44,7 +44,9 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase */ public function testObjectArgumentsCannotBePassedToJob() { - $args = new stdClass; + $this->expectException(InvalidArgumentException::class); + + $args = new stdClass(); $args->test = 'somevalue'; Resque::enqueue('jobs', 'Test_Job', $args); } @@ -121,6 +123,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase */ public function testJobWithoutPerformMethodThrowsException() { + $this->expectException(Resque_Exception::class); Resque::enqueue('jobs', 'Test_Job_Without_Perform_Method'); $job = $this->worker->reserve(); $job->worker = $this->worker; @@ -132,6 +135,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase */ public function testInvalidJobThrowsException() { + $this->expectException(Resque_Exception::class); Resque::enqueue('jobs', 'Invalid_Job'); $job = $this->worker->reserve(); $job->worker = $this->worker; @@ -334,7 +338,7 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase $this->assertEquals($removedItems, 2); $this->assertEquals(Resque::size($queue), 1); $item = Resque::pop($queue); - $this->assertInternalType('array', $item['args']); + $this->assertIsArray($item['args']); $this->assertEquals(10, $item['args'][0]['bar'], 'Wrong items were dequeued from queue!'); } diff --git a/test/Resque/Tests/RedisTest.php b/test/Resque/Tests/RedisTest.php index 7e9a346..2f73bc4 100644 --- a/test/Resque/Tests/RedisTest.php +++ b/test/Resque/Tests/RedisTest.php @@ -181,12 +181,14 @@ class Resque_Tests_RedisTest extends Resque_Tests_TestCase /** * @dataProvider bogusDsnStringProvider + * * @expectedException InvalidArgumentException + * * @param $dsn */ public function testParsingBogusDsnStringThrowsException($dsn) { - // The next line should throw an InvalidArgumentException + $this->expectException(InvalidArgumentException::class); Resque_Redis::parseDsn($dsn); } } \ No newline at end of file diff --git a/test/Resque/Tests/TestCase.php b/test/Resque/Tests/TestCase.php index a428d12..0e93578 100644 --- a/test/Resque/Tests/TestCase.php +++ b/test/Resque/Tests/TestCase.php @@ -13,12 +13,12 @@ class Resque_Tests_TestCase extends PHPUnit\Framework\TestCase protected $resque; protected $redis; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { date_default_timezone_set('UTC'); } - public function setUp() + public function setUp(): void { // Setup redis connection for testing. global $redisTestServer; From 80d64e79ffa612ec0a3bd81ec40e9aa9abafd427 Mon Sep 17 00:00:00 2001 From: idanoo Date: Fri, 19 Feb 2021 12:23:32 +1300 Subject: [PATCH 25/45] 2.0.0 Add namespacing + PHP8.0 support (#1) 2.0.0 (2021-02-19) Moved to PSR-4 Namespaced codebase Added more comments throughout Co-Authored-By: idanoo Co-Committed-By: idanoo --- .gitignore | 3 +- .gitlab-ci.yml | 27 +- .travis.yml | 13 - CHANGELOG.md | 7 +- HOWITWORKS.md | 10 +- README.md | 4 +- bin/resque | 32 +- build.xml | 18 - composer.json | 21 +- composer.lock | 1472 ++++++++++++----- demo/bad_job.php | 8 - demo/php_error_job.php | 9 - demo/resque.php | 7 - examples/BadPHPJob.php | 11 + .../CheckStatus.php | 9 +- demo/init.php => examples/Init.php | 6 +- demo/long_job.php => examples/LongPHPJob.php | 6 +- examples/PHPErrorJob.php | 13 + demo/job.php => examples/PHPJob.php | 6 +- .../SampleResquePlugin.php | 25 +- {demo => examples}/queue.php | 11 +- {extras => examples}/resque.logrotate | 2 +- extras/resque.monit | 15 - lib/Resque/Job/FactoryInterface.php | 12 - phpunit.xml.dist => phpunit.xml | 13 +- ruleset.xml | 25 + {lib => src}/Resque/Event.php | 9 +- {lib => src}/Resque/Exception.php | 7 +- .../Resque => src/Resque/Failure}/Failure.php | 16 +- .../Resque/Failure/ResqueFailureInterface.php | 8 +- .../Resque/Failure/ResqueFailureRedis.php | 15 +- .../Resque/Job/DirtyExitException.php | 6 +- {lib => src}/Resque/Job/DontCreate.php | 6 +- {lib => src}/Resque/Job/DontPerform.php | 7 +- {lib => src}/Resque/Job/Factory.php | 21 +- src/Resque/Job/FactoryInterface.php | 21 + {lib/Resque => src/Resque/Job}/Job.php | 80 +- .../Resque/Job}/JobInterface.php | 4 +- {lib => src}/Resque/Job/Status.php | 30 +- {lib => src}/Resque/Log.php | 26 +- {lib => src}/Resque/Redis.php | 32 +- {lib => src}/Resque/RedisException.php | 6 +- {lib => src/Resque}/Resque.php | 43 +- {lib => src}/Resque/Stat.php | 10 +- {lib => src}/Resque/Worker.php | 118 +- test/Resque/Tests/JobStatusTest.php | 109 -- test/Resque/Tests/JobTest.php | 421 ----- {test => tests}/Resque/Tests/EventTest.php | 58 +- tests/Resque/Tests/JobStatusTest.php | 110 ++ tests/Resque/Tests/JobTest.php | 423 +++++ {test => tests}/Resque/Tests/LogTest.php | 12 +- {test => tests}/Resque/Tests/RedisTest.php | 22 +- {test => tests}/Resque/Tests/StatTest.php | 30 +- {test => tests}/Resque/Tests/TestCase.php | 11 +- {test => tests}/Resque/Tests/WorkerTest.php | 154 +- {test => tests}/bootstrap.php | 38 +- 56 files changed, 2215 insertions(+), 1423 deletions(-) delete mode 100644 .travis.yml delete mode 100644 build.xml delete mode 100644 demo/bad_job.php delete mode 100644 demo/php_error_job.php delete mode 100644 demo/resque.php create mode 100644 examples/BadPHPJob.php rename demo/check_status.php => examples/CheckStatus.php (83%) rename demo/init.php => examples/Init.php (95%) rename demo/long_job.php => examples/LongPHPJob.php (60%) create mode 100644 examples/PHPErrorJob.php rename demo/job.php => examples/PHPJob.php (79%) rename extras/sample-plugin.php => examples/SampleResquePlugin.php (59%) rename {demo => examples}/queue.php (68%) rename {extras => examples}/resque.logrotate (82%) delete mode 100644 extras/resque.monit delete mode 100644 lib/Resque/Job/FactoryInterface.php rename phpunit.xml.dist => phpunit.xml (58%) create mode 100644 ruleset.xml rename {lib => src}/Resque/Event.php (93%) rename {lib => src}/Resque/Exception.php (57%) rename {lib/Resque => src/Resque/Failure}/Failure.php (74%) rename lib/Resque/Failure/Interface.php => src/Resque/Failure/ResqueFailureInterface.php (81%) rename lib/Resque/Failure/Redis.php => src/Resque/Failure/ResqueFailureRedis.php (77%) rename {lib => src}/Resque/Job/DirtyExitException.php (60%) rename {lib => src}/Resque/Job/DontCreate.php (65%) rename {lib => src}/Resque/Job/DontPerform.php (63%) rename {lib => src}/Resque/Job/Factory.php (56%) create mode 100644 src/Resque/Job/FactoryInterface.php rename {lib/Resque => src/Resque/Job}/Job.php (72%) rename {lib/Resque => src/Resque/Job}/JobInterface.php (62%) rename {lib => src}/Resque/Job/Status.php (78%) rename {lib => src}/Resque/Log.php (84%) rename {lib => src}/Resque/Redis.php (88%) rename {lib => src}/Resque/RedisException.php (57%) rename {lib => src/Resque}/Resque.php (91%) rename {lib => src}/Resque/Stat.php (94%) rename {lib => src}/Resque/Worker.php (78%) delete mode 100644 test/Resque/Tests/JobStatusTest.php delete mode 100644 test/Resque/Tests/JobTest.php rename {test => tests}/Resque/Tests/EventTest.php (74%) create mode 100644 tests/Resque/Tests/JobStatusTest.php create mode 100644 tests/Resque/Tests/JobTest.php rename {test => tests}/Resque/Tests/LogTest.php (76%) rename {test => tests}/Resque/Tests/RedisTest.php (90%) rename {test => tests}/Resque/Tests/StatTest.php (54%) rename {test => tests}/Resque/Tests/TestCase.php (67%) rename {test => tests}/Resque/Tests/WorkerTest.php (55%) rename {test => tests}/bootstrap.php (64%) diff --git a/.gitignore b/.gitignore index 924bb34..aa30d8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ vendor/ -phpunit.xml -*.swp \ No newline at end of file +.phpunit.result.cache \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed4b864..6907bfb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,9 +12,6 @@ && docker-php-ext-enable redis docker-php-ext-install pcntl - # Hack to fix mismatched php versions - rm composer.lock - # Install Composer wget https://getcomposer.org/composer.phar php composer.phar install --dev @@ -28,6 +25,26 @@ test:7.4: before_script: - *docker_boostrap script: - - php vendor/bin/phpunit --verbose --configuration phpunit.xml.dist + - php vendor/bin/phpunit --verbose --configuration phpunit.xml tags: - - docker \ No newline at end of file + - docker + +# Test PHP 8.0 +test:8.0: + image: php:8.0 + before_script: + - *docker_boostrap + script: + - php vendor/bin/phpunit --verbose --configuration phpunit.xml + tags: + - docker + +# Codestandards +lint: + image: php:8.0 + allow_failure: true + script: + - apt update && apt install -y wget unzip git + - wget https://getcomposer.org/composer.phar + - php composer.phar install --dev + - php -d memory_limit=256M vendor/bin/phpcs -s --standard=ruleset.xml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 91c26ad..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: php - -php: - - 7.0 - - 7.1 - - 7.2 - -services: - - redis-server - -before_script: - - echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - composer install diff --git a/CHANGELOG.md b/CHANGELOG.md index 84ef43f..20fa9ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.0 (2021-02-19) +- Moved to PSR-4 +- Namespaced codebase +- Added more comments throughout + ## 1.4.7 (2020-04-11) - Update PHPUnit to 9 - Start adding return types @@ -93,7 +98,7 @@ Changes by iskandar introduce improved support for using DSNs to connect to Redi * Pass queue name to afterEvent callback * Only declare RedisException if it doesn't already exist (Matt Heath) * Add support for Composer -* Fix missing and incorrect paths for Resque and Resque_Job_Status classes in demo (jjfrey) +* Fix missing and incorrect paths for Resque and \Resque\Job\Status classes in demo (jjfrey) * Disable autoload for the RedisException class_exists call (scragg0x) * General tidy up of comments and files/folders diff --git a/HOWITWORKS.md b/HOWITWORKS.md index ec85fa3..7168926 100644 --- a/HOWITWORKS.md +++ b/HOWITWORKS.md @@ -14,9 +14,9 @@ What happens when you call `Resque::enqueue()`? 4. `Resque_Job::create()` pushes the job to the requested queue (first argument) 5. `Resque_Job::create()`, if status monitoring is enabled for the job (fourth - argument), calls `Resque_Job_Status::create()` with the job ID as its only + argument), calls `\Resque\Job\Status::create()` with the job ID as its only argument -6. `Resque_Job_Status::create()` creates a key in Redis with the job ID in its +6. `\Resque\Job\Status::create()` creates a key in Redis with the job ID in its name, and the current status (as well as a couple of timestamps) as its value, then returns control to `Resque_Job::create()` 7. `Resque_Job::create()` returns control to `Resque::enqueue()`, with the job @@ -85,15 +85,15 @@ How do the workers process the queues? * Worker 1. The worker waits for the job process to complete 2. If the exit status is not 0, the worker calls `Resque_Job->fail()` with - a `Resque_Job_DirtyExitException` as its only argument. + a `Resque\Job\DirtyExitException` as its only argument. 3. `Resque_Job->fail()` triggers an `onFailure` event 4. `Resque_Job->fail()` updates the job status from `RUNNING` to `FAILED` 5. `Resque_Job->fail()` calls `Resque_Failure::create()` with the job - payload, the `Resque_Job_DirtyExitException`, the internal ID of the + payload, the `Resque\Job\DirtyExitException`, the internal ID of the worker, and the queue name as arguments 6. `Resque_Failure::create()` creates a new object of whatever type has been set as the `Resque_Failure` "backend" handler; by default, this is - a `Resque_Failure_Redis` object, whose constructor simply collects the + a `ResqueFailureRedis` object, whose constructor simply collects the data passed into `Resque_Failure::create()` and pushes it into Redis in the `failed` queue 7. `Resque_Job->fail()` increments two failure counters in Redis: one for diff --git a/README.md b/README.md index 6b9ce07..b09662e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ php-resque: PHP Resque Worker (and Enqueue) =========================================== + [![pipeline status](https://gitlab.com/idanoo/php-resque/badges/master/pipeline.svg)](https://gitlab.com/idanoo/php-resque/-/commits/master) + Resque is a Redis-backed library for creating background jobs, placing those jobs on one or more queues, and processing them later. @@ -367,8 +369,6 @@ your `APP_INCLUDE` script should initialize and register any listeners required for operation. If you have rolled your own worker manager, then it is again your responsibility to register listeners. -A sample plugin is included in the `extras` directory. - ### Events ### #### beforeFirstFork #### diff --git a/bin/resque b/bin/resque index 23ff6d6..91bd82a 100755 --- a/bin/resque +++ b/bin/resque @@ -9,7 +9,6 @@ $files = [ __DIR__ . '/../vendor/autoload.php', ]; -$found = false; foreach ($files as $file) { if (file_exists($file)) { require_once $file; @@ -25,6 +24,7 @@ if (!class_exists('Composer\Autoload\ClassLoader', false)) { ); } +// Set which queues to monitor '*' $QUEUE = getenv('QUEUE'); if (empty($QUEUE)) { die("Set QUEUE env var containing the list of queues to work.\n"); @@ -38,22 +38,24 @@ if (empty($QUEUE)) { */ $REDIS_BACKEND = getenv('REDIS_BACKEND'); -// A redis database number +// Override redis DB numbers $REDIS_BACKEND_DB = getenv('REDIS_BACKEND_DB'); if (!empty($REDIS_BACKEND)) { if (empty($REDIS_BACKEND_DB)) { - Resque::setBackend($REDIS_BACKEND); + \Resque\Resque::setBackend($REDIS_BACKEND); } else { - Resque::setBackend($REDIS_BACKEND, $REDIS_BACKEND_DB); + \Resque\Resque::setBackend($REDIS_BACKEND, $REDIS_BACKEND_DB); } } +// Set Logging level $logLevel = false; $LOGGING = getenv('LOGLEVEL'); if (!empty($LOGGING)) { $logLevel = $LOGGING; } +// Bootstrap file $APP_INCLUDE = getenv('APP_INCLUDE'); if ($APP_INCLUDE) { if (!file_exists($APP_INCLUDE)) { @@ -66,41 +68,45 @@ if ($APP_INCLUDE) { // See if the APP_INCLUDE containes a logger object, // If none exists, fallback to internal logger if (!isset($logger) || !is_object($logger)) { - $logger = new Resque_Log($logLevel); + $logger = new \Resque\Log($logLevel); } +// Determines if blocking or not $BLOCKING = getenv('BLOCKING') !== FALSE; +// Interval to check for jobs $interval = 5; $INTERVAL = getenv('INTERVAL'); if (!empty($INTERVAL)) { $interval = $INTERVAL; } +// Sets worker count $count = 1; $COUNT = getenv('COUNT'); if (!empty($COUNT) && $COUNT > 1) { $count = $COUNT; } +// Determines redis key prefix $PREFIX = getenv('PREFIX'); if (!empty($PREFIX)) { - $logger->log(Psr\Log\LogLevel::INFO, 'Prefix set to {prefix}', ['prefix' => $PREFIX]); - Resque_Redis::prefix($PREFIX); + $logger->log(\Psr\Log\LogLevel::INFO, 'Prefix set to {prefix}', ['prefix' => $PREFIX]); + \Resque\Redis::prefix($PREFIX); } if ($count > 1) { for ($i = 0; $i < $count; ++$i) { - $pid = Resque::fork(); + $pid = \Resque\Resque::fork(); if ($pid === false || $pid === -1) { - $logger->log(Psr\Log\LogLevel::EMERGENCY, 'Could not fork worker {count}', ['count' => $i]); + $logger->log(\Psr\Log\LogLevel::EMERGENCY, 'Could not fork worker {count}', ['count' => $i]); die(); } elseif (!$pid) { // Child, start the worker $queues = explode(',', $QUEUE); - $worker = new Resque_Worker($queues); + $worker = new \Resque\Worker($queues); $worker->setLogger($logger); - $logger->log(Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', ['worker' => $worker]); + $logger->log(\Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', ['worker' => $worker]); $worker->work($interval, $BLOCKING); break; } @@ -108,7 +114,7 @@ if ($count > 1) { } else { // Start a single worker $queues = explode(',', $QUEUE); - $worker = new Resque_Worker($queues); + $worker = new \Resque\Worker($queues); $worker->setLogger($logger); $PIDFILE = getenv('PIDFILE'); @@ -117,6 +123,6 @@ if ($count > 1) { die('Could not write PID information to ' . $PIDFILE); } - $logger->log(Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', ['worker' => $worker]); + $logger->log(\Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', ['worker' => $worker]); $worker->work($interval, $BLOCKING); } diff --git a/build.xml b/build.xml deleted file mode 100644 index b51c486..0000000 --- a/build.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/composer.json b/composer.json index 887fa57..04c863b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,5 @@ { "name": "idanoo/php-resque", - "version": "1.4.7", "type": "library", "replace": { "chrisboulton/php-resque": "*", @@ -17,21 +16,25 @@ } ], "require": { - "php": "^7.0", - "ext-pcntl": "*", - "ext-redis": "*", - "psr/log": "~1.0", - "colinmollenhour/credis": "^1.10" + "php": ">7.4", + "psr/log": "^1.1.0", + "colinmollenhour/credis": "^1.12.0" }, "require-dev": { - "phpunit/phpunit": "^9" + "phpunit/phpunit": "^9", + "squizlabs/php_codesniffer": "3.*" }, "bin": [ "bin/resque" ], "autoload": { - "psr-0": { - "Resque": "lib" + "psr-4": { + "Resque\\": "src/Resque" + } + }, + "autoload-dev": { + "psr-4": { + "Resque\\Test\\": "tests/Resque/Tests" } }, "support": { diff --git a/composer.lock b/composer.lock index e89c818..a335804 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f7e4ae15d649e761fe2c5c3f6a466221", + "content-hash": "3b306efc1905a1f6cce0808d41fcf19c", "packages": [ { "name": "colinmollenhour/credis", - "version": "1.10.0", + "version": "v1.12.1", "source": { "type": "git", "url": "https://github.com/colinmollenhour/credis.git", - "reference": "8ab6db707c821055f9856b8cf76d5f44beb6fd8a" + "reference": "c27faa11724229986335c23f4b6d0f1d8d6547fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/8ab6db707c821055f9856b8cf76d5f44beb6fd8a", - "reference": "8ab6db707c821055f9856b8cf76d5f44beb6fd8a", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/c27faa11724229986335c23f4b6d0f1d8d6547fb", + "reference": "c27faa11724229986335c23f4b6d0f1d8d6547fb", "shasum": "" }, "require": { @@ -44,20 +44,24 @@ ], "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", "homepage": "https://github.com/colinmollenhour/credis", - "time": "2018-05-07T14:45:04+00:00" + "support": { + "issues": "https://github.com/colinmollenhour/credis/issues", + "source": "https://github.com/colinmollenhour/credis/tree/v1.12.1" + }, + "time": "2020-11-06T16:09:14+00:00" }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { @@ -66,7 +70,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -91,40 +95,40 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.3" + }, + "time": "2020-03-23T09:12:05+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -138,33 +142,51 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-11-10T18:47:58+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.8.1", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "replace": { "myclabs/deep-copy": "self.version" @@ -195,32 +217,99 @@ "object", "object graph" ], - "time": "2018-06-11T23:09:50+00:00" + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-11-13T09:40:50+00:00" }, { - "name": "phar-io/manifest", - "version": "1.0.1", + "name": "nikic/php-parser", + "version": "v4.10.4", "source": { "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + }, + "time": "2020-12-20T10:01:03+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -250,24 +339,28 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/master" + }, + "time": "2020-06-27T14:33:11+00:00" }, { "name": "phar-io/version", - "version": "1.0.1", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -297,39 +390,38 @@ } ], "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.0.4" + }, + "time": "2020-12-13T23:18:30+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-2.x": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -351,44 +443,45 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" + "mockery/mockery": "~1.3.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "5.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -399,44 +492,49 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + }, + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -449,42 +547,47 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + }, + "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpspec/prophecy", - "version": "1.8.0", + "version": "1.12.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + "reference": "245710e971a030f42e08f4912863805570f23d39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", + "reference": "245710e971a030f42e08f4912863805570f23d39", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.1", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.11.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -512,44 +615,52 @@ "spy", "stub" ], - "time": "2018-08-05T17:53:17+00:00" + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + }, + "time": "2020-12-19T10:15:11+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "5.3.2", + "version": "9.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac" + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.4.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "nikic/php-parser": "^4.10.2", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-xdebug": "^2.5.5" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3.x-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -575,29 +686,42 @@ "testing", "xunit" ], - "time": "2018-04-06T15:36:58+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:44:49+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -612,7 +736,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -622,26 +746,107 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:57:25+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -663,32 +868,42 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -703,7 +918,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -712,106 +927,69 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-11-27T05:48:46+00:00" + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "6.5.13", + "version": "9.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0973426fb012359b2f18d3bd1e90ef1172839693" + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0973426fb012359b2f18d3bd1e90ef1172839693", - "reference": "0973426fb012359b2f18d3bd1e90ef1172839693", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.0", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.3", - "phpunit/php-file-iterator": "^1.4.3", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.9", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^2.0", - "sebastian/environment": "^3.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.1", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpspec/prophecy": "^1.12.1", + "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^2.3", + "sebastian/version": "^3.0.2" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" + "ext-soap": "*", + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -819,12 +997,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.5.x-dev" + "dev-master": "9.5-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -845,41 +1026,46 @@ "testing", "xunit" ], - "time": "2018-09-08T15:10:43+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" + }, + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-02-02T14:45:58+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.10", + "name": "sebastian/cli-parser", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.0", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" - }, - "conflict": { - "phpunit/phpunit": "<6.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.5.11" - }, - "suggest": { - "ext-soap": "*" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0.x-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -898,38 +1084,100 @@ "role": "lead" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2018-08-09T05:50:03+00:00" + "time": "2020-09-28T06:08:49+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "name": "sebastian/code-unit", + "version": "1.0.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" } }, "autoload": { @@ -949,34 +1197,44 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" }, { "name": "sebastian/comparator", - "version": "2.1.3", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/diff": "^2.0 || ^3.0", - "sebastian/exporter": "^3.1" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -989,6 +1247,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1000,10 +1262,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -1013,27 +1271,38 @@ "compare", "equality" ], - "time": "2018-02-01T13:46:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:49:45+00:00" }, { - "name": "sebastian/diff", - "version": "2.0.1", + "name": "sebastian/complexity", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", "shasum": "" }, "require": { - "php": "^7.0" + "nikic/php-parser": "^4.7", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { @@ -1052,45 +1321,118 @@ ], "authors": [ { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-08-03T08:09:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" }, { "name": "sebastian/environment", - "version": "3.1.0", + "version": "5.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + "reference": "388b6ced16caa751030f6a69e588299fa09200ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.1" + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -1115,34 +1457,44 @@ "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:52:38+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.0", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1155,6 +1507,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1163,17 +1519,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1182,27 +1534,40 @@ "export", "exporter" ], - "time": "2017-04-03T13:19:02+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:24:23+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -1210,7 +1575,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1233,34 +1598,101 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:55:19+00:00" }, { - "name": "sebastian/object-enumerator", - "version": "3.0.3", + "name": "sebastian/lines-of-code", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "nikic/php-parser": "^4.6", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" } }, "autoload": { @@ -1280,32 +1712,42 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1325,32 +1767,42 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1363,14 +1815,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -1378,29 +1830,42 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1420,29 +1885,95 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" }, { - "name": "sebastian/version", - "version": "2.0.1", + "name": "sebastian/type", + "version": "2.3.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:18:59+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" } }, "autoload": { @@ -1463,27 +1994,172 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { - "name": "theseer/tokenizer", - "version": "1.1.0", + "name": "squizlabs/php_codesniffer", + "version": "3.5.8", "source": { "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", + "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2020-10-23T02:01:07+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.22.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-01-07T16:49:33+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "75a63c33a8577608444246075ea0af0d052e452a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -1503,35 +2179,44 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/master" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2020-07-12T23:59:07+00:00" }, { "name": "webmozart/assert", - "version": "1.3.0", + "version": "1.9.1", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "url": "https://github.com/webmozarts/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -1553,7 +2238,11 @@ "check", "validate" ], - "time": "2018-01-29T19:49:41+00:00" + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.9.1" + }, + "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], @@ -1562,9 +2251,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.0", - "ext-pcntl": "*", - "ext-redis": "*" + "php": ">7.4" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.0.0" } diff --git a/demo/bad_job.php b/demo/bad_job.php deleted file mode 100644 index cd719cc..0000000 --- a/demo/bad_job.php +++ /dev/null @@ -1,8 +0,0 @@ -isTracking()) { die("Resque is not tracking the status of this job.\n"); } @@ -20,4 +23,4 @@ echo "Tracking status of " . $argv[1] . ". Press [break] to stop.\n\n"; while (true) { fwrite(STDOUT, "Status of " . $argv[1] . " is: " . $status->get() . "\n"); sleep(1); -} \ No newline at end of file +} diff --git a/demo/init.php b/examples/Init.php similarity index 95% rename from demo/init.php rename to examples/Init.php index bdad7e5..11d4833 100644 --- a/demo/init.php +++ b/examples/Init.php @@ -1,4 +1,7 @@ /var/log/resque/worker_[QUEUE].log &'" as uid [UID] and gid [GID] - stop program = "/bin/sh -c 'kill -s QUIT `cat /var/run/resque/worker_[QUEUE].pid` && rm -f /var/run/resque/worker_[QUEUE].pid; exit 0;'" - if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory? - group resque_workers \ No newline at end of file diff --git a/lib/Resque/Job/FactoryInterface.php b/lib/Resque/Job/FactoryInterface.php deleted file mode 100644 index a1203e1..0000000 --- a/lib/Resque/Job/FactoryInterface.php +++ /dev/null @@ -1,12 +0,0 @@ - - ./test/Resque/ + ./tests/Resque/ - - - - ./lib/Resque/ - - \ No newline at end of file diff --git a/ruleset.xml b/ruleset.xml new file mode 100644 index 0000000..c746767 --- /dev/null +++ b/ruleset.xml @@ -0,0 +1,25 @@ + + + PSR12 + + . + + vendor/ + tests/ + + + + + + + + + + + 0 + + + + diff --git a/lib/Resque/Event.php b/src/Resque/Event.php similarity index 93% rename from lib/Resque/Event.php rename to src/Resque/Event.php index 2c8f182..7886640 100644 --- a/lib/Resque/Event.php +++ b/src/Resque/Event.php @@ -1,14 +1,16 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Event +class Event { /** * @var array Array containing all registered callbacks, indexked by event name. @@ -36,7 +38,8 @@ class Resque_Event if (!is_callable($callback)) { continue; } - call_user_func_array($callback, $data); + + call_user_func_array($callback, array_values($data)); } return true; diff --git a/lib/Resque/Exception.php b/src/Resque/Exception.php similarity index 57% rename from lib/Resque/Exception.php rename to src/Resque/Exception.php index fe510ca..ed2e3f7 100644 --- a/lib/Resque/Exception.php +++ b/src/Resque/Exception.php @@ -1,13 +1,16 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Exception extends Exception +class Exception extends \Exception { + } diff --git a/lib/Resque/Failure.php b/src/Resque/Failure/Failure.php similarity index 74% rename from lib/Resque/Failure.php rename to src/Resque/Failure/Failure.php index 24a3908..958fcf0 100644 --- a/lib/Resque/Failure.php +++ b/src/Resque/Failure/Failure.php @@ -1,14 +1,16 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Failure +class Failure { /** * @var string Class name representing the backend to pass failed jobs off to. @@ -19,11 +21,11 @@ class Resque_Failure * Create a new failed job on the backend. * * @param array $payload The contents of the job that has just failed. - * @param Exception $exception The exception generated when the job failed to run. - * @param Resque_Worker $worker Instance of Resque_Worker that was running this job when it failed. + * @param \Exception $exception The exception generated when the job failed to run. + * @param \Resque\Worker $worker Instance of Resque_Worker that was running this job when it failed. * @param string $queue The name of the queue that this job was fetched from. */ - public static function create($payload, Exception $exception, Resque_Worker $worker, $queue) + public static function create($payload, \Exception $exception, \Resque\Worker $worker, $queue) { $backend = self::getBackend(); new $backend($payload, $exception, $worker, $queue); @@ -37,7 +39,7 @@ class Resque_Failure public static function getBackend() { if (self::$backend === null) { - self::$backend = 'Resque_Failure_Redis'; + self::$backend = '\\Resque\\Failure\\ResqueFailureRedis'; } return self::$backend; @@ -54,4 +56,4 @@ class Resque_Failure { self::$backend = $backend; } -} \ No newline at end of file +} diff --git a/lib/Resque/Failure/Interface.php b/src/Resque/Failure/ResqueFailureInterface.php similarity index 81% rename from lib/Resque/Failure/Interface.php rename to src/Resque/Failure/ResqueFailureInterface.php index d6da0e2..980e656 100644 --- a/lib/Resque/Failure/Interface.php +++ b/src/Resque/Failure/ResqueFailureInterface.php @@ -1,13 +1,15 @@ + * @package Resque\Failure + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -interface Resque_Failure_Interface +interface ResqueFailureInterface { /** * Initialize a failed job class and save it (where appropriate). diff --git a/lib/Resque/Failure/Redis.php b/src/Resque/Failure/ResqueFailureRedis.php similarity index 77% rename from lib/Resque/Failure/Redis.php rename to src/Resque/Failure/ResqueFailureRedis.php index dacde7e..5695288 100644 --- a/lib/Resque/Failure/Redis.php +++ b/src/Resque/Failure/ResqueFailureRedis.php @@ -1,13 +1,16 @@ + * @package Resque\Failure + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Failure_Redis implements Resque_Failure_Interface +class ResqueFailureRedis implements ResqueFailureInterface { /** * Initialize a failed job class and save it (where appropriate). @@ -16,11 +19,11 @@ class Resque_Failure_Redis implements Resque_Failure_Interface * @param object $exception Instance of the exception that was thrown by the failed job. * @param object $worker Instance of Resque_Worker that received the job. * @param string $queue The name of the queue the job was fetched from. - * @throws Resque_RedisException + * @throws \Resque\RedisException */ public function __construct($payload, $exception, $worker, $queue) { - $data = new stdClass; + $data = new \stdClass(); $data->failed_at = strftime('%a %b %d %H:%M:%S %Z %Y'); $data->payload = $payload; $data->exception = get_class($exception); @@ -29,6 +32,6 @@ class Resque_Failure_Redis implements Resque_Failure_Interface $data->worker = (string)$worker; $data->queue = $queue; $data = json_encode($data); - Resque::redis()->rpush('failed', $data); + \Resque\Resque::redis()->rpush('failed', $data); } } diff --git a/lib/Resque/Job/DirtyExitException.php b/src/Resque/Job/DirtyExitException.php similarity index 60% rename from lib/Resque/Job/DirtyExitException.php rename to src/Resque/Job/DirtyExitException.php index 7b1f88b..a96bc10 100644 --- a/lib/Resque/Job/DirtyExitException.php +++ b/src/Resque/Job/DirtyExitException.php @@ -1,13 +1,15 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Job_DirtyExitException extends RuntimeException +class DirtyExitException extends \RuntimeException { } diff --git a/lib/Resque/Job/DontCreate.php b/src/Resque/Job/DontCreate.php similarity index 65% rename from lib/Resque/Job/DontCreate.php rename to src/Resque/Job/DontCreate.php index 931ae91..efdb69c 100644 --- a/lib/Resque/Job/DontCreate.php +++ b/src/Resque/Job/DontCreate.php @@ -1,13 +1,15 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Job_DontCreate extends Exception +class DontCreate extends \Exception { } diff --git a/lib/Resque/Job/DontPerform.php b/src/Resque/Job/DontPerform.php similarity index 63% rename from lib/Resque/Job/DontPerform.php rename to src/Resque/Job/DontPerform.php index 69075f4..2c7f855 100644 --- a/lib/Resque/Job/DontPerform.php +++ b/src/Resque/Job/DontPerform.php @@ -1,14 +1,15 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ - -class Resque_Job_DontPerform extends Exception +class DontPerform extends \Exception { } diff --git a/lib/Resque/Job/Factory.php b/src/Resque/Job/Factory.php similarity index 56% rename from lib/Resque/Job/Factory.php rename to src/Resque/Job/Factory.php index 9e89169..af35c6f 100644 --- a/lib/Resque/Job/Factory.php +++ b/src/Resque/Job/Factory.php @@ -1,30 +1,39 @@ + * @license http://www.opensource.org/licenses/mit-license.php + */ +class Factory implements FactoryInterface { /** * @param $className * @param array $args * @param $queue - * @return Resque_JobInterface - * @throws Resque_Exception + * @return \Resque\Job\JobInterface + * @throws \Resque\Exception */ public function create($className, $args, $queue) { if (!class_exists($className)) { - throw new Resque_Exception( + throw new \Resque\Exception( 'Could not find job class ' . $className . '.' ); } if (!method_exists($className, 'perform')) { - throw new Resque_Exception( + throw new \Resque\Exception( 'Job class ' . $className . ' does not contain a perform method.' ); } - $instance = new $className; + $instance = new $className(); $instance->args = $args; $instance->queue = $queue; return $instance; diff --git a/src/Resque/Job/FactoryInterface.php b/src/Resque/Job/FactoryInterface.php new file mode 100644 index 0000000..279dead --- /dev/null +++ b/src/Resque/Job/FactoryInterface.php @@ -0,0 +1,21 @@ + + * @license http://www.opensource.org/licenses/mit-license.php + */ +interface FactoryInterface +{ + /** + * @param $className + * @param array $args + * @param $queue + * @return \Resque\Job\JobInterface + */ + public function create($className, $args, $queue); +} diff --git a/lib/Resque/Job.php b/src/Resque/Job/Job.php similarity index 72% rename from lib/Resque/Job.php rename to src/Resque/Job/Job.php index 5ffe995..3a98f98 100755 --- a/lib/Resque/Job.php +++ b/src/Resque/Job/Job.php @@ -1,14 +1,16 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Job +class Job { /** * @var string The name of the queue that this job belongs to. @@ -16,7 +18,7 @@ class Resque_Job public $queue; /** - * @var Resque_Worker Instance of the Resque worker running this job. + * @var \Resque\Worker Instance of the Resque worker running this job. */ public $worker; @@ -26,12 +28,12 @@ class Resque_Job public $payload; /** - * @var object|Resque_JobInterface Instance of the class performing work for this job. + * @var object|\Resque\Job\JobInterface Instance of the class performing work for this job. */ private $instance; /** - * @var Resque_Job_FactoryInterface + * @var \Resque\Job\FactoryInterface */ private $jobFactory; @@ -57,20 +59,20 @@ class Resque_Job * @param string $id Unique identifier for tracking the job. Generated if not supplied. * * @return string - * @throws InvalidArgumentException + * @throws \InvalidArgumentException */ public static function create($queue, $class, $args = null, $monitor = false, $id = null) { if (is_null($id)) { - $id = Resque::generateJobId(); + $id = \Resque\Resque::generateJobId(); } if ($args !== null && !is_array($args)) { - throw new InvalidArgumentException( + throw new \InvalidArgumentException( 'Supplied $args must be an array.' ); } - Resque::push($queue, [ + \Resque\Resque::push($queue, [ 'class' => $class, 'args' => [$args], 'id' => $id, @@ -78,7 +80,7 @@ class Resque_Job ]); if ($monitor) { - Resque_Job_Status::create($id); + Status::create($id); } return $id; @@ -86,43 +88,43 @@ class Resque_Job /** * Find the next available job from the specified queue and return an - * instance of Resque_Job for it. + * instance of \Resque\Job\Job for it. * * @param string $queue The name of the queue to check for a job in. - * @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found. + * @return false|object Null when there aren't any waiting jobs, instance of \Resque\Job\Job when a job was found. */ public static function reserve($queue) { - $payload = Resque::pop($queue); + $payload = \Resque\Resque::pop($queue); if (!is_array($payload)) { return false; } - return new Resque_Job($queue, $payload); + return new Job($queue, $payload); } /** * Find the next available job from the specified queues using blocking list pop - * and return an instance of Resque_Job for it. + * and return an instance of \Resque\Job\Job for it. * * @param array $queues * @param int $timeout - * @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found. + * @return false|object Null when there aren't any waiting jobs, instance of \Resque\Job\Job when a job was found. */ public static function reserveBlocking(array $queues, $timeout = null) { - $item = Resque::blpop($queues, $timeout); + $item = \Resque\Resque::blpop($queues, $timeout); if (!is_array($item)) { return false; } - return new Resque_Job($item['queue'], $item['payload']); + return new Job($item['queue'], $item['payload']); } /** * Update the status of the current job. * - * @param int $status Status constant from Resque_Job_Status indicating the current status of a job. + * @param int $status Status constant from \Resque\Job\Status indicating the current status of a job. */ public function updateStatus($status): bool { @@ -130,7 +132,7 @@ class Resque_Job return false; } - $statusInstance = new Resque_Job_Status($this->payload['id']); + $statusInstance = new Status($this->payload['id']); $statusInstance->update($status); return true; } @@ -138,11 +140,11 @@ class Resque_Job /** * Return the status of the current job. * - * @return int The status of the job as one of the Resque_Job_Status constants. + * @return int The status of the job as one of the \Resque\Job\Status constants. */ public function getStatus() { - $status = new Resque_Job_Status($this->payload['id']); + $status = new Status($this->payload['id']); return $status->get(); } @@ -162,7 +164,7 @@ class Resque_Job /** * Get the instantiated object for this job that will be performing work. - * @return Resque_JobInterface Instance of the object that this job belongs to. + * @return \Resque\Job\JobInterface Instance of the object that this job belongs to. */ public function getInstance() { @@ -180,12 +182,12 @@ class Resque_Job * associated with the job with the supplied arguments. * * @return bool - * @throws Resque_Exception When the job's class could not be found or it does not contain a perform method. + * @throws \Resque\Exception When the job's class could not be found or it does not contain a perform method. */ public function perform() { try { - Resque_Event::trigger('beforePerform', $this); + \Resque\Event::trigger('beforePerform', $this); $instance = $this->getInstance(); if (method_exists($instance, 'setUp')) { @@ -198,9 +200,9 @@ class Resque_Job $instance->tearDown(); } - Resque_Event::trigger('afterPerform', $this); - } // beforePerform/setUp have said don't perform this job. Return. - /** @noinspection PhpRedundantCatchClauseInspection */ catch (Resque_Job_DontPerform $e) { + \Resque\Event::trigger('afterPerform', $this); + } catch (DontPerform $e) { + /** @noinspection PhpRedundantCatchClauseInspection */ return false; } @@ -214,20 +216,20 @@ class Resque_Job */ public function fail($exception) { - Resque_Event::trigger('onFailure', [ + \Resque\Event::trigger('onFailure', [ 'exception' => $exception, 'job' => $this, ]); - $this->updateStatus(Resque_Job_Status::STATUS_FAILED); - Resque_Failure::create( + $this->updateStatus(Status::STATUS_FAILED); + \Resque\Failure\Failure::create( $this->payload, $exception, $this->worker, $this->queue ); - Resque_Stat::incr('failed'); - Resque_Stat::incr('failed:' . $this->worker); + \Resque\Stat::incr('failed'); + \Resque\Stat::incr('failed:' . $this->worker); } /** @@ -236,7 +238,7 @@ class Resque_Job */ public function recreate() { - $status = new Resque_Job_Status($this->payload['id']); + $status = new Status($this->payload['id']); $monitor = false; if ($status->isTracking()) { $monitor = true; @@ -266,10 +268,10 @@ class Resque_Job } /** - * @param Resque_Job_FactoryInterface $jobFactory - * @return Resque_Job + * @param FactoryInterface $jobFactory + * @return Job */ - public function setJobFactory(Resque_Job_FactoryInterface $jobFactory) + public function setJobFactory(FactoryInterface $jobFactory) { $this->jobFactory = $jobFactory; @@ -277,12 +279,12 @@ class Resque_Job } /** - * @return Resque_Job_FactoryInterface + * @return FactoryInterface */ public function getJobFactory() { if ($this->jobFactory === null) { - $this->jobFactory = new Resque_Job_Factory(); + $this->jobFactory = new Factory(); } return $this->jobFactory; } diff --git a/lib/Resque/JobInterface.php b/src/Resque/Job/JobInterface.php similarity index 62% rename from lib/Resque/JobInterface.php rename to src/Resque/Job/JobInterface.php index f31281d..ed8b53c 100644 --- a/lib/Resque/JobInterface.php +++ b/src/Resque/Job/JobInterface.php @@ -1,6 +1,8 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Job_Status +class Status { - const STATUS_WAITING = 1; - const STATUS_RUNNING = 2; - const STATUS_FAILED = 3; - const STATUS_COMPLETE = 4; + public const STATUS_WAITING = 1; + public const STATUS_RUNNING = 2; + public const STATUS_FAILED = 3; + public const STATUS_COMPLETE = 4; /** * @var string The ID of the job this status class refers back to. @@ -57,7 +59,7 @@ class Resque_Job_Status 'updated' => time(), 'started' => time(), ]; - Resque::redis()->set('job:' . $id . ':status', json_encode($statusPacket)); + \Resque\Resque::redis()->set('job:' . $id . ':status', json_encode($statusPacket)); } /** @@ -72,7 +74,7 @@ class Resque_Job_Status return false; } - if (!Resque::redis()->exists((string)$this)) { + if (!\Resque\Resque::redis()->exists((string)$this)) { $this->isTracking = false; return false; } @@ -84,7 +86,7 @@ class Resque_Job_Status /** * Update the status indicator for the current job with a new status. * - * @param int The status of the job (see constants in Resque_Job_Status) + * @param int The status of the job (see constants in \Resque\Job\Status) */ public function update($status) { @@ -96,11 +98,11 @@ class Resque_Job_Status 'status' => $status, 'updated' => time(), ]; - Resque::redis()->set((string)$this, json_encode($statusPacket)); + \Resque\Resque::redis()->set((string)$this, json_encode($statusPacket)); // Expire the status for completed jobs after 24 hours if (in_array($status, self::$completeStatuses)) { - Resque::redis()->expire((string)$this, 86400); + \Resque\Resque::redis()->expire((string)$this, 86400); } } @@ -108,7 +110,7 @@ class Resque_Job_Status * Fetch the status for the job being monitored. * * @return mixed False if the status is not being monitored, otherwise the status as - * as an integer, based on the Resque_Job_Status constants. + * as an integer, based on the \Resque\Job\Status constants. */ public function get() { @@ -116,7 +118,7 @@ class Resque_Job_Status return false; } - $statusPacket = json_decode(Resque::redis()->get((string)$this), true); + $statusPacket = json_decode(\Resque\Resque::redis()->get((string)$this), true); if (!$statusPacket) { return false; } @@ -129,7 +131,7 @@ class Resque_Job_Status */ public function stop() { - Resque::redis()->del((string)$this); + \Resque\Resque::redis()->del((string)$this); } /** diff --git a/lib/Resque/Log.php b/src/Resque/Log.php similarity index 84% rename from lib/Resque/Log.php rename to src/Resque/Log.php index 741ab8e..2ac05ce 100644 --- a/lib/Resque/Log.php +++ b/src/Resque/Log.php @@ -1,14 +1,16 @@ + * @package Resque + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Log extends Psr\Log\AbstractLogger +class Log extends \Psr\Log\AbstractLogger { public $logLevel; @@ -28,16 +30,16 @@ class Resque_Log extends Psr\Log\AbstractLogger public function log($level, $message, array $context = []) { $logLevels = [ - "emergency", - "alert", - "critical", - "error", - "warning", - "notice", - "info", - "debug" + "emergency", + "alert", + "critical", + "error", + "warning", + "notice", + "info", + "debug", ]; - + /** * Only log things with a higher level than the current log level. * e.g If set as 'alert' will only alert for 'emergency' and 'alert' logs. diff --git a/lib/Resque/Redis.php b/src/Resque/Redis.php similarity index 88% rename from lib/Resque/Redis.php rename to src/Resque/Redis.php index dc4515a..29830c4 100644 --- a/lib/Resque/Redis.php +++ b/src/Resque/Redis.php @@ -1,18 +1,20 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Redis +class Redis { /** * Redis Client - * @var Credis_Client + * @var \Credis_Client */ private $driver; @@ -25,17 +27,17 @@ class Resque_Redis /** * A default host to connect to */ - const DEFAULT_HOST = 'localhost'; + public const DEFAULT_HOST = 'localhost'; /** * The default Redis port */ - const DEFAULT_PORT = 6379; + public const DEFAULT_PORT = 6379; /** * The default Redis Database number */ - const DEFAULT_DATABASE = 0; + public const DEFAULT_DATABASE = 0; /** * @var array List of all commands in Redis that supply a key as their @@ -116,8 +118,8 @@ class Resque_Redis * @param string|array $server A DSN or array * @param int $database A database number to select. However, if we find a valid database number in the DSN the * DSN-supplied value will be used instead and this parameter is ignored. - * @param object $client Optional Credis_Client instance instantiated by you - * @throws Resque_RedisException + * @param object $client Optional \Credis_Client instance instantiated by you + * @throws \Resque\RedisException */ public function __construct($server, $database = null, $client = null) { @@ -131,7 +133,7 @@ class Resque_Redis $timeout = isset($options['timeout']) ? intval($options['timeout']) : null; $persistent = isset($options['persistent']) ? $options['persistent'] : ''; $maxRetries = isset($options['max_connect_retries']) ? $options['max_connect_retries'] : 0; - $this->driver = new Credis_Client($host, $port, $timeout, $persistent); + $this->driver = new \Credis_Client($host, $port, $timeout, $persistent); $this->driver->setMaxConnectRetries($maxRetries); if ($password) { $this->driver->auth($password); @@ -145,8 +147,8 @@ class Resque_Redis if ($database !== null) { $this->driver->select($database); } - } catch (Exception $e) { - throw new Resque_RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); + } catch (\Exception $e) { + throw new RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); } } @@ -185,7 +187,7 @@ class Resque_Redis // Check the URI scheme $validSchemes = ['redis', 'tcp']; if (isset($parts['scheme']) && !in_array($parts['scheme'], $validSchemes)) { - throw new InvalidArgumentException("Invalid DSN. Supported schemes are " . implode(', ', $validSchemes)); + throw new \InvalidArgumentException("Invalid DSN. Supported schemes are " . implode(', ', $validSchemes)); } // Allow simple 'hostname' format, which `parse_url` treats as a path, not host. @@ -238,7 +240,7 @@ class Resque_Redis { if (in_array($name, $this->keyCommands)) { if (is_array($args[0])) { - foreach ($args[0] AS $i => $v) { + foreach ($args[0] as $i => $v) { $args[0][$i] = self::$defaultNamespace . $v; } } else { @@ -247,8 +249,8 @@ class Resque_Redis } try { return $this->driver->__call($name, $args); - } catch (CredisException $e) { - throw new Resque_RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); + } catch (\CredisException $e) { + throw new RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); } } diff --git a/lib/Resque/RedisException.php b/src/Resque/RedisException.php similarity index 57% rename from lib/Resque/RedisException.php rename to src/Resque/RedisException.php index 0c2294e..b2cad48 100644 --- a/lib/Resque/RedisException.php +++ b/src/Resque/RedisException.php @@ -1,14 +1,16 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_RedisException extends Resque_Exception +class RedisException extends \Exception { } diff --git a/lib/Resque.php b/src/Resque/Resque.php similarity index 91% rename from lib/Resque.php rename to src/Resque/Resque.php index 49770e4..6895061 100644 --- a/lib/Resque.php +++ b/src/Resque/Resque.php @@ -1,18 +1,20 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ class Resque { - const VERSION = '1.4.7'; + public const VERSION = '2.0.0'; - const DEFAULT_INTERVAL = 5; + public const DEFAULT_INTERVAL = 5; /** * @var Resque_Redis Instance of Resque_Redis that talks to redis. @@ -50,9 +52,9 @@ class Resque /** * Return an instance of the Resque_Redis class instantiated for Resque. * - * @return Resque_Redis Instance of Resque_Redis. + * @return \Resque\Redis Instance of Resque_Redis. * - * @throws Resque_RedisException + * @throws \Resque\RedisException */ public static function redis() { @@ -63,7 +65,7 @@ class Resque if (is_callable(self::$redisServer)) { self::$redis = call_user_func(self::$redisServer, self::$redisDatabase); } else { - self::$redis = new Resque_Redis(self::$redisServer, self::$redisDatabase); + self::$redis = new \Resque\Redis(self::$redisServer, self::$redisDatabase); } return self::$redis; @@ -90,7 +92,7 @@ class Resque $pid = pcntl_fork(); if ($pid === -1) { - throw new RuntimeException('Unable to fork child worker.'); + throw new \RuntimeException('Unable to fork child worker.'); } return $pid; @@ -179,7 +181,7 @@ class Resque */ public static function blpop(array $queues, $timeout) { - $list = array(); + $list = []; foreach ($queues as $queue) { $list[] = 'queue:' . $queue; } @@ -228,20 +230,20 @@ class Resque public static function enqueue($queue, $class, $args = null, $trackStatus = false) { $id = Resque::generateJobId(); - $hookParams = array( + $hookParams = [ 'class' => $class, 'args' => $args, 'queue' => $queue, 'id' => $id, - ); + ]; try { - Resque_Event::trigger('beforeEnqueue', $hookParams); - } catch (Resque_Job_DontCreate $e) { + \Resque\Event::trigger('beforeEnqueue', $hookParams); + } catch (\Resque\Job\DontCreate $e) { return false; } - Resque_Job::create($queue, $class, $args, $trackStatus, $id); - Resque_Event::trigger('afterEnqueue', $hookParams); + \Resque\Job\Job::create($queue, $class, $args, $trackStatus, $id); + \Resque\Event::trigger('afterEnqueue', $hookParams); return $id; } @@ -251,11 +253,11 @@ class Resque * * @param string $queue Queue to fetch next available job from. * - * @return false|object|Resque_Job + * @return false|object|\Resque\Job\Job */ public static function reserve($queue) { - return Resque_Job::reserve($queue); + return \Resque\Job\Job::reserve($queue); } /** @@ -347,8 +349,11 @@ class Resque # class name with args , example: item[0] = ['class' => {'foo' => 1, 'bar' => 2}] } elseif (is_array($val)) { $decodedArgs = (array)$decoded['args'][0]; - if ($decoded['class'] == $key && - count($decodedArgs) > 0 && count(array_diff($decodedArgs, $val)) == 0) { + if ( + $decoded['class'] == $key + && count($decodedArgs) > 0 + && count(array_diff($decodedArgs, $val)) == 0 + ) { return true; } # class name with ID, example: item[0] = ['class' => 'id'] @@ -369,7 +374,7 @@ class Resque * @params string $queue the name of the queue * @param $queue * @return integer number of deleted items belongs to this list - * @throws Resque_RedisException + * @throws \Resque\RedisException */ private static function removeList($queue) { diff --git a/lib/Resque/Stat.php b/src/Resque/Stat.php similarity index 94% rename from lib/Resque/Stat.php rename to src/Resque/Stat.php index 0cca826..6d6bd8b 100644 --- a/lib/Resque/Stat.php +++ b/src/Resque/Stat.php @@ -1,14 +1,16 @@ + * @package Resque + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Stat +class Stat { /** * Get the value of the supplied statistic counter for the specified statistic. @@ -55,4 +57,4 @@ class Resque_Stat { return (bool)Resque::redis()->del('stat:' . $stat); } -} \ No newline at end of file +} diff --git a/lib/Resque/Worker.php b/src/Resque/Worker.php similarity index 78% rename from lib/Resque/Worker.php rename to src/Resque/Worker.php index e81015c..bcc68e7 100644 --- a/lib/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -1,17 +1,20 @@ + * @package Resque + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Worker +class Worker { /** * @var LoggerInterface Logging object that impliments the PSR-3 LoggerInterface @@ -44,7 +47,7 @@ class Resque_Worker private $id; /** - * @var Resque_Job Current job, if any, being processed by this worker. + * @var \Resque\Job\Job Current job, if any, being processed by this worker. */ private $currentJob = null; @@ -66,7 +69,7 @@ class Resque_Worker */ public function __construct($queues) { - $this->logger = new Resque_Log(); + $this->logger = new Log(); if (!is_array($queues)) { $queues = [$queues]; @@ -162,8 +165,14 @@ class Resque_Worker $job = false; if (!$this->paused) { if ($blocking === true) { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Starting blocking with timeout of {interval}', ['interval' => $interval]); - $this->updateProcLine('Waiting for ' . implode(',', $this->queues) . ' with blocking timeout ' . $interval); + $this->logger->log( + \Psr\Log\LogLevel::INFO, + 'Starting blocking with timeout of {interval}', + ['interval' => $interval], + ); + $this->updateProcLine( + 'Waiting for ' . implode(',', $this->queues) . ' with blocking timeout ' . $interval + ); } else { $this->updateProcLine('Waiting for ' . implode(',', $this->queues) . ' with interval ' . $interval); } @@ -179,7 +188,12 @@ class Resque_Worker if ($blocking === false) { // If no job was found, we sleep for $interval before continuing and checking again - $this->logger->log(Psr\Log\LogLevel::INFO, 'Sleeping for {interval}', ['interval' => $interval]); + $this->logger->log( + \Psr\Log\LogLevel::INFO, + 'Sleeping for {interval}', + ['interval' => $interval], + ); + if ($this->paused) { $this->updateProcLine('Paused'); } else { @@ -192,8 +206,8 @@ class Resque_Worker continue; } - $this->logger->log(Psr\Log\LogLevel::NOTICE, 'Starting work on {job}', ['job' => $job]); - Resque_Event::trigger('beforeFork', $job); + $this->logger->log(\Psr\Log\LogLevel::NOTICE, 'Starting work on {job}', ['job' => $job]); + Event::trigger('beforeFork', $job); $this->workingOn($job); $this->child = Resque::fork(); @@ -202,7 +216,7 @@ class Resque_Worker if ($this->child === 0 || $this->child === false) { $status = 'Processing ' . $job->queue . ' since ' . strftime('%F %T'); $this->updateProcLine($status); - $this->logger->log(Psr\Log\LogLevel::INFO, $status); + $this->logger->log(\Psr\Log\LogLevel::INFO, $status); /** @noinspection PhpParamsInspection */ $this->perform($job); if ($this->child === 0) { @@ -214,13 +228,13 @@ class Resque_Worker // Parent process, sit and wait $status = 'Forked ' . $this->child . ' at ' . strftime('%F %T'); $this->updateProcLine($status); - $this->logger->log(Psr\Log\LogLevel::INFO, $status); + $this->logger->log(\Psr\Log\LogLevel::INFO, $status); // Wait until the child process finishes before continuing pcntl_wait($status); $exitStatus = pcntl_wexitstatus($status); if ($exitStatus !== 0) { - $job->fail(new Resque_Job_DirtyExitException( + $job->fail(new \Resque\Job\DirtyExitException( 'Job exited with exit code ' . $exitStatus )); } @@ -236,27 +250,27 @@ class Resque_Worker /** * Process a single job. * - * @param Resque_Job $job The job to be processed. + * @param \Resque\Job\Job $job The job to be processed. */ - public function perform(Resque_Job $job) + public function perform(\Resque\Job\Job $job) { try { - Resque_Event::trigger('afterFork', $job); + Event::trigger('afterFork', $job); $job->perform(); - } catch (Exception $e) { - $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', ['job' => $job, 'stack' => $e]); + } catch (\Exception $e) { + $this->logger->log(\Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', ['job' => $job, 'stack' => $e]); $job->fail($e); return; } - $job->updateStatus(Resque_Job_Status::STATUS_COMPLETE); - $this->logger->log(Psr\Log\LogLevel::NOTICE, '{job} has finished', ['job' => $job]); + $job->updateStatus(\Resque\Job\Status::STATUS_COMPLETE); + $this->logger->log(\Psr\Log\LogLevel::NOTICE, '{job} has finished', ['job' => $job]); } /** * @param bool $blocking * @param int $timeout - * @return object|boolean Instance of Resque_Job if a job is found, false if not. + * @return object|boolean Instance of \Resque\Job\Job if a job is found, false if not. */ public function reserve($blocking = false, $timeout = null) { @@ -266,17 +280,17 @@ class Resque_Worker } if ($blocking === true) { - $job = Resque_Job::reserveBlocking($queues, $timeout); + $job = \Resque\Job\Job::reserveBlocking($queues, $timeout); if ($job) { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Found job on {queue}', ['queue' => $job->queue]); + $this->logger->log(\Psr\Log\LogLevel::INFO, 'Found job on {queue}', ['queue' => $job->queue]); return $job; } } else { foreach ($queues as $queue) { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Checking {queue} for jobs', ['queue' => $queue]); - $job = Resque_Job::reserve($queue); + $this->logger->log(\Psr\Log\LogLevel::INFO, 'Checking {queue} for jobs', ['queue' => $queue]); + $job = \Resque\Job\Job::reserve($queue); if ($job) { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Found job on {queue}', ['queue' => $job->queue]); + $this->logger->log(\Psr\Log\LogLevel::INFO, 'Found job on {queue}', ['queue' => $job->queue]); return $job; } } @@ -314,7 +328,7 @@ class Resque_Worker { $this->registerSigHandlers(); $this->pruneDeadWorkers(); - Resque_Event::trigger('beforeFirstFork', $this); + Event::trigger('beforeFirstFork', $this); $this->registerWorker(); } @@ -330,7 +344,7 @@ class Resque_Worker $processTitle = 'resque-' . Resque::VERSION . ': ' . $status; if (function_exists('cli_set_process_title') && PHP_OS !== 'Darwin') { cli_set_process_title($processTitle); - } else if (function_exists('setproctitle')) { + } elseif (function_exists('setproctitle')) { setproctitle($processTitle); } } @@ -355,7 +369,7 @@ class Resque_Worker pcntl_signal(SIGUSR1, [$this, 'killChild']); pcntl_signal(SIGUSR2, [$this, 'pauseProcessing']); pcntl_signal(SIGCONT, [$this, 'unPauseProcessing']); - $this->logger->log(Psr\Log\LogLevel::DEBUG, 'Registered signals'); + $this->logger->log(\Psr\Log\LogLevel::DEBUG, 'Registered signals'); } /** @@ -363,7 +377,7 @@ class Resque_Worker */ public function pauseProcessing() { - $this->logger->log(Psr\Log\LogLevel::NOTICE, 'USR2 received; pausing job processing'); + $this->logger->log(\Psr\Log\LogLevel::NOTICE, 'USR2 received; pausing job processing'); $this->paused = true; } @@ -373,7 +387,7 @@ class Resque_Worker */ public function unPauseProcessing() { - $this->logger->log(Psr\Log\LogLevel::NOTICE, 'CONT received; resuming job processing'); + $this->logger->log(\Psr\Log\LogLevel::NOTICE, 'CONT received; resuming job processing'); $this->paused = false; } @@ -384,7 +398,7 @@ class Resque_Worker public function shutdown() { $this->shutdown = true; - $this->logger->log(Psr\Log\LogLevel::NOTICE, 'Shutting down'); + $this->logger->log(\Psr\Log\LogLevel::NOTICE, 'Shutting down'); } /** @@ -404,17 +418,21 @@ class Resque_Worker public function killChild() { if (!$this->child) { - $this->logger->log(Psr\Log\LogLevel::DEBUG, 'No child to kill.'); + $this->logger->log(\Psr\Log\LogLevel::DEBUG, 'No child to kill.'); return; } - $this->logger->log(Psr\Log\LogLevel::INFO, 'Killing child at {child}', ['child' => $this->child]); + $this->logger->log(\Psr\Log\LogLevel::INFO, 'Killing child at {child}', ['child' => $this->child]); if (exec('ps -o pid,state -p ' . $this->child, $output, $returnCode) && $returnCode != 1) { - $this->logger->log(Psr\Log\LogLevel::DEBUG, 'Child {child} found, killing.', ['child' => $this->child]); + $this->logger->log(\Psr\Log\LogLevel::DEBUG, 'Child {child} found, killing.', ['child' => $this->child]); posix_kill($this->child, SIGKILL); $this->child = null; } else { - $this->logger->log(Psr\Log\LogLevel::INFO, 'Child {child} not found, restarting.', ['child' => $this->child]); + $this->logger->log( + \Psr\Log\LogLevel::INFO, + 'Child {child} not found, restarting.', + ['child' => $this->child], + ); $this->shutdown(); } } @@ -437,7 +455,11 @@ class Resque_Worker if ($host != $this->hostname || in_array($pid, $workerPids) || $pid == getmypid()) { continue; } - $this->logger->log(Psr\Log\LogLevel::INFO, 'Pruning dead worker: {worker}', ['worker' => (string)$worker]); + $this->logger->log( + \Psr\Log\LogLevel::INFO, + 'Pruning dead worker: {worker}', + ['worker' => (string)$worker], + ); $worker->unregisterWorker(); } } @@ -475,28 +497,28 @@ class Resque_Worker public function unregisterWorker() { if (is_object($this->currentJob)) { - $this->currentJob->fail(new Resque_Job_DirtyExitException); + $this->currentJob->fail(new \Resque\Job\DirtyExitException()); } $id = (string)$this; Resque::redis()->srem('workers', $id); Resque::redis()->del('worker:' . $id); Resque::redis()->del('worker:' . $id . ':started'); - Resque_Stat::clear('processed:' . $id); - Resque_Stat::clear('failed:' . $id); + Stat::clear('processed:' . $id); + Stat::clear('failed:' . $id); } /** * Tell Redis which job we're currently working on. * - * @param Resque_Job $job Resque_Job instance containing the job we're working on. + * @param \Resque\Job\Job $job \Resque\Job\Job instance containing the job we're working on. * @throws Resque_RedisException */ - public function workingOn(Resque_Job $job) + public function workingOn(\Resque\Job\Job $job) { $job->worker = $this; $this->currentJob = $job; - $job->updateStatus(Resque_Job_Status::STATUS_RUNNING); + $job->updateStatus(\Resque\Job\Status::STATUS_RUNNING); $data = json_encode([ 'queue' => $job->queue, 'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'), @@ -512,8 +534,8 @@ class Resque_Worker public function doneWorking() { $this->currentJob = null; - Resque_Stat::incr('processed'); - Resque_Stat::incr('processed:' . (string)$this); + Stat::incr('processed'); + Stat::incr('processed:' . (string)$this); Resque::redis()->del('worker:' . (string)$this); } @@ -546,15 +568,15 @@ class Resque_Worker */ public function getStat($stat) { - return Resque_Stat::get($stat . ':' . $this); + return \Resque\Stat::get($stat . ':' . $this); } /** * Inject the logging object into the worker * - * @param Psr\Log\LoggerInterface $logger + * @param \Psr\Log\LoggerInterface $logger */ - public function setLogger(Psr\Log\LoggerInterface $logger) + public function setLogger(\Psr\Log\LoggerInterface $logger) { $this->logger = $logger; } diff --git a/test/Resque/Tests/JobStatusTest.php b/test/Resque/Tests/JobStatusTest.php deleted file mode 100644 index 3cb0ca8..0000000 --- a/test/Resque/Tests/JobStatusTest.php +++ /dev/null @@ -1,109 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.php - */ - -class Resque_Tests_JobStatusTest extends Resque_Tests_TestCase -{ - /** - * @var Resque_Worker - */ - protected $worker; - - public function setUp(): void - { - parent::setUp(); - - // Register a worker to test with - $this->worker = new Resque_Worker('jobs'); - $this->worker->setLogger(new Resque_Log()); - } - - public function testJobStatusCanBeTracked() - { - $token = Resque::enqueue('jobs', 'Test_Job', null, true); - $status = new Resque_Job_Status($token); - $this->assertTrue($status->isTracking()); - } - - public function testJobStatusIsReturnedViaJobInstance() - { - Resque::enqueue('jobs', 'Test_Job', null, true); - $job = Resque_Job::reserve('jobs'); - $this->assertEquals(Resque_Job_Status::STATUS_WAITING, $job->getStatus()); - - } - - public function testQueuedJobReturnsQueuedStatus() - { - $token = Resque::enqueue('jobs', 'Test_Job', null, true); - $status = new Resque_Job_Status($token); - $this->assertEquals(Resque_Job_Status::STATUS_WAITING, $status->get()); - } - - public function testRunningJobReturnsRunningStatus() - { - $token = Resque::enqueue('jobs', 'Failing_Job', null, true); - $job = $this->worker->reserve(); - $this->worker->workingOn($job); - $status = new Resque_Job_Status($token); - $this->assertEquals(Resque_Job_Status::STATUS_RUNNING, $status->get()); - } - - public function testFailedJobReturnsFailedStatus() - { - $token = Resque::enqueue('jobs', 'Failing_Job', null, true); - $this->worker->work(0); - $status = new Resque_Job_Status($token); - $this->assertEquals(Resque_Job_Status::STATUS_FAILED, $status->get()); - } - - public function testCompletedJobReturnsCompletedStatus() - { - $token = Resque::enqueue('jobs', 'Test_Job', null, true); - $this->worker->work(0); - $status = new Resque_Job_Status($token); - $this->assertEquals(Resque_Job_Status::STATUS_COMPLETE, $status->get()); - } - - public function testStatusIsNotTrackedWhenToldNotTo() - { - $token = Resque::enqueue('jobs', 'Test_Job', null, false); - $status = new Resque_Job_Status($token); - $this->assertFalse($status->isTracking()); - } - - public function testStatusTrackingCanBeStopped() - { - Resque_Job_Status::create('test'); - $status = new Resque_Job_Status('test'); - $this->assertEquals(Resque_Job_Status::STATUS_WAITING, $status->get()); - $status->stop(); - $this->assertFalse($status->get()); - } - - public function testRecreatedJobWithTrackingStillTracksStatus() - { - $originalToken = Resque::enqueue('jobs', 'Test_Job', null, true); - $job = $this->worker->reserve(); - - // Mark this job as being worked on to ensure that the new status is still - // waiting. - $this->worker->workingOn($job); - - // Now recreate it - $newToken = $job->recreate(); - - // Make sure we've got a new job returned - $this->assertNotEquals($originalToken, $newToken); - - // Now check the status of the new job - $newJob = Resque_Job::reserve('jobs'); - $this->assertEquals(Resque_Job_Status::STATUS_WAITING, $newJob->getStatus()); - } -} \ No newline at end of file diff --git a/test/Resque/Tests/JobTest.php b/test/Resque/Tests/JobTest.php deleted file mode 100644 index 67865f8..0000000 --- a/test/Resque/Tests/JobTest.php +++ /dev/null @@ -1,421 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.php - */ - -class Resque_Tests_JobTest extends Resque_Tests_TestCase -{ - protected $worker; - - public function setUp(): void - { - parent::setUp(); - - // Register a worker to test with - $this->worker = new Resque_Worker('jobs'); - $this->worker->setLogger(new Resque_Log()); - $this->worker->registerWorker(); - } - - public function testJobCanBeQueued() - { - $this->assertTrue((bool)Resque::enqueue('jobs', 'Test_Job')); - } - - public function testQeueuedJobCanBeReserved() - { - Resque::enqueue('jobs', 'Test_Job'); - - $job = Resque_Job::reserve('jobs'); - if ($job == false) { - $this->fail('Job could not be reserved.'); - } - $this->assertEquals('jobs', $job->queue); - $this->assertEquals('Test_Job', $job->payload['class']); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testObjectArgumentsCannotBePassedToJob() - { - $this->expectException(InvalidArgumentException::class); - - $args = new stdClass(); - $args->test = 'somevalue'; - Resque::enqueue('jobs', 'Test_Job', $args); - } - - public function testQueuedJobReturnsExactSamePassedInArguments() - { - $args = [ - 'int' => 123, - 'numArray' => [ - 1, - 2, - ], - 'assocArray' => [ - 'key1' => 'value1', - 'key2' => 'value2' - ], - ]; - Resque::enqueue('jobs', 'Test_Job', $args); - $job = Resque_Job::reserve('jobs'); - - $this->assertEquals($args, $job->getArguments()); - } - - public function testAfterJobIsReservedItIsRemoved() - { - Resque::enqueue('jobs', 'Test_Job'); - Resque_Job::reserve('jobs'); - $this->assertFalse(Resque_Job::reserve('jobs')); - } - - public function testRecreatedJobMatchesExistingJob() - { - $args = [ - 'int' => 123, - 'numArray' => [ - 1, - 2, - ], - 'assocArray' => [ - 'key1' => 'value1', - 'key2' => 'value2' - ], - ]; - - Resque::enqueue('jobs', 'Test_Job', $args); - $job = Resque_Job::reserve('jobs'); - - // Now recreate it - $job->recreate(); - - $newJob = Resque_Job::reserve('jobs'); - $this->assertEquals($job->payload['class'], $newJob->payload['class']); - $this->assertEquals($job->getArguments(), $newJob->getArguments()); - } - - - public function testFailedJobExceptionsAreCaught() - { - $payload = [ - 'class' => 'Failing_Job', - 'args' => null - ]; - $job = new Resque_Job('jobs', $payload); - $job->worker = $this->worker; - - $this->worker->perform($job); - - $this->assertEquals(1, Resque_Stat::get('failed')); - $this->assertEquals(1, Resque_Stat::get('failed:' . $this->worker)); - } - - /** - * @expectedException Resque_Exception - */ - public function testJobWithoutPerformMethodThrowsException() - { - $this->expectException(Resque_Exception::class); - Resque::enqueue('jobs', 'Test_Job_Without_Perform_Method'); - $job = $this->worker->reserve(); - $job->worker = $this->worker; - $job->perform(); - } - - /** - * @expectedException Resque_Exception - */ - public function testInvalidJobThrowsException() - { - $this->expectException(Resque_Exception::class); - Resque::enqueue('jobs', 'Invalid_Job'); - $job = $this->worker->reserve(); - $job->worker = $this->worker; - $job->perform(); - } - - public function testJobWithSetUpCallbackFiresSetUp() - { - $payload = [ - 'class' => 'Test_Job_With_SetUp', - 'args' => [ - 'somevar', - 'somevar2', - ], - ]; - $job = new Resque_Job('jobs', $payload); - $job->perform(); - - $this->assertTrue(Test_Job_With_SetUp::$called); - } - - public function testJobWithTearDownCallbackFiresTearDown() - { - $payload = [ - 'class' => 'Test_Job_With_TearDown', - 'args' => [ - 'somevar', - 'somevar2', - ], - ]; - $job = new Resque_Job('jobs', $payload); - $job->perform(); - - $this->assertTrue(Test_Job_With_TearDown::$called); - } - - public function testNamespaceNaming() - { - $fixture = [ - ['test' => 'more:than:one:with:', 'assertValue' => 'more:than:one:with:'], - ['test' => 'more:than:one:without', 'assertValue' => 'more:than:one:without:'], - ['test' => 'resque', 'assertValue' => 'resque:'], - ['test' => 'resque:', 'assertValue' => 'resque:'], - ]; - - foreach ($fixture as $item) { - Resque_Redis::prefix($item['test']); - $this->assertEquals(Resque_Redis::getPrefix(), $item['assertValue']); - } - } - - public function testJobWithNamespace() - { - Resque_Redis::prefix('php'); - $queue = 'jobs'; - $payload = ['another_value']; - Resque::enqueue($queue, 'Test_Job_With_TearDown', $payload); - - $this->assertEquals(Resque::queues(), ['jobs']); - $this->assertEquals(Resque::size($queue), 1); - - Resque_Redis::prefix('resque'); - $this->assertEquals(Resque::size($queue), 0); - } - - public function testDequeueAll() - { - $queue = 'jobs'; - Resque::enqueue($queue, 'Test_Job_Dequeue'); - Resque::enqueue($queue, 'Test_Job_Dequeue'); - $this->assertEquals(Resque::size($queue), 2); - $this->assertEquals(Resque::dequeue($queue), 2); - $this->assertEquals(Resque::size($queue), 0); - } - - public function testDequeueMakeSureNotDeleteOthers() - { - $queue = 'jobs'; - Resque::enqueue($queue, 'Test_Job_Dequeue'); - Resque::enqueue($queue, 'Test_Job_Dequeue'); - $other_queue = 'other_jobs'; - Resque::enqueue($other_queue, 'Test_Job_Dequeue'); - Resque::enqueue($other_queue, 'Test_Job_Dequeue'); - $this->assertEquals(Resque::size($queue), 2); - $this->assertEquals(Resque::size($other_queue), 2); - $this->assertEquals(Resque::dequeue($queue), 2); - $this->assertEquals(Resque::size($queue), 0); - $this->assertEquals(Resque::size($other_queue), 2); - } - - public function testDequeueSpecificItem() - { - $queue = 'jobs'; - Resque::enqueue($queue, 'Test_Job_Dequeue1'); - Resque::enqueue($queue, 'Test_Job_Dequeue2'); - $this->assertEquals(Resque::size($queue), 2); - $test = ['Test_Job_Dequeue2']; - $this->assertEquals(Resque::dequeue($queue, $test), 1); - $this->assertEquals(Resque::size($queue), 1); - } - - public function testDequeueSpecificMultipleItems() - { - $queue = 'jobs'; - Resque::enqueue($queue, 'Test_Job_Dequeue1'); - Resque::enqueue($queue, 'Test_Job_Dequeue2'); - Resque::enqueue($queue, 'Test_Job_Dequeue3'); - $this->assertEquals(Resque::size($queue), 3); - $test = ['Test_Job_Dequeue2', 'Test_Job_Dequeue3']; - $this->assertEquals(Resque::dequeue($queue, $test), 2); - $this->assertEquals(Resque::size($queue), 1); - } - - public function testDequeueNonExistingItem() - { - $queue = 'jobs'; - Resque::enqueue($queue, 'Test_Job_Dequeue1'); - Resque::enqueue($queue, 'Test_Job_Dequeue2'); - Resque::enqueue($queue, 'Test_Job_Dequeue3'); - $this->assertEquals(Resque::size($queue), 3); - $test = ['Test_Job_Dequeue4']; - $this->assertEquals(Resque::dequeue($queue, $test), 0); - $this->assertEquals(Resque::size($queue), 3); - } - - public function testDequeueNonExistingItem2() - { - $queue = 'jobs'; - Resque::enqueue($queue, 'Test_Job_Dequeue1'); - Resque::enqueue($queue, 'Test_Job_Dequeue2'); - Resque::enqueue($queue, 'Test_Job_Dequeue3'); - $this->assertEquals(Resque::size($queue), 3); - $test = ['Test_Job_Dequeue4', 'Test_Job_Dequeue1']; - $this->assertEquals(Resque::dequeue($queue, $test), 1); - $this->assertEquals(Resque::size($queue), 2); - } - - public function testDequeueItemID() - { - $queue = 'jobs'; - Resque::enqueue($queue, 'Test_Job_Dequeue'); - $qid = Resque::enqueue($queue, 'Test_Job_Dequeue'); - $this->assertEquals(Resque::size($queue), 2); - $test = ['Test_Job_Dequeue' => $qid]; - $this->assertEquals(Resque::dequeue($queue, $test), 1); - $this->assertEquals(Resque::size($queue), 1); - } - - public function testDequeueWrongItemID() - { - $queue = 'jobs'; - Resque::enqueue($queue, 'Test_Job_Dequeue'); - $qid = Resque::enqueue($queue, 'Test_Job_Dequeue'); - $this->assertEquals(Resque::size($queue), 2); - #qid right but class name is wrong - $test = ['Test_Job_Dequeue1' => $qid]; - $this->assertEquals(Resque::dequeue($queue, $test), 0); - $this->assertEquals(Resque::size($queue), 2); - } - - public function testDequeueWrongItemID2() - { - $queue = 'jobs'; - Resque::enqueue($queue, 'Test_Job_Dequeue'); - Resque::enqueue($queue, 'Test_Job_Dequeue'); - $this->assertEquals(Resque::size($queue), 2); - $test = ['Test_Job_Dequeue' => 'r4nD0mH4sh3dId']; - $this->assertEquals(Resque::dequeue($queue, $test), 0); - $this->assertEquals(Resque::size($queue), 2); - } - - public function testDequeueItemWithArg() - { - $queue = 'jobs'; - $arg = ['foo' => 1, 'bar' => 2]; - Resque::enqueue($queue, 'Test_Job_Dequeue9'); - Resque::enqueue($queue, 'Test_Job_Dequeue9', $arg); - $this->assertEquals(Resque::size($queue), 2); - $test = ['Test_Job_Dequeue9' => $arg]; - $this->assertEquals(Resque::dequeue($queue, $test), 1); - #$this->assertEquals(Resque::size($queue), 1); - } - - public function testDequeueSeveralItemsWithArgs() - { - // GIVEN - $queue = 'jobs'; - $args = ['foo' => 1, 'bar' => 10]; - $removeArgs = ['foo' => 1, 'bar' => 2]; - Resque::enqueue($queue, 'Test_Job_Dequeue9', $args); - Resque::enqueue($queue, 'Test_Job_Dequeue9', $removeArgs); - Resque::enqueue($queue, 'Test_Job_Dequeue9', $removeArgs); - $this->assertEquals(Resque::size($queue), 3, "Failed to add 3 items."); - - // WHEN - $test = ['Test_Job_Dequeue9' => $removeArgs]; - $removedItems = Resque::dequeue($queue, $test); - - // THEN - $this->assertEquals($removedItems, 2); - $this->assertEquals(Resque::size($queue), 1); - $item = Resque::pop($queue); - $this->assertIsArray($item['args']); - $this->assertEquals(10, $item['args'][0]['bar'], 'Wrong items were dequeued from queue!'); - } - - public function testDequeueItemWithUnorderedArg() - { - $queue = 'jobs'; - $arg = ['foo' => 1, 'bar' => 2]; - $arg2 = ['bar' => 2, 'foo' => 1]; - Resque::enqueue($queue, 'Test_Job_Dequeue'); - Resque::enqueue($queue, 'Test_Job_Dequeue', $arg); - $this->assertEquals(Resque::size($queue), 2); - $test = ['Test_Job_Dequeue' => $arg2]; - $this->assertEquals(Resque::dequeue($queue, $test), 1); - $this->assertEquals(Resque::size($queue), 1); - } - - public function testDequeueItemWithiWrongArg() - { - $queue = 'jobs'; - $arg = ['foo' => 1, 'bar' => 2]; - $arg2 = ['foo' => 2, 'bar' => 3]; - Resque::enqueue($queue, 'Test_Job_Dequeue'); - Resque::enqueue($queue, 'Test_Job_Dequeue', $arg); - $this->assertEquals(Resque::size($queue), 2); - $test = ['Test_Job_Dequeue' => $arg2]; - $this->assertEquals(Resque::dequeue($queue, $test), 0); - $this->assertEquals(Resque::size($queue), 2); - } - - public function testUseDefaultFactoryToGetJobInstance() - { - $payload = [ - 'class' => 'Some_Job_Class', - 'args' => null - ]; - $job = new Resque_Job('jobs', $payload); - $instance = $job->getInstance(); - $this->assertInstanceOf('Some_Job_Class', $instance); - } - - public function testUseFactoryToGetJobInstance() - { - $payload = [ - 'class' => 'Some_Job_Class', - 'args' => [[]] - ]; - $job = new Resque_Job('jobs', $payload); - $factory = new Some_Stub_Factory(); - $job->setJobFactory($factory); - $instance = $job->getInstance(); - $this->assertInstanceOf('Resque_JobInterface', $instance); - } -} - -class Some_Job_Class implements Resque_JobInterface -{ - - /** - * @return bool - */ - public function perform() - { - return true; - } -} - -class Some_Stub_Factory implements Resque_Job_FactoryInterface -{ - - /** - * @param $className - * @param array $args - * @param $queue - * @return Resque_JobInterface - */ - public function create($className, $args, $queue) - { - return new Some_Job_Class(); - } -} diff --git a/test/Resque/Tests/EventTest.php b/tests/Resque/Tests/EventTest.php similarity index 74% rename from test/Resque/Tests/EventTest.php rename to tests/Resque/Tests/EventTest.php index 2bb4f40..9e9346f 100644 --- a/test/Resque/Tests/EventTest.php +++ b/tests/Resque/Tests/EventTest.php @@ -1,43 +1,45 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Tests_EventTest extends Resque_Tests_TestCase +class EventTest extends TestCase { private $callbacksHit = []; private $worker; public function setUp(): void { - Test_Job::$called = false; + TestJob::$called = false; // Register a worker to test with - $this->worker = new Resque_Worker('jobs'); - $this->worker->setLogger(new Resque_Log()); + $this->worker = new \Resque\Worker('jobs'); + $this->worker->setLogger(new \Resque\Log()); $this->worker->registerWorker(); } public function tearDown(): void { - Resque_Event::clearListeners(); + \Resque\Event::clearListeners(); $this->callbacksHit = []; } public function getEventTestJob() { $payload = [ - 'class' => 'Test_Job', + 'class' => '\Resque\Test\TestJob', 'args' => [ ['somevar'], ], ]; - $job = new Resque_Job('jobs', $payload); + $job = new \Resque\Job\Job('jobs', $payload); $job->worker = $this->worker; return $job; } @@ -58,7 +60,7 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase */ public function testEventCallbacksFire($event, $callback) { - Resque_Event::listen($event, [$this, $callback]); + \Resque\Event::listen($event, [$this, $callback]); $job = $this->getEventTestJob(); $this->worker->perform($job); @@ -72,8 +74,8 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase $event = 'beforeFork'; $callback = 'beforeForkEventCallback'; - Resque_Event::listen($event, [$this, $callback]); - Resque::enqueue('jobs', 'Test_Job', [ + \Resque\Event::listen($event, [$this, $callback]); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', [ 'somevar' ]); $this->getEventTestJob(); @@ -86,8 +88,8 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase $event = 'beforeEnqueue'; $callback = 'beforeEnqueueEventCallback'; - Resque_Event::listen($event, [$this, $callback]); - Resque::enqueue('jobs', 'Test_Job', [ + \Resque\Event::listen($event, [$this, $callback]); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', [ 'somevar' ]); $this->assertContains($callback, $this->callbacksHit, $event . ' callback (' . $callback . ') was not called'); @@ -96,22 +98,22 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase public function testBeforePerformEventCanStopWork() { $callback = 'beforePerformEventDontPerformCallback'; - Resque_Event::listen('beforePerform', [$this, $callback]); + \Resque\Event::listen('beforePerform', [$this, $callback]); $job = $this->getEventTestJob(); $this->assertFalse($job->perform()); $this->assertContains($callback, $this->callbacksHit, $callback . ' callback was not called'); - $this->assertFalse(Test_Job::$called, 'Job was still performed though Resque_Job_DontPerform was thrown'); + $this->assertFalse(TestJob::$called, 'Job was still performed though Resque_Job_DontPerform was thrown'); } public function testBeforeEnqueueEventStopsJobCreation() { $callback = 'beforeEnqueueEventDontCreateCallback'; - Resque_Event::listen('beforeEnqueue', [$this, $callback]); - Resque_Event::listen('afterEnqueue', [$this, 'afterEnqueueEventCallback']); + \Resque\Event::listen('beforeEnqueue', [$this, $callback]); + \Resque\Event::listen('afterEnqueue', [$this, 'afterEnqueueEventCallback']); - $result = Resque::enqueue('test_job', 'TestClass'); + $result = \Resque\Resque::enqueue('jobs', '\Resque\Test\TestClass'); $this->assertContains($callback, $this->callbacksHit, $callback . ' callback was not called'); $this->assertNotContains('afterEnqueueEventCallback', $this->callbacksHit, 'afterEnqueue was still called, even though it should not have been'); $this->assertFalse($result); @@ -122,8 +124,8 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase $callback = 'afterEnqueueEventCallback'; $event = 'afterEnqueue'; - Resque_Event::listen($event, [$this, $callback]); - Resque::enqueue('jobs', 'Test_Job', [ + \Resque\Event::listen($event, [$this, $callback]); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', [ 'somevar' ]); $this->assertContains($callback, $this->callbacksHit, $event . ' callback (' . $callback . ') was not called'); @@ -134,8 +136,8 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase $callback = 'beforePerformEventCallback'; $event = 'beforePerform'; - Resque_Event::listen($event, [$this, $callback]); - Resque_Event::stopListening($event, [$this, $callback]); + \Resque\Event::listen($event, [$this, $callback]); + \Resque\Event::stopListening($event, [$this, $callback]); $job = $this->getEventTestJob(); $this->worker->perform($job); @@ -149,20 +151,20 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase public function beforePerformEventDontPerformCallback() { $this->callbacksHit[] = __FUNCTION__; - throw new Resque_Job_DontPerform(); + throw new \Resque\Job\DontPerform(); } public function beforeEnqueueEventDontCreateCallback() { $this->callbacksHit[] = __FUNCTION__; - throw new Resque_Job_DontCreate(); + throw new \Resque\Job\DontCreate(); } public function assertValidEventCallback($function, $job) { $this->callbacksHit[] = $function; - if (!$job instanceof Resque_Job) { - $this->fail('Callback job argument is not an instance of Resque_Job'); + if (!$job instanceof \Resque\Job\Job) { + $this->fail('Callback job argument is not an instance of \Resque\Job\Job'); } $args = $job->getArguments(); $this->assertEquals($args[0], 'somevar'); @@ -171,7 +173,7 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase public function afterEnqueueEventCallback($class, $args) { $this->callbacksHit[] = __FUNCTION__; - $this->assertEquals('Test_Job', $class); + $this->assertEquals('\Resque\Test\TestJob', $class); $this->assertEquals([ 'somevar', ], $args); diff --git a/tests/Resque/Tests/JobStatusTest.php b/tests/Resque/Tests/JobStatusTest.php new file mode 100644 index 0000000..a7185cc --- /dev/null +++ b/tests/Resque/Tests/JobStatusTest.php @@ -0,0 +1,110 @@ + + * @license http://www.opensource.org/licenses/mit-license.php + */ + +class JobStatusTest extends TestCase +{ + /** + * @var \Resque\Worker + */ + protected $worker; + + public function setUp(): void + { + parent::setUp(); + + // Register a worker to test with + $this->worker = new \Resque\Worker('jobs'); + $this->worker->setLogger(new \Resque\Log()); + } + + public function testJobStatusCanBeTracked() + { + $token = \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', null, true); + $status = new \Resque\Job\Status($token); + $this->assertTrue($status->isTracking()); + } + + public function testJobStatusIsReturnedViaJobInstance() + { + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', null, true); + $job = \Resque\Job\Job::reserve('jobs'); + $this->assertEquals(\Resque\Job\Status::STATUS_WAITING, $job->getStatus()); + } + + public function testQueuedJobReturnsQueuedStatus() + { + $token = \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', null, true); + $status = new \Resque\Job\Status($token); + $this->assertEquals(\Resque\Job\Status::STATUS_WAITING, $status->get()); + } + + public function testRunningJobReturnsRunningStatus() + { + $token = \Resque\Resque::enqueue('jobs', '\Resque\Test\FailingJob', null, true); + $job = $this->worker->reserve(); + $this->worker->workingOn($job); + $status = new \Resque\Job\Status($token); + $this->assertEquals(\Resque\Job\Status::STATUS_RUNNING, $status->get()); + } + + public function testFailedJobReturnsFailedStatus() + { + $token = \Resque\Resque::enqueue('jobs', '\Resque\Test\FailingJob', null, true); + $this->worker->work(0); + $status = new \Resque\Job\Status($token); + $this->assertEquals(\Resque\Job\Status::STATUS_FAILED, $status->get()); + } + + public function testCompletedJobReturnsCompletedStatus() + { + $token = \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', null, true); + $this->worker->work(0); + $status = new \Resque\Job\Status($token); + $this->assertEquals(\Resque\Job\Status::STATUS_COMPLETE, $status->get()); + } + + public function testStatusIsNotTrackedWhenToldNotTo() + { + $token = \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', null, false); + $status = new \Resque\Job\Status($token); + $this->assertFalse($status->isTracking()); + } + + public function testStatusTrackingCanBeStopped() + { + \Resque\Job\Status::create('test'); + $status = new \Resque\Job\Status('test'); + $this->assertEquals(\Resque\Job\Status::STATUS_WAITING, $status->get()); + $status->stop(); + $this->assertFalse($status->get()); + } + + public function testRecreatedJobWithTrackingStillTracksStatus() + { + $originalToken = \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', null, true); + $job = $this->worker->reserve(); + + // Mark this job as being worked on to ensure that the new status is still + // waiting. + $this->worker->workingOn($job); + + // Now recreate it + $newToken = $job->recreate(); + + // Make sure we've got a new job returned + $this->assertNotEquals($originalToken, $newToken); + + // Now check the status of the new job + $newJob = \Resque\Job\Job::reserve('jobs'); + $this->assertEquals(\Resque\Job\Status::STATUS_WAITING, $newJob->getStatus()); + } +} \ No newline at end of file diff --git a/tests/Resque/Tests/JobTest.php b/tests/Resque/Tests/JobTest.php new file mode 100644 index 0000000..148b82c --- /dev/null +++ b/tests/Resque/Tests/JobTest.php @@ -0,0 +1,423 @@ + + * @license http://www.opensource.org/licenses/mit-license.php + */ + +class JobTest extends TestCase +{ + protected $worker; + + public function setUp(): void + { + parent::setUp(); + + // Register a worker to test with + $this->worker = new \Resque\Worker('jobs'); + $this->worker->setLogger(new \Resque\Log()); + $this->worker->registerWorker(); + } + + public function testJobCanBeQueued() + { + $this->assertTrue((bool)\Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob')); + } + + public function testQeueuedJobCanBeReserved() + { + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob'); + + $job = \Resque\Job\Job::reserve('jobs'); + if ($job == false) { + $this->fail('Job could not be reserved.'); + } + $this->assertEquals('jobs', $job->queue); + $this->assertEquals('\Resque\Test\TestJob', $job->payload['class']); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testObjectArgumentsCannotBePassedToJob() + { + $this->expectException(\InvalidArgumentException::class); + + $args = new \stdClass(); + $args->test = 'somevalue'; + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', $args); + } + + public function testQueuedJobReturnsExactSamePassedInArguments() + { + $args = [ + 'int' => 123, + 'numArray' => [ + 1, + 2, + ], + 'assocArray' => [ + 'key1' => 'value1', + 'key2' => 'value2' + ], + ]; + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', $args); + $job = \Resque\Job\Job::reserve('jobs'); + + $this->assertEquals($args, $job->getArguments()); + } + + public function testAfterJobIsReservedItIsRemoved() + { + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob'); + \Resque\Job\Job::reserve('jobs'); + $this->assertFalse(\Resque\Job\Job::reserve('jobs')); + } + + public function testRecreatedJobMatchesExistingJob() + { + $args = [ + 'int' => 123, + 'numArray' => [ + 1, + 2, + ], + 'assocArray' => [ + 'key1' => 'value1', + 'key2' => 'value2' + ], + ]; + + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob', $args); + $job = \Resque\Job\Job::reserve('jobs'); + + // Now recreate it + $job->recreate(); + + $newJob = \Resque\Job\Job::reserve('jobs'); + $this->assertEquals($job->payload['class'], $newJob->payload['class']); + $this->assertEquals($job->getArguments(), $newJob->getArguments()); + } + + + public function testFailedJobExceptionsAreCaught() + { + $payload = [ + 'class' => '\Resque\Test\FailingJob', + 'args' => null + ]; + $job = new \Resque\Job\Job('jobs', $payload); + $job->worker = $this->worker; + + $this->worker->perform($job); + + $this->assertEquals(1, \Resque\Stat::get('failed')); + $this->assertEquals(1, \Resque\Stat::get('failed:' . $this->worker)); + } + + /** + * @expectedException \Resque\Exception + */ + public function testJobWithoutPerformMethodThrowsException() + { + $this->expectException(\Resque\Exception::class); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob_Without_Perform_Method'); + $job = $this->worker->reserve(); + $job->worker = $this->worker; + $job->perform(); + } + + /** + * @expectedException \Resque\Exception + */ + public function testInvalidJobThrowsException() + { + $this->expectException(\Resque\Exception::class); + \Resque\Resque::enqueue('jobs', '\Resque\Test\InvalidJob'); + $job = $this->worker->reserve(); + $job->worker = $this->worker; + $job->perform(); + } + + public function testJobWithSetUpCallbackFiresSetUp() + { + $payload = [ + 'class' => '\Resque\Test\TestJobWithSetUp', + 'args' => [ + 'somevar', + 'somevar2', + ], + ]; + $job = new \Resque\Job\Job('jobs', $payload); + $job->perform(); + + $this->assertTrue(TestJobWithSetUp::$called); + } + + public function testJobWithTearDownCallbackFiresTearDown() + { + $payload = [ + 'class' => '\Resque\Test\TestJobWithTearDown', + 'args' => [ + 'somevar', + 'somevar2', + ], + ]; + $job = new \Resque\Job\Job('jobs', $payload); + $job->perform(); + + $this->assertTrue(TestJobWithTearDown::$called); + } + + public function testNamespaceNaming() + { + $fixture = [ + ['test' => 'more:than:one:with:', 'assertValue' => 'more:than:one:with:'], + ['test' => 'more:than:one:without', 'assertValue' => 'more:than:one:without:'], + ['test' => 'resque', 'assertValue' => 'resque:'], + ['test' => 'resque:', 'assertValue' => 'resque:'], + ]; + + foreach ($fixture as $item) { + \Resque\Redis::prefix($item['test']); + $this->assertEquals(\Resque\Redis::getPrefix(), $item['assertValue']); + } + } + + public function testJobWithNamespace() + { + \Resque\Redis::prefix('php'); + $queue = 'jobs'; + $payload = ['another_value']; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobWithTearDown', $payload); + + $this->assertEquals(\Resque\Resque::queues(), ['jobs']); + $this->assertEquals(\Resque\Resque::size($queue), 1); + + \Resque\Redis::prefix('resque'); + $this->assertEquals(\Resque\Resque::size($queue), 0); + } + + public function testDequeueAll() + { + $queue = 'jobs'; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue'); + $this->assertEquals(\Resque\Resque::size($queue), 2); + $this->assertEquals(\Resque\Resque::dequeue($queue), 2); + $this->assertEquals(\Resque\Resque::size($queue), 0); + } + + public function testDequeueMakeSureNotDeleteOthers() + { + $queue = 'jobs'; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue'); + $other_queue = 'other_jobs'; + \Resque\Resque::enqueue($other_queue, '\Resque\Test\TestJobDequeue'); + \Resque\Resque::enqueue($other_queue, '\Resque\Test\TestJobDequeue'); + $this->assertEquals(\Resque\Resque::size($queue), 2); + $this->assertEquals(\Resque\Resque::size($other_queue), 2); + $this->assertEquals(\Resque\Resque::dequeue($queue), 2); + $this->assertEquals(\Resque\Resque::size($queue), 0); + $this->assertEquals(\Resque\Resque::size($other_queue), 2); + } + + public function testDequeueSpecificItem() + { + $queue = 'jobs'; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue1'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue2'); + $this->assertEquals(\Resque\Resque::size($queue), 2); + $test = ['\Resque\Test\TestJobDequeue2']; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 1); + $this->assertEquals(\Resque\Resque::size($queue), 1); + } + + public function testDequeueSpecificMultipleItems() + { + $queue = 'jobs'; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue1'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue2'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue3'); + $this->assertEquals(\Resque\Resque::size($queue), 3); + $test = ['\Resque\Test\TestJob_Dequeue2', '\Resque\Test\TestJob_Dequeue3']; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 2); + $this->assertEquals(\Resque\Resque::size($queue), 1); + } + + public function testDequeueNonExistingItem() + { + $queue = 'jobs'; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue1'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue2'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue3'); + $this->assertEquals(\Resque\Resque::size($queue), 3); + $test = ['\Resque\Test\TestJob_Dequeue4']; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 0); + $this->assertEquals(\Resque\Resque::size($queue), 3); + } + + public function testDequeueNonExistingItem2() + { + $queue = 'jobs'; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue1'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue2'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue3'); + $this->assertEquals(\Resque\Resque::size($queue), 3); + $test = ['\Resque\Test\TestJob_Dequeue4', '\Resque\Test\TestJob_Dequeue1']; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 1); + $this->assertEquals(\Resque\Resque::size($queue), 2); + } + + public function testDequeueItemID() + { + $queue = 'jobs'; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue'); + $qid = \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue'); + $this->assertEquals(\Resque\Resque::size($queue), 2); + $test = ['\Resque\Test\TestJob_Dequeue' => $qid]; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 1); + $this->assertEquals(\Resque\Resque::size($queue), 1); + } + + public function testDequeueWrongItemID() + { + $queue = 'jobs'; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue'); + $qid = \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue'); + $this->assertEquals(\Resque\Resque::size($queue), 2); + #qid right but class name is wrong + $test = ['\Resque\Test\TestJob_Dequeue1' => $qid]; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 0); + $this->assertEquals(\Resque\Resque::size($queue), 2); + } + + public function testDequeueWrongItemID2() + { + $queue = 'jobs'; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJob_Dequeue'); + $this->assertEquals(\Resque\Resque::size($queue), 2); + $test = ['\Resque\Test\TestJob_Dequeue' => 'r4nD0mH4sh3dId']; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 0); + $this->assertEquals(\Resque\Resque::size($queue), 2); + } + + public function testDequeueItemWithArg() + { + $queue = 'jobs'; + $arg = ['foo' => 1, 'bar' => 2]; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue9'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue9', $arg); + $this->assertEquals(\Resque\Resque::size($queue), 2); + $test = ['\Resque\Test\TestJobDequeue9' => $arg]; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 1); + #$this->assertEquals(\Resque\Resque::size($queue), 1); + } + + public function testDequeueSeveralItemsWithArgs() + { + // GIVEN + $queue = 'jobs'; + $args = ['foo' => 1, 'bar' => 10]; + $removeArgs = ['foo' => 1, 'bar' => 2]; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue9', $args); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue9', $removeArgs); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue9', $removeArgs); + $this->assertEquals(\Resque\Resque::size($queue), 3, "Failed to add 3 items."); + + // WHEN + $test = ['\Resque\Test\TestJobDequeue9' => $removeArgs]; + $removedItems = \Resque\Resque::dequeue($queue, $test); + + // THEN + $this->assertEquals($removedItems, 2); + $this->assertEquals(\Resque\Resque::size($queue), 1); + $item = \Resque\Resque::pop($queue); + $this->assertIsArray($item['args']); + $this->assertEquals(10, $item['args'][0]['bar'], 'Wrong items were dequeued from queue!'); + } + + public function testDequeueItemWithUnorderedArg() + { + $queue = 'jobs'; + $arg = ['foo' => 1, 'bar' => 2]; + $arg2 = ['bar' => 2, 'foo' => 1]; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue', $arg); + $this->assertEquals(\Resque\Resque::size($queue), 2); + $test = ['\Resque\Test\TestJobDequeue' => $arg2]; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 1); + $this->assertEquals(\Resque\Resque::size($queue), 1); + } + + public function testDequeueItemWithiWrongArg() + { + $queue = 'jobs'; + $arg = ['foo' => 1, 'bar' => 2]; + $arg2 = ['foo' => 2, 'bar' => 3]; + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue'); + \Resque\Resque::enqueue($queue, '\Resque\Test\TestJobDequeue', $arg); + $this->assertEquals(\Resque\Resque::size($queue), 2); + $test = ['\Resque\Test\TestJobDequeue' => $arg2]; + $this->assertEquals(\Resque\Resque::dequeue($queue, $test), 0); + $this->assertEquals(\Resque\Resque::size($queue), 2); + } + + public function testUseDefaultFactoryToGetJobInstance() + { + $payload = [ + 'class' => '\Resque\Test\SomeJobClass', + 'args' => null + ]; + $job = new \Resque\Job\Job('jobs', $payload); + $instance = $job->getInstance(); + $this->assertInstanceOf('\Resque\Test\SomeJobClass', $instance); + } + + public function testUseFactoryToGetJobInstance() + { + $payload = [ + 'class' => 'SomeJobClass', + 'args' => [[]] + ]; + $job = new \Resque\Job\Job('jobs', $payload); + $factory = new Some_Stub_Factory(); + $job->setJobFactory($factory); + $instance = $job->getInstance(); + $this->assertInstanceOf('\Resque\Job\JobInterface', $instance); + } +} + +class SomeJobClass implements \Resque\Job\JobInterface +{ + + /** + * @return bool + */ + public function perform() + { + return true; + } +} + +class Some_Stub_Factory implements \Resque\Job\FactoryInterface +{ + + /** + * @param $className + * @param array $args + * @param $queue + * @return \Resque\Job\JobInterface + */ + public function create($className, $args, $queue) + { + return new SomeJobClass(); + } +} diff --git a/test/Resque/Tests/LogTest.php b/tests/Resque/Tests/LogTest.php similarity index 76% rename from test/Resque/Tests/LogTest.php rename to tests/Resque/Tests/LogTest.php index 76a74d1..18109b9 100644 --- a/test/Resque/Tests/LogTest.php +++ b/tests/Resque/Tests/LogTest.php @@ -1,18 +1,20 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Tests_LogTest extends Resque_Tests_TestCase +class LogTest extends TestCase { public function testLogInterpolate() { - $logger = new Resque_Log(); + $logger = new \Resque\Log(); $actual = $logger->interpolate('string {replace}', ['replace' => 'value']); $expected = 'string value'; @@ -21,7 +23,7 @@ class Resque_Tests_LogTest extends Resque_Tests_TestCase public function testLogInterpolateMutiple() { - $logger = new Resque_Log(); + $logger = new \Resque\Log(); $actual = $logger->interpolate( 'string {replace1} {replace2}', ['replace1' => 'value1', 'replace2' => 'value2'] diff --git a/test/Resque/Tests/RedisTest.php b/tests/Resque/Tests/RedisTest.php similarity index 90% rename from test/Resque/Tests/RedisTest.php rename to tests/Resque/Tests/RedisTest.php index 2f73bc4..5f42a93 100644 --- a/test/Resque/Tests/RedisTest.php +++ b/tests/Resque/Tests/RedisTest.php @@ -1,14 +1,16 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Tests_RedisTest extends Resque_Tests_TestCase +class RedisTest extends TestCase { public function testRedisGetSet() { @@ -28,14 +30,14 @@ class Resque_Tests_RedisTest extends Resque_Tests_TestCase // Input , Expected output ['', [ 'localhost', - Resque_Redis::DEFAULT_PORT, + \Resque\Redis::DEFAULT_PORT, false, false, false, [], ]], ['localhost', [ 'localhost', - Resque_Redis::DEFAULT_PORT, + \Resque\Redis::DEFAULT_PORT, false, false, false, [], @@ -56,14 +58,14 @@ class Resque_Tests_RedisTest extends Resque_Tests_TestCase ]], ['redis://foobar', [ 'foobar', - Resque_Redis::DEFAULT_PORT, + \Resque\Redis::DEFAULT_PORT, false, false, false, [], ]], ['redis://foobar/', [ 'foobar', - Resque_Redis::DEFAULT_PORT, + \Resque\Redis::DEFAULT_PORT, false, false, false, [], @@ -175,20 +177,20 @@ class Resque_Tests_RedisTest extends Resque_Tests_TestCase */ public function testParsingValidDsnString($dsn, $expected) { - $result = Resque_Redis::parseDsn($dsn); + $result = \Resque\Redis::parseDsn($dsn); $this->assertEquals($expected, $result); } /** * @dataProvider bogusDsnStringProvider * - * @expectedException InvalidArgumentException + * @expectedException \InvalidArgumentException * * @param $dsn */ public function testParsingBogusDsnStringThrowsException($dsn) { - $this->expectException(InvalidArgumentException::class); - Resque_Redis::parseDsn($dsn); + $this->expectException(\InvalidArgumentException::class); + \Resque\Redis::parseDsn($dsn); } } \ No newline at end of file diff --git a/test/Resque/Tests/StatTest.php b/tests/Resque/Tests/StatTest.php similarity index 54% rename from test/Resque/Tests/StatTest.php rename to tests/Resque/Tests/StatTest.php index 121aaff..3b04c3d 100644 --- a/test/Resque/Tests/StatTest.php +++ b/tests/Resque/Tests/StatTest.php @@ -1,51 +1,53 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Tests_StatTest extends Resque_Tests_TestCase +class StatTest extends TestCase { public function testStatCanBeIncremented() { - Resque_Stat::incr('test_incr'); - Resque_Stat::incr('test_incr'); + \Resque\Stat::incr('test_incr'); + \Resque\Stat::incr('test_incr'); $this->assertEquals(2, $this->redis->get('resque:stat:test_incr')); } public function testStatCanBeIncrementedByX() { - Resque_Stat::incr('test_incrX', 10); - Resque_Stat::incr('test_incrX', 11); + \Resque\Stat::incr('test_incrX', 10); + \Resque\Stat::incr('test_incrX', 11); $this->assertEquals(21, $this->redis->get('resque:stat:test_incrX')); } public function testStatCanBeDecremented() { - Resque_Stat::incr('test_decr', 22); - Resque_Stat::decr('test_decr'); + \Resque\Stat::incr('test_decr', 22); + \Resque\Stat::decr('test_decr'); $this->assertEquals(21, $this->redis->get('resque:stat:test_decr')); } public function testStatCanBeDecrementedByX() { - Resque_Stat::incr('test_decrX', 22); - Resque_Stat::decr('test_decrX', 11); + \Resque\Stat::incr('test_decrX', 22); + \Resque\Stat::decr('test_decrX', 11); $this->assertEquals(11, $this->redis->get('resque:stat:test_decrX')); } public function testGetStatByName() { - Resque_Stat::incr('test_get', 100); - $this->assertEquals(100, Resque_Stat::get('test_get')); + \Resque\Stat::incr('test_get', 100); + $this->assertEquals(100, \Resque\Stat::get('test_get')); } public function testGetUnknownStatReturns0() { - $this->assertEquals(0, Resque_Stat::get('test_get_unknown')); + $this->assertEquals(0, \Resque\Stat::get('test_get_unknown')); } } \ No newline at end of file diff --git a/test/Resque/Tests/TestCase.php b/tests/Resque/Tests/TestCase.php similarity index 67% rename from test/Resque/Tests/TestCase.php rename to tests/Resque/Tests/TestCase.php index 0e93578..d184010 100644 --- a/test/Resque/Tests/TestCase.php +++ b/tests/Resque/Tests/TestCase.php @@ -1,14 +1,15 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ - -class Resque_Tests_TestCase extends PHPUnit\Framework\TestCase +class TestCase extends \PHPUnit\Framework\TestCase { protected $resque; protected $redis; @@ -23,8 +24,8 @@ class Resque_Tests_TestCase extends PHPUnit\Framework\TestCase // Setup redis connection for testing. global $redisTestServer; - $this->redis = new Credis_Client($redisTestServer, '6379'); - Resque::setBackend($redisTestServer); + $this->redis = new \Credis_Client($redisTestServer, '6379'); + \Resque\Resque::setBackend($redisTestServer); $this->redis->flushAll(); } } diff --git a/test/Resque/Tests/WorkerTest.php b/tests/Resque/Tests/WorkerTest.php similarity index 55% rename from test/Resque/Tests/WorkerTest.php rename to tests/Resque/Tests/WorkerTest.php index 44f9c4c..a8d0a69 100644 --- a/test/Resque/Tests/WorkerTest.php +++ b/tests/Resque/Tests/WorkerTest.php @@ -1,19 +1,21 @@ + * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ -class Resque_Tests_WorkerTest extends Resque_Tests_TestCase +class WorkerTest extends TestCase { public function testWorkerRegistersInList() { - $worker = new Resque_Worker('*'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('*'); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); // Make sure the worker is in the list @@ -25,76 +27,76 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase $num = 3; // Register a few workers for ($i = 0; $i < $num; ++$i) { - $worker = new Resque_Worker('queue_' . $i); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('queue_' . $i); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); } // Now try to get them - $this->assertEquals($num, count(Resque_Worker::all())); + $this->assertEquals($num, count(\Resque\Worker::all())); } public function testGetWorkerById() { - $worker = new Resque_Worker('*'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('*'); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); - $newWorker = Resque_Worker::find((string)$worker); + $newWorker = \Resque\Worker::find((string)$worker); $this->assertEquals((string)$worker, (string)$newWorker); } public function testInvalidWorkerDoesNotExist() { - $this->assertFalse(Resque_Worker::exists('blah')); + $this->assertFalse(\Resque\Worker::exists('blah')); } public function testWorkerCanUnregister() { - $worker = new Resque_Worker('*'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('*'); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); $worker->unregisterWorker(); - $this->assertFalse(Resque_Worker::exists((string)$worker)); - $this->assertEquals([], Resque_Worker::all()); + $this->assertFalse(\Resque\Worker::exists((string)$worker)); + $this->assertEquals([], \Resque\Worker::all()); $this->assertEquals([], $this->redis->smembers('resque:workers')); } public function testPausedWorkerDoesNotPickUpJobs() { - $worker = new Resque_Worker('*'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('*'); + $worker->setLogger(new \Resque\Log()); $worker->pauseProcessing(); - Resque::enqueue('jobs', 'Test_Job'); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob'); $worker->work(0); $worker->work(0); - $this->assertEquals(0, Resque_Stat::get('processed')); + $this->assertEquals(0, \Resque\Stat::get('processed')); } public function testResumedWorkerPicksUpJobs() { - $worker = new Resque_Worker('*'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('*'); + $worker->setLogger(new \Resque\Log()); $worker->pauseProcessing(); - Resque::enqueue('jobs', 'Test_Job'); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob'); $worker->work(0); - $this->assertEquals(0, Resque_Stat::get('processed')); + $this->assertEquals(0, \Resque\Stat::get('processed')); $worker->unPauseProcessing(); $worker->work(0); - $this->assertEquals(1, Resque_Stat::get('processed')); + $this->assertEquals(1, \Resque\Stat::get('processed')); } public function testWorkerCanWorkOverMultipleQueues() { - $worker = new Resque_Worker([ + $worker = new \Resque\Worker([ 'queue1', 'queue2' ]); - $worker->setLogger(new Resque_Log()); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); - Resque::enqueue('queue1', 'Test_Job_1'); - Resque::enqueue('queue2', 'Test_Job_2'); + \Resque\Resque::enqueue('queue1', '\Resque\Test\TestJob_1'); + \Resque\Resque::enqueue('queue2', '\Resque\Test\TestJob_2'); $job = $worker->reserve(); $this->assertEquals('queue1', $job->queue); @@ -105,18 +107,18 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase public function testWorkerWorksQueuesInSpecifiedOrder() { - $worker = new Resque_Worker([ + $worker = new \Resque\Worker([ 'high', 'medium', 'low' ]); - $worker->setLogger(new Resque_Log()); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); // Queue the jobs in a different order - Resque::enqueue('low', 'Test_Job_1'); - Resque::enqueue('high', 'Test_Job_2'); - Resque::enqueue('medium', 'Test_Job_3'); + \Resque\Resque::enqueue('low', '\Resque\Test\TestJob_1'); + \Resque\Resque::enqueue('high', '\Resque\Test\TestJob_2'); + \Resque\Resque::enqueue('medium', '\Resque\Test\TestJob_3'); // Now check we get the jobs back in the right order $job = $worker->reserve(); @@ -131,12 +133,12 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase public function testWildcardQueueWorkerWorksAllQueues() { - $worker = new Resque_Worker('*'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('*'); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); - Resque::enqueue('queue1', 'Test_Job_1'); - Resque::enqueue('queue2', 'Test_Job_2'); + \Resque\Resque::enqueue('queue1', '\Resque\Test\TestJob_1'); + \Resque\Resque::enqueue('queue2', '\Resque\Test\TestJob_2'); $job = $worker->reserve(); $this->assertEquals('queue1', $job->queue); @@ -147,19 +149,19 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase public function testWorkerDoesNotWorkOnUnknownQueues() { - $worker = new Resque_Worker('queue1'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('queue1'); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); - Resque::enqueue('queue2', 'Test_Job'); + \Resque\Resque::enqueue('queue2', '\Resque\Test\TestJob'); $this->assertFalse($worker->reserve()); } public function testWorkerClearsItsStatusWhenNotWorking() { - Resque::enqueue('jobs', 'Test_Job'); - $worker = new Resque_Worker('jobs'); - $worker->setLogger(new Resque_Log()); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob'); + $worker = new \Resque\Worker('jobs'); + $worker->setLogger(new \Resque\Log()); $job = $worker->reserve(); $worker->workingOn($job); $worker->doneWorking(); @@ -168,14 +170,14 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase public function testWorkerRecordsWhatItIsWorkingOn() { - $worker = new Resque_Worker('jobs'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('jobs'); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); $payload = [ - 'class' => 'Test_Job' + 'class' => '\Resque\Test\TestJob' ]; - $job = new Resque_Job('jobs', $payload); + $job = new \Resque\Job\Job('jobs', $payload); $worker->workingOn($job); $job = $worker->job(); @@ -188,11 +190,11 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase public function testWorkerErasesItsStatsWhenShutdown() { - Resque::enqueue('jobs', 'Test_Job'); - Resque::enqueue('jobs', 'Invalid_Job'); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob'); + \Resque\Resque::enqueue('jobs', '\Resque\Test\InvalidJob'); - $worker = new Resque_Worker('jobs'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('jobs'); + $worker->setLogger(new \Resque\Log()); $worker->work(0); $worker->work(0); @@ -203,84 +205,84 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase public function testWorkerCleansUpDeadWorkersOnStartup() { // Register a good worker - $goodWorker = new Resque_Worker('jobs'); - $goodWorker->setLogger(new Resque_Log()); + $goodWorker = new \Resque\Worker('jobs'); + $goodWorker->setLogger(new \Resque\Log()); $goodWorker->registerWorker(); $workerId = explode(':', $goodWorker); // Register some bad workers - $worker = new Resque_Worker('jobs'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('jobs'); + $worker->setLogger(new \Resque\Log()); $worker->setId($workerId[0] . ':1:jobs'); $worker->registerWorker(); - $worker = new Resque_Worker(['high', 'low']); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker(['high', 'low']); + $worker->setLogger(new \Resque\Log()); $worker->setId($workerId[0] . ':2:high,low'); $worker->registerWorker(); - $this->assertEquals(3, count(Resque_Worker::all())); + $this->assertEquals(3, count(\Resque\Worker::all())); $goodWorker->pruneDeadWorkers(); // There should only be $goodWorker left now - $this->assertEquals(1, count(Resque_Worker::all())); + $this->assertEquals(1, count(\Resque\Worker::all())); } public function testDeadWorkerCleanUpDoesNotCleanUnknownWorkers() { // Register a bad worker on this machine - $worker = new Resque_Worker('jobs'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('jobs'); + $worker->setLogger(new \Resque\Log()); $workerId = explode(':', $worker); $worker->setId($workerId[0] . ':1:jobs'); $worker->registerWorker(); // Register some other false workers - $worker = new Resque_Worker('jobs'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('jobs'); + $worker->setLogger(new \Resque\Log()); $worker->setId('my.other.host:1:jobs'); $worker->registerWorker(); - $this->assertEquals(2, count(Resque_Worker::all())); + $this->assertEquals(2, count(\Resque\Worker::all())); $worker->pruneDeadWorkers(); // my.other.host should be left - $workers = Resque_Worker::all(); + $workers = \Resque\Worker::all(); $this->assertEquals(1, count($workers)); $this->assertEquals((string)$worker, (string)$workers[0]); } public function testWorkerFailsUncompletedJobsOnExit() { - $worker = new Resque_Worker('jobs'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('jobs'); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); $payload = [ - 'class' => 'Test_Job' + 'class' => '\Resque\Test\TestJob' ]; - $job = new Resque_Job('jobs', $payload); + $job = new \Resque\Job\Job('jobs', $payload); $worker->workingOn($job); $worker->unregisterWorker(); - $this->assertEquals(1, Resque_Stat::get('failed')); + $this->assertEquals(1, \Resque\Stat::get('failed')); } public function testBlockingListPop() { - $worker = new Resque_Worker('jobs'); - $worker->setLogger(new Resque_Log()); + $worker = new \Resque\Worker('jobs'); + $worker->setLogger(new \Resque\Log()); $worker->registerWorker(); - Resque::enqueue('jobs', 'Test_Job_1'); - Resque::enqueue('jobs', 'Test_Job_2'); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob_1'); + \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob_2'); $i = 1; while ($job = $worker->reserve(true, 2)) { - $this->assertEquals('Test_Job_' . $i, $job->payload['class']); + $this->assertEquals('\Resque\Test\TestJob_' . $i, $job->payload['class']); if ($i == 2) { break; diff --git a/test/bootstrap.php b/tests/bootstrap.php similarity index 64% rename from test/bootstrap.php rename to tests/bootstrap.php index 7488ff8..51d9cef 100644 --- a/test/bootstrap.php +++ b/tests/bootstrap.php @@ -1,4 +1,7 @@ add('Resque_Tests', __DIR__); +// $loader->add('Resque_Tests', __DIR__); # Redis configuration global $redisTestServer; $redisTestServer = getenv("REDIS_SERVER") ?: "redis"; -Resque::setBackend($redisTestServer); +\Resque\Resque::setBackend($redisTestServer); # Check Redis is accessable locally try { - $redisTest = new Resque_Redis($redisTestServer); -} catch (Exception $e) { - throw new Exception("Unable to connect to redis. Please check there is a redis-server running."); + $redisTest = new \Resque\Redis($redisTestServer); +} catch (\Exception $e) { + throw new \Exception("Unable to connect to redis. Please check there is a redis-server running."); } $redisTest = null; - - # Cleanup forked workers cleanly if (function_exists('pcntl_signal')) { - function sigint() - { - exit; - } - - pcntl_signal(SIGINT, 'sigint'); - pcntl_signal(SIGTERM, 'sigint'); + pcntl_signal(SIGINT, function() { exit; }); + pcntl_signal(SIGTERM, function() { exit; }); } # Bootstrap it -class Test_Job +class TestJob { public static $called = false; @@ -47,25 +43,25 @@ class Test_Job } } -class Failing_Job_Exception extends Exception +class FailingJobException extends \Exception { } -class Failing_Job +class FailingJob { public function perform() { - throw new Failing_Job_Exception('Message!'); + throw new FailingJobException('Message!'); } } -class Test_Job_Without_Perform_Method +class TestJobWithoutPerformMethod { } -class Test_Job_With_SetUp +class TestJobWithSetUp { public static $called = false; public $args = false; @@ -82,7 +78,7 @@ class Test_Job_With_SetUp } -class Test_Job_With_TearDown +class TestJobWithTearDown { public static $called = false; public $args = false; From dd0bb8947f142ee71671cdd384a506239e86fb86 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Tue, 8 Feb 2022 19:08:07 +1300 Subject: [PATCH 26/45] Update composer --- CHANGELOG.md | 5 + README.md | 2 - composer.lock | 257 +++++++++++++------------- src/Resque/Exception.php | 1 - src/Resque/Job/DirtyExitException.php | 1 - src/Resque/Job/DontCreate.php | 1 - src/Resque/Job/DontPerform.php | 1 - src/Resque/Job/Factory.php | 1 - src/Resque/Job/Job.php | 9 + src/Resque/Job/Status.php | 4 +- src/Resque/Redis.php | 1 + src/Resque/RedisException.php | 1 - src/Resque/Worker.php | 3 +- tests/Resque/Tests/JobTest.php | 2 - tests/Resque/Tests/RedisTest.php | 2 +- tests/bootstrap.php | 4 - 16 files changed, 152 insertions(+), 143 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20fa9ea..adfc4a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.1 (2022-02-08) +- Fixed issue with lingering keys causing constant memory growth +- Add PHP8 support +- Composer upgrade + ## 2.0.0 (2021-02-19) - Moved to PSR-4 - Namespaced codebase diff --git a/README.md b/README.md index b09662e..4d248d3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ php-resque: PHP Resque Worker (and Enqueue) =========================================== - [![pipeline status](https://gitlab.com/idanoo/php-resque/badges/master/pipeline.svg)](https://gitlab.com/idanoo/php-resque/-/commits/master) - Resque is a Redis-backed library for creating background jobs, placing those jobs on one or more queues, and processing them later. diff --git a/composer.lock b/composer.lock index a335804..151c58c 100644 --- a/composer.lock +++ b/composer.lock @@ -52,16 +52,16 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -85,7 +85,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -96,9 +96,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "time": "2020-03-23T09:12:05+00:00" + "time": "2021-05-03T11:20:27+00:00" } ], "packages-dev": [ @@ -188,9 +188,6 @@ "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" - }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", @@ -198,12 +195,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -231,16 +228,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.10.4", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -281,22 +278,22 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2020-12-20T10:01:03+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { @@ -341,22 +338,22 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2020-06-27T14:33:11+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "3.0.4", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" + "reference": "15a90844ad40f127afd244c0cad228de2a80052a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", + "url": "https://api.github.com/repos/phar-io/version/zipball/15a90844ad40f127afd244c0cad228de2a80052a", + "reference": "15a90844ad40f127afd244c0cad228de2a80052a", "shasum": "" }, "require": { @@ -392,9 +389,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.0.4" + "source": "https://github.com/phar-io/version/tree/3.1.1" }, - "time": "2020-12-13T23:18:30+00:00" + "time": "2022-02-07T21:56:48+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -451,16 +448,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -471,7 +468,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -501,22 +499,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { @@ -524,7 +522,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -550,39 +549,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2022-01-04T19:58:01+00:00" }, { "name": "phpspec/prophecy", - "version": "1.12.2", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "245710e971a030f42e08f4912863805570f23d39" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", - "reference": "245710e971a030f42e08f4912863805570f23d39", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -617,29 +616,29 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2020-12-19T10:15:11+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.5", + "version": "9.2.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" + "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", + "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -688,7 +687,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" }, "funding": [ { @@ -696,20 +695,20 @@ "type": "github" } ], - "time": "2020-11-28T06:44:49+00:00" + "time": "2021-12-05T09:12:13+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -748,7 +747,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -756,7 +755,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -941,16 +940,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.2", + "version": "9.5.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" + "reference": "597cb647654ede35e43b137926dfdfef0fb11743" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/597cb647654ede35e43b137926dfdfef0fb11743", + "reference": "597cb647654ede35e43b137926dfdfef0fb11743", "shasum": "" }, "require": { @@ -962,11 +961,11 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.7", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -980,7 +979,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3", + "sebastian/type": "^2.3.4", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -1028,11 +1027,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.13" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -1040,7 +1039,7 @@ "type": "github" } ], - "time": "2021-02-02T14:45:58+00:00" + "time": "2022-01-24T07:33:35+00:00" }, { "name": "sebastian/cli-parser", @@ -1471,16 +1470,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -1529,14 +1528,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -1544,20 +1543,20 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.2", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", "shasum": "" }, "require": { @@ -1600,7 +1599,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" }, "funding": [ { @@ -1608,7 +1607,7 @@ "type": "github" } ], - "time": "2020-10-26T15:55:19+00:00" + "time": "2021-06-11T13:31:12+00:00" }, { "name": "sebastian/lines-of-code", @@ -1899,16 +1898,16 @@ }, { "name": "sebastian/type", - "version": "2.3.1", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", "shasum": "" }, "require": { @@ -1943,7 +1942,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" }, "funding": [ { @@ -1951,7 +1950,7 @@ "type": "github" } ], - "time": "2020-10-26T13:18:59+00:00" + "time": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", @@ -2008,16 +2007,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.8", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", "shasum": "" }, "require": { @@ -2060,32 +2059,35 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2020-10-23T02:01:07+00:00" + "time": "2021-12-12T21:44:58+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.22.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2123,7 +2125,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" }, "funding": [ { @@ -2139,20 +2141,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -2181,7 +2183,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/master" + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { @@ -2189,34 +2191,39 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -2240,9 +2247,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.9.1" + "source": "https://github.com/webmozarts/assert/tree/1.10.0" }, - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], @@ -2254,5 +2261,5 @@ "php": ">7.4" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.2.0" } diff --git a/src/Resque/Exception.php b/src/Resque/Exception.php index ed2e3f7..7e8b7ae 100644 --- a/src/Resque/Exception.php +++ b/src/Resque/Exception.php @@ -12,5 +12,4 @@ namespace Resque; class Exception extends \Exception { - } diff --git a/src/Resque/Job/DirtyExitException.php b/src/Resque/Job/DirtyExitException.php index a96bc10..ba002bc 100644 --- a/src/Resque/Job/DirtyExitException.php +++ b/src/Resque/Job/DirtyExitException.php @@ -11,5 +11,4 @@ namespace Resque\Job; */ class DirtyExitException extends \RuntimeException { - } diff --git a/src/Resque/Job/DontCreate.php b/src/Resque/Job/DontCreate.php index efdb69c..21f4f4d 100644 --- a/src/Resque/Job/DontCreate.php +++ b/src/Resque/Job/DontCreate.php @@ -11,5 +11,4 @@ namespace Resque\Job; */ class DontCreate extends \Exception { - } diff --git a/src/Resque/Job/DontPerform.php b/src/Resque/Job/DontPerform.php index 2c7f855..cc1c029 100644 --- a/src/Resque/Job/DontPerform.php +++ b/src/Resque/Job/DontPerform.php @@ -11,5 +11,4 @@ namespace Resque\Job; */ class DontPerform extends \Exception { - } diff --git a/src/Resque/Job/Factory.php b/src/Resque/Job/Factory.php index af35c6f..a25b98a 100644 --- a/src/Resque/Job/Factory.php +++ b/src/Resque/Job/Factory.php @@ -11,7 +11,6 @@ namespace Resque\Job; */ class Factory implements FactoryInterface { - /** * @param $className * @param array $args diff --git a/src/Resque/Job/Job.php b/src/Resque/Job/Job.php index 3a98f98..4717e59 100755 --- a/src/Resque/Job/Job.php +++ b/src/Resque/Job/Job.php @@ -59,6 +59,7 @@ class Job * @param string $id Unique identifier for tracking the job. Generated if not supplied. * * @return string + * * @throws \InvalidArgumentException */ public static function create($queue, $class, $args = null, $monitor = false, $id = null) @@ -91,6 +92,7 @@ class Job * instance of \Resque\Job\Job for it. * * @param string $queue The name of the queue to check for a job in. + * * @return false|object Null when there aren't any waiting jobs, instance of \Resque\Job\Job when a job was found. */ public static function reserve($queue) @@ -109,6 +111,7 @@ class Job * * @param array $queues * @param int $timeout + * * @return false|object Null when there aren't any waiting jobs, instance of \Resque\Job\Job when a job was found. */ public static function reserveBlocking(array $queues, $timeout = null) @@ -125,6 +128,8 @@ class Job * Update the status of the current job. * * @param int $status Status constant from \Resque\Job\Status indicating the current status of a job. + * + * @return bool */ public function updateStatus($status): bool { @@ -164,6 +169,7 @@ class Job /** * Get the instantiated object for this job that will be performing work. + * * @return \Resque\Job\JobInterface Instance of the object that this job belongs to. */ public function getInstance() @@ -182,6 +188,7 @@ class Job * associated with the job with the supplied arguments. * * @return bool + * * @throws \Resque\Exception When the job's class could not be found or it does not contain a perform method. */ public function perform() @@ -234,6 +241,7 @@ class Job /** * Re-queue the current job. + * * @return string */ public function recreate() @@ -269,6 +277,7 @@ class Job /** * @param FactoryInterface $jobFactory + * * @return Job */ public function setJobFactory(FactoryInterface $jobFactory) diff --git a/src/Resque/Job/Status.php b/src/Resque/Job/Status.php index 229e3a5..29d412e 100644 --- a/src/Resque/Job/Status.php +++ b/src/Resque/Job/Status.php @@ -59,7 +59,7 @@ class Status 'updated' => time(), 'started' => time(), ]; - \Resque\Resque::redis()->set('job:' . $id . ':status', json_encode($statusPacket)); + \Resque\Resque::redis()->setex('job:' . $id . ':status', 172800, json_encode($statusPacket)); } /** @@ -98,7 +98,7 @@ class Status 'status' => $status, 'updated' => time(), ]; - \Resque\Resque::redis()->set((string)$this, json_encode($statusPacket)); + \Resque\Resque::redis()->setex((string)$this, 172800, json_encode($statusPacket)); // Expire the status for completed jobs after 24 hours if (in_array($status, self::$completeStatuses)) { diff --git a/src/Resque/Redis.php b/src/Resque/Redis.php index 29830c4..4b3b610 100644 --- a/src/Resque/Redis.php +++ b/src/Resque/Redis.php @@ -163,6 +163,7 @@ class Redis * Note: the 'user' part of the DSN is not used. * * @param string $dsn A DSN string + * * @return array An array of DSN compotnents, with 'false' values for any unknown components. e.g. * [host, port, db, user, pass, options] */ diff --git a/src/Resque/RedisException.php b/src/Resque/RedisException.php index b2cad48..4318e18 100644 --- a/src/Resque/RedisException.php +++ b/src/Resque/RedisException.php @@ -12,5 +12,4 @@ namespace Resque; class RedisException extends \Exception { - } diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index bcc68e7..93bd81e 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -149,6 +149,7 @@ class Worker * * @param int $interval How often to check for new jobs across the queues. * @param bool $blocking + * * @throws Resque_RedisException */ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false) @@ -524,7 +525,7 @@ class Worker 'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'), 'payload' => $job->payload ]); - Resque::redis()->set('worker:' . $job->worker, $data); + Resque::redis()->setex('worker:' . $job->worker, 172800, $data); } /** diff --git a/tests/Resque/Tests/JobTest.php b/tests/Resque/Tests/JobTest.php index 148b82c..40c5506 100644 --- a/tests/Resque/Tests/JobTest.php +++ b/tests/Resque/Tests/JobTest.php @@ -397,7 +397,6 @@ class JobTest extends TestCase class SomeJobClass implements \Resque\Job\JobInterface { - /** * @return bool */ @@ -409,7 +408,6 @@ class SomeJobClass implements \Resque\Job\JobInterface class Some_Stub_Factory implements \Resque\Job\FactoryInterface { - /** * @param $className * @param array $args diff --git a/tests/Resque/Tests/RedisTest.php b/tests/Resque/Tests/RedisTest.php index 5f42a93..a1a3814 100644 --- a/tests/Resque/Tests/RedisTest.php +++ b/tests/Resque/Tests/RedisTest.php @@ -14,7 +14,7 @@ class RedisTest extends TestCase { public function testRedisGetSet() { - $this->redis->set("testKey", 24); + $this->redis->setex("testKey", 3600, 24); $val = $this->redis->get("testKey"); $this->assertEquals(24, $val); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 51d9cef..4d3cf91 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -45,7 +45,6 @@ class TestJob class FailingJobException extends \Exception { - } class FailingJob @@ -58,7 +57,6 @@ class FailingJob class TestJobWithoutPerformMethod { - } class TestJobWithSetUp @@ -73,7 +71,6 @@ class TestJobWithSetUp public function perform() { - } } @@ -85,7 +82,6 @@ class TestJobWithTearDown public function perform() { - } public function tearDown() From ac044747aa1f25c81c755cfbec2bd1fb5993192f Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Tue, 15 Feb 2022 09:07:24 +1300 Subject: [PATCH 27/45] 2.0.2 (2022-02-15) - Replace strftime with strtotime for PHP8.1 support - Added processing class into proc line for easier debugging --- .gitlab-ci.yml | 6 +++--- CHANGELOG.md | 4 ++++ src/Resque/Failure/ResqueFailureRedis.php | 2 +- src/Resque/Log.php | 2 +- src/Resque/Worker.php | 10 ++++++---- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6907bfb..b1e395f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,8 +30,8 @@ test:7.4: - docker # Test PHP 8.0 -test:8.0: - image: php:8.0 +test:8.1: + image: php:8.1 before_script: - *docker_boostrap script: @@ -41,7 +41,7 @@ test:8.0: # Codestandards lint: - image: php:8.0 + image: php:8.1 allow_failure: true script: - apt update && apt install -y wget unzip git diff --git a/CHANGELOG.md b/CHANGELOG.md index adfc4a6..2d2507a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.2 (2022-02-15) +- Replace strftime with strtotime for PHP8.1 support +- Added processing class into proc line for easier debugging + ## 2.0.1 (2022-02-08) - Fixed issue with lingering keys causing constant memory growth - Add PHP8 support diff --git a/src/Resque/Failure/ResqueFailureRedis.php b/src/Resque/Failure/ResqueFailureRedis.php index 5695288..33a9cc1 100644 --- a/src/Resque/Failure/ResqueFailureRedis.php +++ b/src/Resque/Failure/ResqueFailureRedis.php @@ -24,7 +24,7 @@ class ResqueFailureRedis implements ResqueFailureInterface public function __construct($payload, $exception, $worker, $queue) { $data = new \stdClass(); - $data->failed_at = strftime('%a %b %d %H:%M:%S %Z %Y'); + $data->failed_at = date('D M d H:i:s T Y'); $data->payload = $payload; $data->exception = get_class($exception); $data->error = $exception->getMessage(); diff --git a/src/Resque/Log.php b/src/Resque/Log.php index 2ac05ce..986ae2b 100644 --- a/src/Resque/Log.php +++ b/src/Resque/Log.php @@ -47,7 +47,7 @@ class Log extends \Psr\Log\AbstractLogger if (array_search($level, $logLevels) <= array_search($this->logLevel, $logLevels)) { fwrite( STDOUT, - '[' . $level . '][' . strftime('%Y-%m-%d %T') . '] ' . + '[' . $level . '][' . date('Y-m-d H:i:s') . '] ' . $this->interpolate($message, $context) . PHP_EOL ); } diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index 93bd81e..550bdef 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -215,7 +215,9 @@ class Worker // Forked and we're the child. Run the job. if ($this->child === 0 || $this->child === false) { - $status = 'Processing ' . $job->queue . ' since ' . strftime('%F %T'); + $status = 'Processing ' . $job->queue + . ' (' . ($job->payload['class'] ?? '') . ') since ' + . date('Y-m-d H:i:s'); $this->updateProcLine($status); $this->logger->log(\Psr\Log\LogLevel::INFO, $status); /** @noinspection PhpParamsInspection */ @@ -227,7 +229,7 @@ class Worker if ($this->child > 0) { // Parent process, sit and wait - $status = 'Forked ' . $this->child . ' at ' . strftime('%F %T'); + $status = 'Forked ' . $this->child . ' at ' . date('Y-m-d H:i:s'); $this->updateProcLine($status); $this->logger->log(\Psr\Log\LogLevel::INFO, $status); @@ -489,7 +491,7 @@ class Worker public function registerWorker() { Resque::redis()->sadd('workers', (string)$this); - Resque::redis()->setex('worker:' . (string)$this . ':started', 172800, strftime('%a %b %d %H:%M:%S %Z %Y')); + Resque::redis()->setex('worker:' . (string)$this . ':started', 172800, date('D M d H:i:s T Y')); } /** @@ -522,7 +524,7 @@ class Worker $job->updateStatus(\Resque\Job\Status::STATUS_RUNNING); $data = json_encode([ 'queue' => $job->queue, - 'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'), + 'run_at' => date('D M d H:i:s T Y'), 'payload' => $job->payload ]); Resque::redis()->setex('worker:' . $job->worker, 172800, $data); From f9a22e7b8ac100dabcc2ca4a9896961feac5b0e4 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Tue, 15 Feb 2022 10:53:18 +1300 Subject: [PATCH 28/45] Bump resque version constant --- src/Resque/Resque.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resque/Resque.php b/src/Resque/Resque.php index 6895061..710ed4d 100644 --- a/src/Resque/Resque.php +++ b/src/Resque/Resque.php @@ -12,7 +12,7 @@ namespace Resque; class Resque { - public const VERSION = '2.0.0'; + public const VERSION = '2.0.2'; public const DEFAULT_INTERVAL = 5; From 05cae402b50b6dc2b2b078780a183fabe010099c Mon Sep 17 00:00:00 2001 From: idanoo Date: Mon, 12 Sep 2022 19:50:02 +1200 Subject: [PATCH 29/45] 2.0.3 (2022-09-12) - Update composer packages - Added WoodpeckerCI tests - Updated links in composer package - Stricter typing --- .woodpecker/.lint.yml | 8 + .woodpecker/.test.yml | 25 ++ CHANGELOG.md | 6 + README.md | 8 +- bin/resque | 4 +- composer.json | 8 +- composer.lock | 548 +++++----------------------- ruleset.xml | 6 - src/Resque/Failure/Failure.php | 16 +- src/Resque/Job/Factory.php | 5 +- src/Resque/Job/FactoryInterface.php | 1 + src/Resque/Job/Job.php | 17 +- src/Resque/Job/Status.php | 8 +- src/Resque/Log.php | 18 +- src/Resque/Redis.php | 27 +- src/Resque/RedisException.php | 2 +- src/Resque/Resque.php | 11 +- src/Resque/Stat.php | 5 +- src/Resque/Worker.php | 11 +- tests/Resque/Tests/JobTest.php | 4 +- tests/bootstrap.php | 1 - 21 files changed, 215 insertions(+), 524 deletions(-) create mode 100644 .woodpecker/.lint.yml create mode 100644 .woodpecker/.test.yml diff --git a/.woodpecker/.lint.yml b/.woodpecker/.lint.yml new file mode 100644 index 0000000..6e3f90f --- /dev/null +++ b/.woodpecker/.lint.yml @@ -0,0 +1,8 @@ +pipeline: + lint: + image: php:8.1-cli + commands: + - apt update && apt install -y wget unzip git + - wget https://getcomposer.org/download/latest-stable/composer.phar + - php composer.phar install --dev + - php -d memory_limit=256M vendor/bin/phpcs -s --standard=ruleset.xml diff --git a/.woodpecker/.test.yml b/.woodpecker/.test.yml new file mode 100644 index 0000000..ebb53ed --- /dev/null +++ b/.woodpecker/.test.yml @@ -0,0 +1,25 @@ +matrix: + PHP_VERSION: + - 7.4 + - 8.0 + - 8.1 + +pipeline: + unit-tests: + image: php:${PHP_VERSION}-cli + commands: + - apt-get update -yq + - apt-get install git wget procps unzip -y + - pecl install -o -f redis && rm -rf /tmp/pear + - docker-php-ext-enable redis + - docker-php-ext-install pcntl + - wget https://getcomposer.org/download/latest-stable/composer.phar + - php composer.phar install --dev + - php vendor/bin/phpunit --verbose --configuration phpunit.xml + +services: + redis: + image: redis:latest + +depends_on: + - lint \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d2507a..8101a95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.0.3 (2022-09-12) +- Update composer packages +- Added WoodpeckerCI tests +- Updated links in composer package +- Stricter typing + ## 2.0.2 (2022-02-15) - Replace strftime with strtotime for PHP8.1 support - Added processing class into proc line for easier debugging diff --git a/README.md b/README.md index 4d248d3..b7025a0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ php-resque: PHP Resque Worker (and Enqueue) =========================================== +[![Build Status](https://ci.tinker.nz/api/badges/idanoo/php-resque/status.svg)](https://ci.tinker.nz/idanoo/php-resque) + Resque is a Redis-backed library for creating background jobs, placing those jobs on one or more queues, and processing them later. @@ -58,7 +60,7 @@ If you're not familiar with Composer, please see . ```json { "require": { - "idanoo/php-resque": "^1.4" + "idanoo/php-resque": "^2.0" } } ``` @@ -80,7 +82,7 @@ Jobs are queued as follows: ```php // Required if redis is located elsewhere -Resque::setBackend('localhost:6379'); +Resque::setBackend('redis:6379'); $args = ['name' => 'TestName']; @@ -468,7 +470,7 @@ needing to directly examine the code), have a look at `HOWITWORKS.md`. ## Contributors ## ### Current Maintainers ### -* @iDanoo +* @idanoo ### Past Maintainer / Forked From ### diff --git a/bin/resque b/bin/resque index 91bd82a..073f05a 100755 --- a/bin/resque +++ b/bin/resque @@ -38,7 +38,9 @@ if (empty($QUEUE)) { */ $REDIS_BACKEND = getenv('REDIS_BACKEND'); -// Override redis DB numbers +/** + * REDIS_BACKEND_DB overrides default Redis DB + */ $REDIS_BACKEND_DB = getenv('REDIS_BACKEND_DB'); if (!empty($REDIS_BACKEND)) { if (empty($REDIS_BACKEND_DB)) { diff --git a/composer.json b/composer.json index 04c863b..f7438df 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ }, "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", "keywords": ["job", "background", "redis", "resque", "php"], - "homepage": "http://www.github.com/idanoo/php-resque/", + "homepage": "https://tinker.nz/idanoo/php-resque/", "license": "MIT", "authors": [ { @@ -18,7 +18,7 @@ "require": { "php": ">7.4", "psr/log": "^1.1.0", - "colinmollenhour/credis": "^1.12.0" + "colinmollenhour/credis": "^1.13.0" }, "require-dev": { "phpunit/phpunit": "^9", @@ -38,7 +38,7 @@ } }, "support": { - "issues": "https://github.com/idanoo/php-resque/issues", - "source": "https://github.com/idanoo/php-resque" + "issues": "https://tinker.nz/idanoo/php-resque/issues", + "source": "https://tinker.nz/idanoo/php-resque" } } diff --git a/composer.lock b/composer.lock index 151c58c..a5714d6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,24 +4,27 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3b306efc1905a1f6cce0808d41fcf19c", + "content-hash": "67934d62707c83cdcba540469eff2fe7", "packages": [ { "name": "colinmollenhour/credis", - "version": "v1.12.1", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/colinmollenhour/credis.git", - "reference": "c27faa11724229986335c23f4b6d0f1d8d6547fb" + "reference": "85df015088e00daf8ce395189de22c8eb45c8d49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/c27faa11724229986335c23f4b6d0f1d8d6547fb", - "reference": "c27faa11724229986335c23f4b6d0f1d8d6547fb", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/85df015088e00daf8ce395189de22c8eb45c8d49", + "reference": "85df015088e00daf8ce395189de22c8eb45c8d49", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.6.0" + }, + "suggest": { + "ext-redis": "Improved performance for communicating with redis" }, "type": "library", "autoload": { @@ -46,9 +49,9 @@ "homepage": "https://github.com/colinmollenhour/credis", "support": { "issues": "https://github.com/colinmollenhour/credis/issues", - "source": "https://github.com/colinmollenhour/credis/tree/v1.12.1" + "source": "https://github.com/colinmollenhour/credis/tree/v1.13.1" }, - "time": "2020-11-06T16:09:14+00:00" + "time": "2022-06-20T22:56:59+00:00" }, { "name": "psr/log", @@ -104,29 +107,30 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -153,7 +157,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -169,29 +173,33 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { @@ -216,7 +224,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -224,20 +232,20 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -278,9 +286,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { "name": "phar-io/manifest", @@ -344,16 +352,16 @@ }, { "name": "phar-io/version", - "version": "3.1.1", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "15a90844ad40f127afd244c0cad228de2a80052a" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/15a90844ad40f127afd244c0cad228de2a80052a", - "reference": "15a90844ad40f127afd244c0cad228de2a80052a", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -389,256 +397,29 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.1" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2022-02-07T21:56:48+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" - }, - "time": "2022-01-04T19:58:01+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.10", + "version": "9.2.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.14", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -687,7 +468,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -695,7 +476,7 @@ "type": "github" } ], - "time": "2021-12-05T09:12:13+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -940,16 +721,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.13", + "version": "9.5.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "597cb647654ede35e43b137926dfdfef0fb11743" + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/597cb647654ede35e43b137926dfdfef0fb11743", - "reference": "597cb647654ede35e43b137926dfdfef0fb11743", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", "shasum": "" }, "require": { @@ -964,8 +745,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -979,13 +759,9 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.1", "sebastian/version": "^3.0.2" }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -1000,11 +776,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1027,7 +803,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" }, "funding": [ { @@ -1039,7 +815,7 @@ "type": "github" } ], - "time": "2022-01-24T07:33:35+00:00" + "time": "2022-08-30T07:42:16+00:00" }, { "name": "sebastian/cli-parser", @@ -1407,16 +1183,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { @@ -1458,7 +1234,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -1466,7 +1242,7 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", @@ -1547,16 +1323,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -1599,7 +1375,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -1607,7 +1383,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -1898,28 +1674,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "fb44e1cc6e557418387ad815780360057e40753e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", + "reference": "fb44e1cc6e557418387ad815780360057e40753e", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1942,7 +1718,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.1.0" }, "funding": [ { @@ -1950,7 +1726,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-08-29T06:55:37+00:00" }, { "name": "sebastian/version", @@ -2007,16 +1783,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.2", + "version": "3.7.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", "shasum": "" }, "require": { @@ -2059,89 +1835,7 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-12-12T21:44:58+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-10-20T20:35:02+00:00" + "time": "2022-06-18T07:21:10+00:00" }, { "name": "theseer/tokenizer", @@ -2192,64 +1886,6 @@ } ], "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" - }, - "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], @@ -2261,5 +1897,5 @@ "php": ">7.4" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/ruleset.xml b/ruleset.xml index c746767..7034ee6 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -15,11 +15,5 @@ - - 0 - - diff --git a/src/Resque/Failure/Failure.php b/src/Resque/Failure/Failure.php index 958fcf0..1a0b17f 100644 --- a/src/Resque/Failure/Failure.php +++ b/src/Resque/Failure/Failure.php @@ -25,8 +25,12 @@ class Failure * @param \Resque\Worker $worker Instance of Resque_Worker that was running this job when it failed. * @param string $queue The name of the queue that this job was fetched from. */ - public static function create($payload, \Exception $exception, \Resque\Worker $worker, $queue) - { + public static function create( + $payload, + \Exception $exception, + \Resque\Worker $worker, + $queue + ) { $backend = self::getBackend(); new $backend($payload, $exception, $worker, $queue); } @@ -34,11 +38,11 @@ class Failure /** * Return an instance of the backend for saving job failures. * - * @return object|string + * @return string */ public static function getBackend() { - if (self::$backend === null) { + if (is_null(self::$backend)) { self::$backend = '\\Resque\\Failure\\ResqueFailureRedis'; } @@ -51,8 +55,10 @@ class Failure * It is your responsibility to have the backend class loaded (or autoloaded) * * @param string $backend The class name of the backend to pipe failures to. + * + * @return void */ - public static function setBackend($backend) + public static function setBackend(string $backend): void { self::$backend = $backend; } diff --git a/src/Resque/Job/Factory.php b/src/Resque/Job/Factory.php index a25b98a..380ca05 100644 --- a/src/Resque/Job/Factory.php +++ b/src/Resque/Job/Factory.php @@ -15,7 +15,9 @@ class Factory implements FactoryInterface * @param $className * @param array $args * @param $queue + * * @return \Resque\Job\JobInterface + * * @throws \Resque\Exception */ public function create($className, $args, $queue) @@ -28,13 +30,14 @@ class Factory implements FactoryInterface if (!method_exists($className, 'perform')) { throw new \Resque\Exception( - 'Job class ' . $className . ' does not contain a perform method.' + 'Job class ' . $className . ' does not contain a perform() method.' ); } $instance = new $className(); $instance->args = $args; $instance->queue = $queue; + return $instance; } } diff --git a/src/Resque/Job/FactoryInterface.php b/src/Resque/Job/FactoryInterface.php index 279dead..a44d6ac 100644 --- a/src/Resque/Job/FactoryInterface.php +++ b/src/Resque/Job/FactoryInterface.php @@ -15,6 +15,7 @@ interface FactoryInterface * @param $className * @param array $args * @param $queue + * * @return \Resque\Job\JobInterface */ public function create($className, $args, $queue); diff --git a/src/Resque/Job/Job.php b/src/Resque/Job/Job.php index 4717e59..32ff7b2 100755 --- a/src/Resque/Job/Job.php +++ b/src/Resque/Job/Job.php @@ -62,7 +62,7 @@ class Job * * @throws \InvalidArgumentException */ - public static function create($queue, $class, $args = null, $monitor = false, $id = null) + public static function create($queue, $class, $args = null, $monitor = false, $id = null): string { if (is_null($id)) { $id = \Resque\Resque::generateJobId(); @@ -93,13 +93,13 @@ class Job * * @param string $queue The name of the queue to check for a job in. * - * @return false|object Null when there aren't any waiting jobs, instance of \Resque\Job\Job when a job was found. + * @return Job|null Null when there aren't any waiting jobs, instance of \Resque\Job\Job when a job was found. */ - public static function reserve($queue) + public static function reserve($queue): ?Job { $payload = \Resque\Resque::pop($queue); if (!is_array($payload)) { - return false; + return null; } return new Job($queue, $payload); @@ -112,13 +112,13 @@ class Job * @param array $queues * @param int $timeout * - * @return false|object Null when there aren't any waiting jobs, instance of \Resque\Job\Job when a job was found. + * @return Job|null Null when there aren't any waiting jobs, instance of \Resque\Job\Job when a job was found. */ - public static function reserveBlocking(array $queues, $timeout = null) + public static function reserveBlocking(array $queues, $timeout = null): ?Job { $item = \Resque\Resque::blpop($queues, $timeout); if (!is_array($item)) { - return false; + return null; } return new Job($item['queue'], $item['payload']); @@ -292,9 +292,10 @@ class Job */ public function getJobFactory() { - if ($this->jobFactory === null) { + if (is_null($this->jobFactory)) { $this->jobFactory = new Factory(); } + return $this->jobFactory; } } diff --git a/src/Resque/Job/Status.php b/src/Resque/Job/Status.php index 29d412e..2092820 100644 --- a/src/Resque/Job/Status.php +++ b/src/Resque/Job/Status.php @@ -59,7 +59,7 @@ class Status 'updated' => time(), 'started' => time(), ]; - \Resque\Resque::redis()->setex('job:' . $id . ':status', 172800, json_encode($statusPacket)); + \Resque\Resque::redis()->setex('job:' . $id . ':status', 86400, json_encode($statusPacket)); } /** @@ -98,7 +98,7 @@ class Status 'status' => $status, 'updated' => time(), ]; - \Resque\Resque::redis()->setex((string)$this, 172800, json_encode($statusPacket)); + \Resque\Resque::redis()->setex((string)$this, 86400, json_encode($statusPacket)); // Expire the status for completed jobs after 24 hours if (in_array($status, self::$completeStatuses)) { @@ -128,8 +128,10 @@ class Status /** * Stop tracking the status of a job. + * + * @return void */ - public function stop() + public function stop(): void { \Resque\Resque::redis()->del((string)$this); } diff --git a/src/Resque/Log.php b/src/Resque/Log.php index 986ae2b..e446a72 100644 --- a/src/Resque/Log.php +++ b/src/Resque/Log.php @@ -14,7 +14,7 @@ class Log extends \Psr\Log\AbstractLogger { public $logLevel; - public function __construct($logLevel = "warning") + public function __construct($logLevel = 'warning') { $this->logLevel = strtolower($logLevel); } @@ -30,14 +30,14 @@ class Log extends \Psr\Log\AbstractLogger public function log($level, $message, array $context = []) { $logLevels = [ - "emergency", - "alert", - "critical", - "error", - "warning", - "notice", - "info", - "debug", + 'emergency', + 'alert', + 'critical', + 'error', + 'warning', + 'notice', + 'info', + 'debug', ]; /** diff --git a/src/Resque/Redis.php b/src/Resque/Redis.php index 4b3b610..f726feb 100644 --- a/src/Resque/Redis.php +++ b/src/Resque/Redis.php @@ -104,9 +104,12 @@ class Redis /** * Set Redis namespace (prefix) default: resque + * * @param string $namespace + * + * @return void */ - public static function prefix($namespace) + public static function prefix(string $namespace): void { if (substr($namespace, -1) !== ':' && $namespace != '') { $namespace .= ':'; @@ -119,6 +122,7 @@ class Redis * @param int $database A database number to select. However, if we find a valid database number in the DSN the * DSN-supplied value will be used instead and this parameter is ignored. * @param object $client Optional \Credis_Client instance instantiated by you + * * @throws \Resque\RedisException */ public function __construct($server, $database = null, $client = null) @@ -167,7 +171,7 @@ class Redis * @return array An array of DSN compotnents, with 'false' values for any unknown components. e.g. * [host, port, db, user, pass, options] */ - public static function parseDsn($dsn) + public static function parseDsn($dsn): array { if ($dsn == '') { // Use a sensible default for an empty DNS string @@ -234,7 +238,9 @@ class Redis * * @param string $name The name of the method called. * @param array $args Array of supplied arguments to the method. + * * @return mixed Return value from Resident::call() based on the command. + * * @throws Resque_RedisException */ public function __call($name, $args) @@ -250,23 +256,18 @@ class Redis } try { return $this->driver->__call($name, $args); - } catch (\CredisException $e) { + } catch (\Exception $e) { throw new RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); } } + /** + * Returns redis prefix + * + * @return string + */ public static function getPrefix(): string { return self::$defaultNamespace; } - - public static function removePrefix($string): string - { - $prefix = self::getPrefix(); - - if (substr($string, 0, strlen($prefix)) == $prefix) { - $string = substr($string, strlen($prefix), strlen($string)); - } - return $string; - } } diff --git a/src/Resque/RedisException.php b/src/Resque/RedisException.php index 4318e18..c875887 100644 --- a/src/Resque/RedisException.php +++ b/src/Resque/RedisException.php @@ -3,7 +3,7 @@ namespace Resque; /** - * Redis related exceptions + * Redis exceptions * * @package Resque * @author Daniel Mason diff --git a/src/Resque/Resque.php b/src/Resque/Resque.php index 710ed4d..06fff0d 100644 --- a/src/Resque/Resque.php +++ b/src/Resque/Resque.php @@ -12,7 +12,7 @@ namespace Resque; class Resque { - public const VERSION = '2.0.2'; + public const VERSION = '2.0.3'; public const DEFAULT_INTERVAL = 5; @@ -58,7 +58,7 @@ class Resque */ public static function redis() { - if (self::$redis !== null) { + if (!is_null(self::$redis)) { return self::$redis; } @@ -113,11 +113,14 @@ class Resque if ($encodedItem === false) { return false; } + self::redis()->sadd('queues', $queue); + $length = self::redis()->rpush('queue:' . $queue, $encodedItem); if ($length < 1) { return false; } + return true; } @@ -253,9 +256,9 @@ class Resque * * @param string $queue Queue to fetch next available job from. * - * @return false|object|\Resque\Job\Job + * @return \Resque\Job\Job|null */ - public static function reserve($queue) + public static function reserve($queue): ?\Resque\Job\Job { return \Resque\Job\Job::reserve($queue); } diff --git a/src/Resque/Stat.php b/src/Resque/Stat.php index 6d6bd8b..66cdb55 100644 --- a/src/Resque/Stat.php +++ b/src/Resque/Stat.php @@ -16,9 +16,10 @@ class Stat * Get the value of the supplied statistic counter for the specified statistic. * * @param string $stat The name of the statistic to get the stats for. - * @return mixed Value of the statistic. + * + * @return int Value of the statistic. */ - public static function get($stat): int + public static function get(string $stat): int { return (int)Resque::redis()->get('stat:' . $stat); } diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index 550bdef..9164437 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -284,7 +284,7 @@ class Worker if ($blocking === true) { $job = \Resque\Job\Job::reserveBlocking($queues, $timeout); - if ($job) { + if (!is_null($job)) { $this->logger->log(\Psr\Log\LogLevel::INFO, 'Found job on {queue}', ['queue' => $job->queue]); return $job; } @@ -292,7 +292,7 @@ class Worker foreach ($queues as $queue) { $this->logger->log(\Psr\Log\LogLevel::INFO, 'Checking {queue} for jobs', ['queue' => $queue]); $job = \Resque\Job\Job::reserve($queue); - if ($job) { + if (!is_null($job)) { $this->logger->log(\Psr\Log\LogLevel::INFO, 'Found job on {queue}', ['queue' => $job->queue]); return $job; } @@ -491,7 +491,7 @@ class Worker public function registerWorker() { Resque::redis()->sadd('workers', (string)$this); - Resque::redis()->setex('worker:' . (string)$this . ':started', 172800, date('D M d H:i:s T Y')); + Resque::redis()->setex('worker:' . (string)$this . ':started', 86400, date('D M d H:i:s T Y')); } /** @@ -527,7 +527,7 @@ class Worker 'run_at' => date('D M d H:i:s T Y'), 'payload' => $job->payload ]); - Resque::redis()->setex('worker:' . $job->worker, 172800, $data); + Resque::redis()->setex('worker:' . $job->worker, 86400, $data); } /** @@ -567,9 +567,10 @@ class Worker * Get a statistic belonging to this worker. * * @param string $stat Statistic to fetch. + * * @return int Statistic value. */ - public function getStat($stat) + public function getStat(string $stat): int { return \Resque\Stat::get($stat . ':' . $this); } diff --git a/tests/Resque/Tests/JobTest.php b/tests/Resque/Tests/JobTest.php index 40c5506..7c9f1b0 100644 --- a/tests/Resque/Tests/JobTest.php +++ b/tests/Resque/Tests/JobTest.php @@ -34,7 +34,7 @@ class JobTest extends TestCase \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob'); $job = \Resque\Job\Job::reserve('jobs'); - if ($job == false) { + if (is_null($job)) { $this->fail('Job could not be reserved.'); } $this->assertEquals('jobs', $job->queue); @@ -76,7 +76,7 @@ class JobTest extends TestCase { \Resque\Resque::enqueue('jobs', '\Resque\Test\TestJob'); \Resque\Job\Job::reserve('jobs'); - $this->assertFalse(\Resque\Job\Job::reserve('jobs')); + $this->assertNull(\Resque\Job\Job::reserve('jobs')); } public function testRecreatedJobMatchesExistingJob() diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4d3cf91..c93fc96 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -11,7 +11,6 @@ namespace Resque\Test; */ $loader = require __DIR__ . '/../vendor/autoload.php'; -// $loader->add('Resque_Tests', __DIR__); # Redis configuration global $redisTestServer; From 6458563051d2d89601bba62438089e330de3d513 Mon Sep 17 00:00:00 2001 From: idanoo Date: Tue, 7 Feb 2023 14:18:40 +1300 Subject: [PATCH 30/45] Unit test PHP8.2 --- .woodpecker/.test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.woodpecker/.test.yml b/.woodpecker/.test.yml index ebb53ed..b217f69 100644 --- a/.woodpecker/.test.yml +++ b/.woodpecker/.test.yml @@ -3,6 +3,7 @@ matrix: - 7.4 - 8.0 - 8.1 + - 8.2 pipeline: unit-tests: @@ -19,7 +20,7 @@ pipeline: services: redis: - image: redis:latest + image: redis:7 depends_on: - lint \ No newline at end of file From ba52eb34c7162ca0e7484078909b2d2a29a2dbf5 Mon Sep 17 00:00:00 2001 From: idanoo Date: Tue, 7 Feb 2023 14:20:30 +1300 Subject: [PATCH 31/45] Update gitlab CI --- .gitlab-ci.yml | 27 ++++++++++----------------- .woodpecker/.lint.yml | 8 -------- .woodpecker/.test.yml | 26 -------------------------- 3 files changed, 10 insertions(+), 51 deletions(-) delete mode 100644 .woodpecker/.lint.yml delete mode 100644 .woodpecker/.test.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1e395f..d681cb2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,22 +16,15 @@ wget https://getcomposer.org/composer.phar php composer.phar install --dev -services: - - redis:latest - -# Test PHP 7.4 -test:7.4: - image: php:7.4 - before_script: - - *docker_boostrap - script: - - php vendor/bin/phpunit --verbose --configuration phpunit.xml - tags: - - docker - -# Test PHP 8.0 -test:8.1: - image: php:8.1 +# Test PHP +test: + image: php:$PHP_VERSION + services: + - redis:$REDIS_VERSION + parallel: + matrix: + - PHP_VERSION: [7.4, 8.0, 8.1, 8.2] + REDIS_VERSION: [7] before_script: - *docker_boostrap script: @@ -41,7 +34,7 @@ test:8.1: # Codestandards lint: - image: php:8.1 + image: php:8.2 allow_failure: true script: - apt update && apt install -y wget unzip git diff --git a/.woodpecker/.lint.yml b/.woodpecker/.lint.yml deleted file mode 100644 index 6e3f90f..0000000 --- a/.woodpecker/.lint.yml +++ /dev/null @@ -1,8 +0,0 @@ -pipeline: - lint: - image: php:8.1-cli - commands: - - apt update && apt install -y wget unzip git - - wget https://getcomposer.org/download/latest-stable/composer.phar - - php composer.phar install --dev - - php -d memory_limit=256M vendor/bin/phpcs -s --standard=ruleset.xml diff --git a/.woodpecker/.test.yml b/.woodpecker/.test.yml deleted file mode 100644 index b217f69..0000000 --- a/.woodpecker/.test.yml +++ /dev/null @@ -1,26 +0,0 @@ -matrix: - PHP_VERSION: - - 7.4 - - 8.0 - - 8.1 - - 8.2 - -pipeline: - unit-tests: - image: php:${PHP_VERSION}-cli - commands: - - apt-get update -yq - - apt-get install git wget procps unzip -y - - pecl install -o -f redis && rm -rf /tmp/pear - - docker-php-ext-enable redis - - docker-php-ext-install pcntl - - wget https://getcomposer.org/download/latest-stable/composer.phar - - php composer.phar install --dev - - php vendor/bin/phpunit --verbose --configuration phpunit.xml - -services: - redis: - image: redis:7 - -depends_on: - - lint \ No newline at end of file From ef82313d4e80473791caf7f50917d03020115dce Mon Sep 17 00:00:00 2001 From: idanoo Date: Tue, 7 Feb 2023 14:34:41 +1300 Subject: [PATCH 32/45] Update --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d681cb2..fc5de3a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,15 +16,15 @@ wget https://getcomposer.org/composer.phar php composer.phar install --dev +services: + - redis:7 + # Test PHP test: image: php:$PHP_VERSION - services: - - redis:$REDIS_VERSION parallel: matrix: - - PHP_VERSION: [7.4, 8.0, 8.1, 8.2] - REDIS_VERSION: [7] + - PHP_VERSION: [ "7.4", "8.0", "8.1", "8.2" ] before_script: - *docker_boostrap script: From 3c7e20e364335395a0399596d421f15ac425f773 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Tue, 7 Feb 2023 02:19:09 +0000 Subject: [PATCH 33/45] 2.1.0 (2023-02-07) - PHP 8.2 compatibility --- .gitlab-ci.yml | 4 +- CHANGELOG.md | 4 + README.md | 2 - composer.json | 15 +++- composer.lock | 142 ++++++++++++++++++++++++++++++++- ruleset.xml | 18 ++++- src/Resque/Job/Factory.php | 4 + src/Resque/Job/Job.php | 2 +- src/Resque/Resque.php | 2 +- tests/Resque/Tests/JobTest.php | 10 +++ tests/bootstrap.php | 12 +++ 11 files changed, 200 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fc5de3a..fe02d9b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,8 +8,8 @@ # Install pcntl and redis extentions pecl install -o -f redis \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable redis + && rm -rf /tmp/pear \ + && docker-php-ext-enable redis docker-php-ext-install pcntl # Install Composer diff --git a/CHANGELOG.md b/CHANGELOG.md index 8101a95..5e5634f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.0 (2022-02-07) +- Add PHP 8.1 / 8.2 unit tests +- Updated code to be PHP 8.2 compliant + ## 2.0.3 (2022-09-12) - Update composer packages - Added WoodpeckerCI tests diff --git a/README.md b/README.md index b7025a0..4c6ceb9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ php-resque: PHP Resque Worker (and Enqueue) =========================================== -[![Build Status](https://ci.tinker.nz/api/badges/idanoo/php-resque/status.svg)](https://ci.tinker.nz/idanoo/php-resque) - Resque is a Redis-backed library for creating background jobs, placing those jobs on one or more queues, and processing them later. diff --git a/composer.json b/composer.json index f7438df..60c281f 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ }, "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", "keywords": ["job", "background", "redis", "resque", "php"], - "homepage": "https://tinker.nz/idanoo/php-resque/", + "homepage": "https://gitlab.com/idanoo/php-resque/", "license": "MIT", "authors": [ { @@ -22,7 +22,9 @@ }, "require-dev": { "phpunit/phpunit": "^9", - "squizlabs/php_codesniffer": "3.*" + "squizlabs/php_codesniffer": "3.*", + "phpcompatibility/php-compatibility": "^9.3", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" }, "bin": [ "bin/resque" @@ -38,7 +40,12 @@ } }, "support": { - "issues": "https://tinker.nz/idanoo/php-resque/issues", - "source": "https://tinker.nz/idanoo/php-resque" + "issues": "https://gitlab.com/idanoo/php-resque/issues", + "source": "https://gitlab.com/idanoo/php-resque" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/composer.lock b/composer.lock index a5714d6..f3910d0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "67934d62707c83cdcba540469eff2fe7", + "content-hash": "3f81232ce308e8074ac0beeaec83a3eb", "packages": [ { "name": "colinmollenhour/credis", @@ -105,6 +105,84 @@ } ], "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "time": "2023-01-05T11:28:13+00:00" + }, { "name": "doctrine/instantiator", "version": "1.4.1", @@ -401,6 +479,68 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "time": "2019-12-27T09:44:58+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.17", diff --git a/ruleset.xml b/ruleset.xml index 7034ee6..6bd9f60 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -1,10 +1,9 @@ - - PSR12 + + PHP8.2 Ruleset . - - vendor/ + vendor tests/ @@ -12,8 +11,19 @@ + + + + + + + + + + diff --git a/src/Resque/Job/Factory.php b/src/Resque/Job/Factory.php index 380ca05..be04d8e 100644 --- a/src/Resque/Job/Factory.php +++ b/src/Resque/Job/Factory.php @@ -11,6 +11,10 @@ namespace Resque\Job; */ class Factory implements FactoryInterface { + public ?Job $job; + public string $queue; + public array $args; + /** * @param $className * @param array $args diff --git a/src/Resque/Job/Job.php b/src/Resque/Job/Job.php index 32ff7b2..8249559 100755 --- a/src/Resque/Job/Job.php +++ b/src/Resque/Job/Job.php @@ -174,7 +174,7 @@ class Job */ public function getInstance() { - if (!is_null($this->instance)) { + if (isset($this->instance) && !is_null($this->instance)) { return $this->instance; } diff --git a/src/Resque/Resque.php b/src/Resque/Resque.php index 06fff0d..e4872f9 100644 --- a/src/Resque/Resque.php +++ b/src/Resque/Resque.php @@ -12,7 +12,7 @@ namespace Resque; class Resque { - public const VERSION = '2.0.3'; + public const VERSION = '2.1.0'; public const DEFAULT_INTERVAL = 5; diff --git a/tests/Resque/Tests/JobTest.php b/tests/Resque/Tests/JobTest.php index 7c9f1b0..f6c261f 100644 --- a/tests/Resque/Tests/JobTest.php +++ b/tests/Resque/Tests/JobTest.php @@ -397,6 +397,11 @@ class JobTest extends TestCase class SomeJobClass implements \Resque\Job\JobInterface { + public static $called = false; + public $args = false; + public $queue; + public $job; + /** * @return bool */ @@ -408,6 +413,11 @@ class SomeJobClass implements \Resque\Job\JobInterface class Some_Stub_Factory implements \Resque\Job\FactoryInterface { + public static $called = false; + public $args = false; + public $queue; + public $job; + /** * @param $className * @param array $args diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c93fc96..cf26e96 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -35,6 +35,9 @@ if (function_exists('pcntl_signal')) { class TestJob { public static $called = false; + public $args = false; + public $queue; + public $job; public function perform() { @@ -48,6 +51,11 @@ class FailingJobException extends \Exception class FailingJob { + public static $called = false; + public $args = false; + public $queue; + public $job; + public function perform() { throw new FailingJobException('Message!'); @@ -62,6 +70,8 @@ class TestJobWithSetUp { public static $called = false; public $args = false; + public $queue; + public $job; public function setUp() { @@ -78,6 +88,8 @@ class TestJobWithTearDown { public static $called = false; public $args = false; + public $queue; + public $job; public function perform() { From 94cae8d271b6ca58486c4f31b359c298852f8385 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Mon, 20 Mar 2023 09:26:45 +1300 Subject: [PATCH 34/45] 2.1.1 (2023-03-20) - Update setex to set, add TTL to stats --- CHANGELOG.md | 4 ++++ src/Resque/Job/Status.php | 16 ++++++++++------ src/Resque/Stat.php | 31 +++++++++++++++++++++++-------- src/Resque/Worker.php | 13 +++++++++++-- tests/Resque/Tests/RedisTest.php | 7 ++++++- 5 files changed, 54 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 650ec73..b75f7d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.1.1 (2023-03-20) +- Changed setex to set with EX values +- Added TTLs to missing keys + ## 2.1.0 (2023-02-07) - Add PHP 8.1 / 8.2 unit tests - Updated code to be PHP 8.2 compliant diff --git a/src/Resque/Job/Status.php b/src/Resque/Job/Status.php index 2092820..0486394 100644 --- a/src/Resque/Job/Status.php +++ b/src/Resque/Job/Status.php @@ -59,7 +59,11 @@ class Status 'updated' => time(), 'started' => time(), ]; - \Resque\Resque::redis()->setex('job:' . $id . ':status', 86400, json_encode($statusPacket)); + \Resque\Resque::redis()->set( + 'job:' . $id . ':status', + json_encode($statusPacket), + ['ex' => time() + 86400], + ); } /** @@ -98,12 +102,12 @@ class Status 'status' => $status, 'updated' => time(), ]; - \Resque\Resque::redis()->setex((string)$this, 86400, json_encode($statusPacket)); - // Expire the status for completed jobs after 24 hours - if (in_array($status, self::$completeStatuses)) { - \Resque\Resque::redis()->expire((string)$this, 86400); - } + \Resque\Resque::redis()->set( + (string)$this, + json_encode($statusPacket), + ['ex' => time() + 86400], + ); } /** diff --git a/src/Resque/Stat.php b/src/Resque/Stat.php index 66cdb55..76bd069 100644 --- a/src/Resque/Stat.php +++ b/src/Resque/Stat.php @@ -29,11 +29,24 @@ class Stat * * @param string $stat The name of the statistic to increment. * @param int $by The amount to increment the statistic by. - * @return boolean True if successful, false if not. + * + * @return bool True if successful, false if not. */ - public static function incr($stat, $by = 1): bool + public static function incr(string $stat, int $by = 1): bool { - return (bool)Resque::redis()->incrby('stat:' . $stat, $by); + // Make sure we set a TTL by default + $set = Resque::redis()->set( + 'stat:' . $stat, + $by, + ['ex' => time() + 86400, 'nx'], + ); + + // If it already exists, return the incrby value + if (!$set) { + return (bool)Resque::redis()->incrby('stat:' . $stat, $by); + } + + return true; } /** @@ -41,9 +54,10 @@ class Stat * * @param string $stat The name of the statistic to decrement. * @param int $by The amount to decrement the statistic by. - * @return boolean True if successful, false if not. + * + * @return bool True if successful, false if not. */ - public static function decr($stat, $by = 1): bool + public static function decr(string $stat, int $by = 1): bool { return (bool)Resque::redis()->decrby('stat:' . $stat, $by); } @@ -52,10 +66,11 @@ class Stat * Delete a statistic with the given name. * * @param string $stat The name of the statistic to delete. - * @return boolean True if successful, false if not. + * + * @return bool True if successful, false if not. */ - public static function clear($stat): bool + public static function clear(string $stat): bool { - return (bool)Resque::redis()->del('stat:' . $stat); + return (bool)Resque::redis()->unlink('stat:' . $stat); } } diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index 9164437..1a03f92 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -491,7 +491,11 @@ class Worker public function registerWorker() { Resque::redis()->sadd('workers', (string)$this); - Resque::redis()->setex('worker:' . (string)$this . ':started', 86400, date('D M d H:i:s T Y')); + Resque::redis()->set( + 'worker:' . (string)$this . ':started', + date('D M d H:i:s T Y'), + ['ex' => time() + 86400], + ); } /** @@ -527,7 +531,12 @@ class Worker 'run_at' => date('D M d H:i:s T Y'), 'payload' => $job->payload ]); - Resque::redis()->setex('worker:' . $job->worker, 86400, $data); + + Resque::redis()->set( + 'worker:' . $job->worker, + $data, + ['ex' => time() + 86400], + ); } /** diff --git a/tests/Resque/Tests/RedisTest.php b/tests/Resque/Tests/RedisTest.php index a1a3814..200f208 100644 --- a/tests/Resque/Tests/RedisTest.php +++ b/tests/Resque/Tests/RedisTest.php @@ -14,7 +14,12 @@ class RedisTest extends TestCase { public function testRedisGetSet() { - $this->redis->setex("testKey", 3600, 24); + $this->redis->set( + 'testKey', + 24, + ['ex' => time() + 3600], + ); + $val = $this->redis->get("testKey"); $this->assertEquals(24, $val); } From 6737df5925ecfd653b2a7978b7d7c8b7a0be65f4 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Mon, 20 Mar 2023 10:44:47 +1300 Subject: [PATCH 35/45] Add sleep for tests --- src/Resque/Stat.php | 2 +- tests/Resque/Tests/WorkerTest.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Resque/Stat.php b/src/Resque/Stat.php index 76bd069..45bfe45 100644 --- a/src/Resque/Stat.php +++ b/src/Resque/Stat.php @@ -71,6 +71,6 @@ class Stat */ public static function clear(string $stat): bool { - return (bool)Resque::redis()->unlink('stat:' . $stat); + return (bool)Resque::redis()->del('stat:' . $stat); } } diff --git a/tests/Resque/Tests/WorkerTest.php b/tests/Resque/Tests/WorkerTest.php index a8d0a69..e1b22e4 100644 --- a/tests/Resque/Tests/WorkerTest.php +++ b/tests/Resque/Tests/WorkerTest.php @@ -198,6 +198,9 @@ class WorkerTest extends TestCase $worker->work(0); $worker->work(0); + // Allow time for async unlink to work + sleep(2); + $this->assertEquals(0, $worker->getStat('processed')); $this->assertEquals(0, $worker->getStat('failed')); } From c696723fd055e7464e8cebda741ada53d7b06407 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Mon, 20 Mar 2023 10:46:18 +1300 Subject: [PATCH 36/45] Fix linter --- src/Resque/Worker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index 1a03f92..6c19f13 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -533,7 +533,7 @@ class Worker ]); Resque::redis()->set( - 'worker:' . $job->worker, + 'worker:' . $job->worker, $data, ['ex' => time() + 86400], ); From 575509ff5347ca6407e46ae9d45f150b30cda9a1 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 22 Mar 2023 11:38:38 +1300 Subject: [PATCH 37/45] 2.1.2 (2023-03-22) - Update composer packages - Update git information (GitHub) --- .github/workflows/ci.yml | 36 ++++++++ CHANGELOG.md | 4 + composer.json | 8 +- composer.lock | 179 ++++++++++++++++++++------------------- 4 files changed, 136 insertions(+), 91 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ac6e91f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI +on: [push] +jobs: + Linter: + runs-on: ubuntu-latest + container: php:8.2 + steps: + - uses: actions/checkout@v3 + - name: Install composer + run: apt-get update -yq && apt-get install git wget procps unzip -y && pecl install -o -f redis && rm -rf /tmp/pear && docker-php-ext-enable redis && wget https://getcomposer.org/composer.phar && php composer.phar install --dev + - name: Validate composer.json and composer.lock + run: php composer.phar validate --strict + - name: Install dependencies + run: php composer.phar install --dev --prefer-dist --no-progress + - name: Run PHPCS Linter + run: php -d memory_limit=256M vendor/bin/phpcs -s --standard=ruleset.xml + PHPTest: + runs-on: ubuntu-latest + container: php:${{ matrix.php_version }} + strategy: + matrix: + php_version: [7.4, 8.0, 8.1, 8.2] + services: + redis: + image: redis:7.0 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v3 + - name: Install composer + run: apt-get update -yq && apt-get install git wget procps unzip -y && pecl install -o -f redis && rm -rf /tmp/pear && docker-php-ext-enable redis && wget https://getcomposer.org/composer.phar && php composer.phar install --dev + - name: Run PHP ${{ matrix.php_version }}} Unit Tests + run: php vendor/bin/phpunit --verbose --configuration phpunit.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index b75f7d4..7ac48fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.1.2 (2023-03-22) +- Update composer packages +- Update git information (GitHub) + # 2.1.1 (2023-03-20) - Changed setex to set with EX values - Added TTLs to missing keys diff --git a/composer.json b/composer.json index 60c281f..9f1d38f 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ }, "description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.", "keywords": ["job", "background", "redis", "resque", "php"], - "homepage": "https://gitlab.com/idanoo/php-resque/", + "homepage": "https://github.com/idanoo/php-resque", "license": "MIT", "authors": [ { @@ -18,7 +18,7 @@ "require": { "php": ">7.4", "psr/log": "^1.1.0", - "colinmollenhour/credis": "^1.13.0" + "colinmollenhour/credis": "^1.14.0" }, "require-dev": { "phpunit/phpunit": "^9", @@ -40,8 +40,8 @@ } }, "support": { - "issues": "https://gitlab.com/idanoo/php-resque/issues", - "source": "https://gitlab.com/idanoo/php-resque" + "issues": "https://github.com/idanoo/php-resque/issues", + "source": "https://github.com/idanoo/php-resque" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index f3910d0..6e21cde 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3f81232ce308e8074ac0beeaec83a3eb", + "content-hash": "71f4b3628e3e3b1682cddae59c246514", "packages": [ { "name": "colinmollenhour/credis", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/colinmollenhour/credis.git", - "reference": "85df015088e00daf8ce395189de22c8eb45c8d49" + "reference": "dccc8a46586475075fbb012d8bd523b8a938c2dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/85df015088e00daf8ce395189de22c8eb45c8d49", - "reference": "85df015088e00daf8ce395189de22c8eb45c8d49", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/dccc8a46586475075fbb012d8bd523b8a938c2dc", + "reference": "dccc8a46586475075fbb012d8bd523b8a938c2dc", "shasum": "" }, "require": { @@ -49,9 +49,9 @@ "homepage": "https://github.com/colinmollenhour/credis", "support": { "issues": "https://github.com/colinmollenhour/credis/issues", - "source": "https://github.com/colinmollenhour/credis/tree/v1.13.1" + "source": "https://github.com/colinmollenhour/credis/tree/v1.14.0" }, - "time": "2022-06-20T22:56:59+00:00" + "time": "2022-11-09T01:18:39+00:00" }, { "name": "psr/log", @@ -185,30 +185,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -235,7 +235,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -251,20 +251,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -302,7 +302,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -310,20 +310,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.1", + "version": "v4.15.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", "shasum": "" }, "require": { @@ -364,9 +364,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" }, - "time": "2022-09-04T07:30:47+00:00" + "time": "2023-03-05T19:49:14+00:00" }, { "name": "phar-io/manifest", @@ -543,23 +543,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.17", + "version": "9.2.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.15", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -574,8 +574,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -608,7 +608,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" }, "funding": [ { @@ -616,7 +616,7 @@ "type": "github" } ], - "time": "2022-08-30T12:24:04+00:00" + "time": "2023-03-06T12:58:08+00:00" }, { "name": "phpunit/php-file-iterator", @@ -861,20 +861,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.24", + "version": "9.6.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" + "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -892,19 +892,19 @@ "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", + "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.1", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -912,7 +912,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-master": "9.6-dev" } }, "autoload": { @@ -943,7 +943,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" }, "funding": [ { @@ -953,9 +953,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-08-30T07:42:16+00:00" + "time": "2023-03-09T06:34:10+00:00" }, { "name": "sebastian/cli-parser", @@ -1126,16 +1130,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -1188,7 +1192,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -1196,7 +1200,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -1323,16 +1327,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -1374,7 +1378,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -1382,20 +1386,20 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -1451,7 +1455,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -1459,7 +1463,7 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", @@ -1696,16 +1700,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -1744,10 +1748,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -1755,7 +1759,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -1814,16 +1818,16 @@ }, { "name": "sebastian/type", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb44e1cc6e557418387ad815780360057e40753e" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", - "reference": "fb44e1cc6e557418387ad815780360057e40753e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -1835,7 +1839,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1858,7 +1862,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.1.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -1866,7 +1870,7 @@ "type": "github" } ], - "time": "2022-08-29T06:55:37+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", @@ -1923,16 +1927,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -1968,14 +1972,15 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2022-06-18T07:21:10+00:00" + "time": "2023-02-22T23:07:41+00:00" }, { "name": "theseer/tokenizer", From 948b758a5721503d43b59b0cb1ffe0cc5446af18 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 15 Nov 2023 09:52:10 +1300 Subject: [PATCH 38/45] 2.1.3 (2023-11-15) - Resolved issue with SET EX TTL's using unix-timestamps --- CHANGELOG.md | 3 +++ README.md | 16 +++------------- src/Resque/Job/Status.php | 4 ++-- src/Resque/Stat.php | 2 +- src/Resque/Worker.php | 10 ++++++---- tests/Resque/Tests/RedisTest.php | 2 +- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ac48fb..03b7722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.1.3 (2023-11-15) +- Resolved issue with SET EX TTL's using unix-timestamps + # 2.1.2 (2023-03-22) - Update composer packages - Update git information (GitHub) diff --git a/README.md b/README.md index 4c6ceb9..552717c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -php-resque: PHP Resque Worker (and Enqueue) +php-resque: PHP Background (Resque) Worker =========================================== Resque is a Redis-backed library for creating background jobs, placing @@ -53,19 +53,9 @@ Composer package inside your project. If you're not familiar with Composer, please see . -1. Add php-resque to your application's composer.json. +1. Run `composer require idanoo/php-resque`. -```json -{ - "require": { - "idanoo/php-resque": "^2.0" - } -} -``` - -2. Run `composer install`. - -3. If you haven't already, add the Composer autoload to your project's +2. If you haven't already, add the Composer autoload to your project's initialization file. (example) ```sh diff --git a/src/Resque/Job/Status.php b/src/Resque/Job/Status.php index 0486394..aaa29c3 100644 --- a/src/Resque/Job/Status.php +++ b/src/Resque/Job/Status.php @@ -62,7 +62,7 @@ class Status \Resque\Resque::redis()->set( 'job:' . $id . ':status', json_encode($statusPacket), - ['ex' => time() + 86400], + ['ex' => (86400 * 2)], ); } @@ -106,7 +106,7 @@ class Status \Resque\Resque::redis()->set( (string)$this, json_encode($statusPacket), - ['ex' => time() + 86400], + ['ex' => (86400 * 2)], ); } diff --git a/src/Resque/Stat.php b/src/Resque/Stat.php index 45bfe45..6592aa8 100644 --- a/src/Resque/Stat.php +++ b/src/Resque/Stat.php @@ -38,7 +38,7 @@ class Stat $set = Resque::redis()->set( 'stat:' . $stat, $by, - ['ex' => time() + 86400, 'nx'], + ['ex' => (86400 * 2), 'nx'], ); // If it already exists, return the incrby value diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index 6c19f13..a926364 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -486,15 +486,17 @@ class Worker /** * Register this worker in Redis. - * 48 hour TTL so we don't pollute the db on server termination. + * 48 hour TTL so we don't pollute the redis db on server termination. + * + * @return void */ - public function registerWorker() + public function registerWorker(): void { Resque::redis()->sadd('workers', (string)$this); Resque::redis()->set( 'worker:' . (string)$this . ':started', date('D M d H:i:s T Y'), - ['ex' => time() + 86400], + ['ex' => (86400 * 2)], ); } @@ -535,7 +537,7 @@ class Worker Resque::redis()->set( 'worker:' . $job->worker, $data, - ['ex' => time() + 86400], + ['ex' => (86400 * 2)], ); } diff --git a/tests/Resque/Tests/RedisTest.php b/tests/Resque/Tests/RedisTest.php index 200f208..5717bf6 100644 --- a/tests/Resque/Tests/RedisTest.php +++ b/tests/Resque/Tests/RedisTest.php @@ -17,7 +17,7 @@ class RedisTest extends TestCase $this->redis->set( 'testKey', 24, - ['ex' => time() + 3600], + ['ex' => 3600], ); $val = $this->redis->get("testKey"); From 5ef4a63a6ed54dd59271549aa075e6d5b6a9e768 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 20 Mar 2024 19:00:25 +1300 Subject: [PATCH 39/45] 2.2.0 (2023-03-20) - Update pacakges - Bump requirements to PHP >= 8.1 --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 4 + composer.json | 2 +- composer.lock | 267 ++++++++++++++++++++++----------------- 4 files changed, 156 insertions(+), 119 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac6e91f..82e8048 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: container: php:${{ matrix.php_version }} strategy: matrix: - php_version: [7.4, 8.0, 8.1, 8.2] + php_version: [8.1, 8.2] services: redis: image: redis:7.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 03b7722..7a67e6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.2.0 (2023-03-20) +- Update pacakges +- Bump requirements to PHP >= 8.1 + # 2.1.3 (2023-11-15) - Resolved issue with SET EX TTL's using unix-timestamps diff --git a/composer.json b/composer.json index 9f1d38f..b034547 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">7.4", + "php": ">=8.1", "psr/log": "^1.1.0", "colinmollenhour/credis": "^1.14.0" }, diff --git a/composer.lock b/composer.lock index 6e21cde..41cc09c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "71f4b3628e3e3b1682cddae59c246514", + "content-hash": "3e6f3671c2543806a8e045bb8386f9cd", "packages": [ { "name": "colinmollenhour/credis", - "version": "v1.14.0", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/colinmollenhour/credis.git", - "reference": "dccc8a46586475075fbb012d8bd523b8a938c2dc" + "reference": "5641140e14a9679f5a6f66c97268727f9558b881" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/dccc8a46586475075fbb012d8bd523b8a938c2dc", - "reference": "dccc8a46586475075fbb012d8bd523b8a938c2dc", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/5641140e14a9679f5a6f66c97268727f9558b881", + "reference": "5641140e14a9679f5a6f66c97268727f9558b881", "shasum": "" }, "require": { @@ -49,9 +49,9 @@ "homepage": "https://github.com/colinmollenhour/credis", "support": { "issues": "https://github.com/colinmollenhour/credis/issues", - "source": "https://github.com/colinmollenhour/credis/tree/v1.14.0" + "source": "https://github.com/colinmollenhour/credis/tree/v1.16.0" }, - "time": "2022-11-09T01:18:39+00:00" + "time": "2023-10-26T17:02:51+00:00" }, { "name": "psr/log", @@ -185,30 +185,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -235,7 +235,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -251,7 +251,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "myclabs/deep-copy", @@ -314,25 +314,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -340,7 +342,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -364,26 +366,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2024-03-05T20:51:40+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -424,9 +427,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -543,23 +552,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.26", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -608,7 +617,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -616,7 +626,7 @@ "type": "github" } ], - "time": "2023-03-06T12:58:08+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -861,16 +871,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.5", + "version": "9.6.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" + "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a156980d78a6666721b7e8e8502fe210b587fcd", + "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd", "shasum": "" }, "require": { @@ -885,7 +895,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -943,7 +953,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.17" }, "funding": [ { @@ -959,20 +970,20 @@ "type": "tidelift" } ], - "time": "2023-03-09T06:34:10+00:00" + "time": "2024-02-23T13:14:51+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -1007,7 +1018,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -1015,7 +1026,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -1204,20 +1215,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -1249,7 +1260,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -1257,20 +1268,20 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -1315,7 +1326,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -1323,7 +1334,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -1390,16 +1401,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -1455,7 +1466,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -1463,20 +1474,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -1519,7 +1530,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -1527,24 +1538,24 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -1576,7 +1587,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -1584,7 +1595,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -1763,16 +1774,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { @@ -1784,7 +1795,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1805,8 +1816,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { @@ -1814,7 +1824,7 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { "name": "sebastian/type", @@ -1927,16 +1937,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.2", + "version": "3.9.0", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", "shasum": "" }, "require": { @@ -1946,11 +1956,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -1965,35 +1975,58 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", "standards", "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2023-02-22T23:07:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-02-16T15:06:51+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -2022,7 +2055,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -2030,7 +2063,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], @@ -2039,8 +2072,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">7.4" + "php": ">=8.1" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From 2c995bd613f5e5ff4196d9d87720e48dc4cd55c7 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 4 Sep 2024 18:50:32 +1200 Subject: [PATCH 40/45] v2.3.0 - Update packages --- CHANGELOG.md | 3 + composer.lock | 131 +++++++++++++++--------------- src/Resque/Job/Status.php | 4 +- src/Resque/Redis.php | 8 ++ src/Resque/Resque.php | 2 +- src/Resque/Stat.php | 2 +- src/Resque/Worker.php | 132 ++++++++++++++++++++----------- tests/Resque/Tests/RedisTest.php | 2 +- 8 files changed, 170 insertions(+), 114 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a67e6a..69a401e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.3.0 (2024-09-04) +- Update packages + # 2.2.0 (2023-03-20) - Update pacakges - Bump requirements to PHP >= 8.1 diff --git a/composer.lock b/composer.lock index 41cc09c..d6ce4a7 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "colinmollenhour/credis", - "version": "v1.16.0", + "version": "v1.16.1", "source": { "type": "git", "url": "https://github.com/colinmollenhour/credis.git", - "reference": "5641140e14a9679f5a6f66c97268727f9558b881" + "reference": "f11a89fd068d3e5db0c2b5a9ba8663bc36162e95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/5641140e14a9679f5a6f66c97268727f9558b881", - "reference": "5641140e14a9679f5a6f66c97268727f9558b881", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/f11a89fd068d3e5db0c2b5a9ba8663bc36162e95", + "reference": "f11a89fd068d3e5db0c2b5a9ba8663bc36162e95", "shasum": "" }, "require": { @@ -49,9 +49,9 @@ "homepage": "https://github.com/colinmollenhour/credis", "support": { "issues": "https://github.com/colinmollenhour/credis/issues", - "source": "https://github.com/colinmollenhour/credis/tree/v1.16.0" + "source": "https://github.com/colinmollenhour/credis/tree/v1.16.1" }, - "time": "2023-10-26T17:02:51+00:00" + "time": "2024-07-04T15:08:03+00:00" }, { "name": "psr/log", @@ -255,16 +255,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -272,11 +272,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -302,7 +303,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -310,20 +311,20 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", "shasum": "" }, "require": { @@ -334,7 +335,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -366,9 +367,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-07-01T20:03:41+00:00" }, { "name": "phar-io/manifest", @@ -552,35 +553,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.31", + "version": "9.2.32", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -589,7 +590,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -618,7 +619,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" }, "funding": [ { @@ -626,7 +627,7 @@ "type": "github" } ], - "time": "2024-03-02T06:37:42+00:00" + "time": "2024-08-22T04:23:01+00:00" }, { "name": "phpunit/php-file-iterator", @@ -871,45 +872,45 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.17", + "version": "9.6.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd" + "reference": "49d7820565836236411f5dc002d16dd689cde42f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a156980d78a6666721b7e8e8502fe210b587fcd", - "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f", + "reference": "49d7820565836236411f5dc002d16dd689cde42f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", + "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-code-coverage": "^9.2.31", + "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -954,7 +955,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.17" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20" }, "funding": [ { @@ -970,7 +971,7 @@ "type": "tidelift" } ], - "time": "2024-02-23T13:14:51+00:00" + "time": "2024-07-10T11:45:39+00:00" }, { "name": "sebastian/cli-parser", @@ -1937,16 +1938,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.0", + "version": "3.10.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", - "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", "shasum": "" }, "require": { @@ -2013,7 +2014,7 @@ "type": "open_collective" } ], - "time": "2024-02-16T15:06:51+00:00" + "time": "2024-07-21T23:26:44+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/Resque/Job/Status.php b/src/Resque/Job/Status.php index aaa29c3..6387c2a 100644 --- a/src/Resque/Job/Status.php +++ b/src/Resque/Job/Status.php @@ -62,7 +62,7 @@ class Status \Resque\Resque::redis()->set( 'job:' . $id . ':status', json_encode($statusPacket), - ['ex' => (86400 * 2)], + ['ex' => \Resque\Redis::DEFAULT_REDIS_TTL], ); } @@ -106,7 +106,7 @@ class Status \Resque\Resque::redis()->set( (string)$this, json_encode($statusPacket), - ['ex' => (86400 * 2)], + ['ex' => \Resque\Redis::DEFAULT_REDIS_TTL], ); } diff --git a/src/Resque/Redis.php b/src/Resque/Redis.php index f726feb..6590748 100644 --- a/src/Resque/Redis.php +++ b/src/Resque/Redis.php @@ -14,12 +14,14 @@ class Redis { /** * Redis Client + * * @var \Credis_Client */ private $driver; /** * Redis namespace + * * @var string */ private static $defaultNamespace = 'resque:'; @@ -39,6 +41,11 @@ class Redis */ public const DEFAULT_DATABASE = 0; + /** + * Default Redis TTL (2 days) + */ + public const DEFAULT_REDIS_TTL = 172800; + /** * @var array List of all commands in Redis that supply a key as their * first argument. Used to prefix keys with the Resque namespace. @@ -114,6 +121,7 @@ class Redis if (substr($namespace, -1) !== ':' && $namespace != '') { $namespace .= ':'; } + self::$defaultNamespace = $namespace; } diff --git a/src/Resque/Resque.php b/src/Resque/Resque.php index e4872f9..4ebdb5d 100644 --- a/src/Resque/Resque.php +++ b/src/Resque/Resque.php @@ -12,7 +12,7 @@ namespace Resque; class Resque { - public const VERSION = '2.1.0'; + public const VERSION = '2.3.0'; public const DEFAULT_INTERVAL = 5; diff --git a/src/Resque/Stat.php b/src/Resque/Stat.php index 6592aa8..6cfa6c1 100644 --- a/src/Resque/Stat.php +++ b/src/Resque/Stat.php @@ -38,7 +38,7 @@ class Stat $set = Resque::redis()->set( 'stat:' . $stat, $by, - ['ex' => (86400 * 2), 'nx'], + ['ex' => Redis::DEFAULT_REDIS_TTL, 'nx'], ); // If it already exists, return the incrby value diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index a926364..ffcdbb4 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -83,6 +83,7 @@ class Worker /** * Return all workers known to Resque as instantiated instances. + * * @return array */ public static function all(): array @@ -102,8 +103,10 @@ class Worker /** * Given a worker ID, check if it is registered/valid. * - * @param string $workerId ID of the worker. - * @return boolean True if the worker exists, false if not. + * @param string $workerId ID of the worker + * + * @return boolean True if the worker exists, false if not + * * @throws Resque_RedisException */ public static function exists($workerId): bool @@ -114,8 +117,10 @@ class Worker /** * Given a worker ID, find it and return an instantiated worker class for it. * - * @param string $workerId The ID of the worker. - * @return bool|Resque_Worker + * @param string $workerId The ID of the worker + * + * @return Resque_Worker|bool + * * @throws Resque_RedisException */ public static function find($workerId) @@ -123,11 +128,13 @@ class Worker if (false === strpos($workerId, ":") || !self::exists($workerId)) { return false; } + /** @noinspection PhpUnusedLocalVariableInspection */ list($hostname, $pid, $queues) = explode(':', $workerId, 3); $queues = explode(',', $queues); $worker = new self($queues); $worker->setId($workerId); + return $worker; } @@ -135,8 +142,10 @@ class Worker * Set the ID of this worker to a given ID string. * * @param string $workerId ID for the worker. + * + * @return void */ - public function setId($workerId) + public function setId($workerId): void { $this->id = $workerId; } @@ -150,9 +159,11 @@ class Worker * @param int $interval How often to check for new jobs across the queues. * @param bool $blocking * + * @return void + * * @throws Resque_RedisException */ - public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false) + public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false): void { $this->updateProcLine('Starting'); $this->startup(); @@ -251,11 +262,13 @@ class Worker } /** - * Process a single job. + * Process a single job * - * @param \Resque\Job\Job $job The job to be processed. + * @param \Resque\Job\Job $job The job to be processed + * + * @return void */ - public function perform(\Resque\Job\Job $job) + public function perform(\Resque\Job\Job $job): void { try { Event::trigger('afterFork', $job); @@ -273,7 +286,8 @@ class Worker /** * @param bool $blocking * @param int $timeout - * @return object|boolean Instance of \Resque\Job\Job if a job is found, false if not. + * + * @return object|boolean - Instance of \Resque\Job\Job if a job is found, false if not */ public function reserve($blocking = false, $timeout = null) { @@ -304,16 +318,17 @@ class Worker /** * Return an array containing all of the queues that this worker should use - * when searching for jobs. + * when searching for jobs * * If * is found in the list of queues, every queue will be searched in * alphabetic order. (@param boolean $fetch If true, and the queue is set to *, will fetch - * all queue names from redis. - * @return array Array of associated queues. - * @see $fetch) + * all queue names from redis * + * @param boolean $fetch + * + * @return array Array of associated queues */ - public function queues($fetch = true) + public function queues(bool $fetch = true): array { if (!in_array('*', $this->queues) || $fetch == false) { return $this->queues; @@ -321,13 +336,16 @@ class Worker $queues = Resque::queues(); sort($queues); + return $queues; } /** - * Perform necessary actions to start a worker. + * Perform necessary actions to start a worker + * + * @return void */ - private function startup() + private function startup(): void { $this->registerSigHandlers(); $this->pruneDeadWorkers(); @@ -340,9 +358,11 @@ class Worker * the name of the currently running process to indicate the current state * of a worker. * - * @param string $status The updated process title. + * @param string $status The updated process title + * + * @return void */ - private function updateProcLine($status) + private function updateProcLine($status): void { $processTitle = 'resque-' . Resque::VERSION . ': ' . $status; if (function_exists('cli_set_process_title') && PHP_OS !== 'Darwin') { @@ -359,8 +379,10 @@ class Worker * INT: Shutdown immediately and stop processing jobs. * QUIT: Shutdown after the current job finishes processing. * USR1: Kill the forked child immediately and continue processing jobs. + * + * @return void */ - private function registerSigHandlers() + private function registerSigHandlers(): void { if (!function_exists('pcntl_signal')) { return; @@ -376,9 +398,11 @@ class Worker } /** - * Signal handler callback for USR2, pauses processing of new jobs. + * Signal handler callback for USR2, pauses processing of new jobs + * + * @return void */ - public function pauseProcessing() + public function pauseProcessing(): void { $this->logger->log(\Psr\Log\LogLevel::NOTICE, 'USR2 received; pausing job processing'); $this->paused = true; @@ -387,8 +411,10 @@ class Worker /** * Signal handler callback for CONT, resumes worker allowing it to pick * up new jobs. + * + * @return void */ - public function unPauseProcessing() + public function unPauseProcessing(): void { $this->logger->log(\Psr\Log\LogLevel::NOTICE, 'CONT received; resuming job processing'); $this->paused = false; @@ -397,8 +423,10 @@ class Worker /** * Schedule a worker for shutdown. Will finish processing the current job * and when the timeout interval is reached, the worker will shut down. + * + * @return void */ - public function shutdown() + public function shutdown(): void { $this->shutdown = true; $this->logger->log(\Psr\Log\LogLevel::NOTICE, 'Shutting down'); @@ -407,8 +435,10 @@ class Worker /** * Force an immediate shutdown of the worker, killing any child jobs * currently running. + * + * @return void */ - public function shutdownNow() + public function shutdownNow(): void { $this->shutdown(); $this->killChild(); @@ -417,8 +447,10 @@ class Worker /** * Kill a forked child job immediately. The job it is processing will not * be completed. + * + * @return void */ - public function killChild() + public function killChild(): void { if (!$this->child) { $this->logger->log(\Psr\Log\LogLevel::DEBUG, 'No child to kill.'); @@ -447,8 +479,10 @@ class Worker * This is a form of garbage collection to handle cases where the * server may have been killed and the Resque workers did not die gracefully * and therefore leave state information in Redis. + * + * @return void */ - public function pruneDeadWorkers() + public function pruneDeadWorkers(): void { $workerPids = $this->workerPids(); $workers = self::all(); @@ -474,7 +508,7 @@ class Worker * * @return array Array of Resque worker process IDs. */ - public function workerPids() + public function workerPids(): array { $pids = []; exec('ps -A -o pid,command | grep [r]esque', $cmdOutput); @@ -496,14 +530,16 @@ class Worker Resque::redis()->set( 'worker:' . (string)$this . ':started', date('D M d H:i:s T Y'), - ['ex' => (86400 * 2)], + ['ex' => Redis::DEFAULT_REDIS_TTL], ); } /** * Unregister this worker in Redis. (shutdown etc) + * + * @return void */ - public function unregisterWorker() + public function unregisterWorker(): void { if (is_object($this->currentJob)) { $this->currentJob->fail(new \Resque\Job\DirtyExitException()); @@ -518,12 +554,15 @@ class Worker } /** - * Tell Redis which job we're currently working on. + * Tell Redis which job we're currently working on + * + * @param \Resque\Job\Job $job \Resque\Job\Job instance containing the job we're working on + * + * @return void * - * @param \Resque\Job\Job $job \Resque\Job\Job instance containing the job we're working on. * @throws Resque_RedisException */ - public function workingOn(\Resque\Job\Job $job) + public function workingOn(\Resque\Job\Job $job): void { $job->worker = $this; $this->currentJob = $job; @@ -537,15 +576,17 @@ class Worker Resque::redis()->set( 'worker:' . $job->worker, $data, - ['ex' => (86400 * 2)], + ['ex' => Redis::DEFAULT_REDIS_TTL], ); } /** * Notify Redis that we've finished working on a job, clearing the working - * state and incrementing the job stats. + * state and incrementing the job stats + * + * @return void */ - public function doneWorking() + public function doneWorking(): void { $this->currentJob = null; Stat::incr('processed'); @@ -554,28 +595,29 @@ class Worker } /** - * Generate a string representation of this worker. + * Generate a string representation of this worker * - * @return string String identifier for this worker instance. + * @return string String identifier for this worker instance */ - public function __toString() + public function __toString(): string { - return $this->id; + return (string) $this->id; } /** - * Return an object describing the job this worker is currently working on. + * Return an object describing the job this worker is currently working on * - * @return array Array with details of current job. + * @return array Array with details of current job */ public function job(): array { $job = Resque::redis()->get('worker:' . $this); + return $job ? json_decode($job, true) : []; } /** - * Get a statistic belonging to this worker. + * Get a statistic belonging to this worker * * @param string $stat Statistic to fetch. * @@ -590,8 +632,10 @@ class Worker * Inject the logging object into the worker * * @param \Psr\Log\LoggerInterface $logger + * + * @return void */ - public function setLogger(\Psr\Log\LoggerInterface $logger) + public function setLogger(\Psr\Log\LoggerInterface $logger): void { $this->logger = $logger; } diff --git a/tests/Resque/Tests/RedisTest.php b/tests/Resque/Tests/RedisTest.php index 5717bf6..b834f93 100644 --- a/tests/Resque/Tests/RedisTest.php +++ b/tests/Resque/Tests/RedisTest.php @@ -17,7 +17,7 @@ class RedisTest extends TestCase $this->redis->set( 'testKey', 24, - ['ex' => 3600], + ['ex' => \Resque\Redis::DEFAULT_REDIS_TTL], ); $val = $this->redis->get("testKey"); From 81fe761577085446efa0fd4aa7da0d97fc416810 Mon Sep 17 00:00:00 2001 From: idanoo Date: Wed, 11 Dec 2024 14:18:25 +1300 Subject: [PATCH 41/45] v3.4.0 - Update packages --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 3 ++ composer.json | 2 +- composer.lock | 74 ++++++++++++++++++++-------------------- src/Resque/Log.php | 2 +- 5 files changed, 43 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82e8048..b270598 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: container: php:${{ matrix.php_version }} strategy: matrix: - php_version: [8.1, 8.2] + php_version: [8.1, 8.2,8.3,8.4] services: redis: image: redis:7.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 69a401e..2a3379e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.4.0 (2024-12-11) +- Update packages (psr/log ^3.0.2) + # 2.3.0 (2024-09-04) - Update packages diff --git a/composer.json b/composer.json index b034547..183efaa 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=8.1", - "psr/log": "^1.1.0", + "psr/log": "^3.0.2", "colinmollenhour/credis": "^1.14.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index d6ce4a7..d1be433 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3e6f3671c2543806a8e045bb8386f9cd", + "content-hash": "41f50fbbaf38787881da45b3077408fb", "packages": [ { "name": "colinmollenhour/credis", @@ -55,30 +55,30 @@ }, { "name": "psr/log", - "version": "1.1.4", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -99,9 +99,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2024-09-11T13:17:53+00:00" } ], "packages-dev": [ @@ -255,16 +255,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "shasum": "" }, "require": { @@ -303,7 +303,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" }, "funding": [ { @@ -311,20 +311,20 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2024-11-08T17:47:46+00:00" }, { "name": "nikic/php-parser", - "version": "v5.1.0", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { @@ -367,9 +367,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" }, - "time": "2024-07-01T20:03:41+00:00" + "time": "2024-10-08T18:51:32+00:00" }, { "name": "phar-io/manifest", @@ -872,16 +872,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.20", + "version": "9.6.22", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "49d7820565836236411f5dc002d16dd689cde42f" + "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f", - "reference": "49d7820565836236411f5dc002d16dd689cde42f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f80235cb4d3caa59ae09be3adf1ded27521d1a9c", + "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c", "shasum": "" }, "require": { @@ -892,11 +892,11 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.12.0", + "myclabs/deep-copy": "^1.12.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.31", + "phpunit/php-code-coverage": "^9.2.32", "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.4", @@ -955,7 +955,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.22" }, "funding": [ { @@ -971,7 +971,7 @@ "type": "tidelift" } ], - "time": "2024-07-10T11:45:39+00:00" + "time": "2024-12-05T13:48:26+00:00" }, { "name": "sebastian/cli-parser", @@ -1938,16 +1938,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.2", + "version": "3.11.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", + "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", "shasum": "" }, "require": { @@ -2014,7 +2014,7 @@ "type": "open_collective" } ], - "time": "2024-07-21T23:26:44+00:00" + "time": "2024-11-16T12:02:36+00:00" }, { "name": "theseer/tokenizer", @@ -2069,12 +2069,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=8.1" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/src/Resque/Log.php b/src/Resque/Log.php index e446a72..d759a0e 100644 --- a/src/Resque/Log.php +++ b/src/Resque/Log.php @@ -27,7 +27,7 @@ class Log extends \Psr\Log\AbstractLogger * @param array $context Variables to replace { placeholder } * @return null */ - public function log($level, $message, array $context = []) + public function log($level, \Stringable|string $message, array $context = []): void { $logLevels = [ 'emergency', From e3ac97920cd815af0bc8b8ead37fb06d1c70fd9b Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 8 Jun 2025 13:47:37 +1200 Subject: [PATCH 42/45] v2.5.0 - Update packages/docs --- CHANGELOG.md | 3 ++ README.md | 28 ++++++++------- composer.lock | 74 ++++++++++++++++++++++---------------- src/Resque/Event.php | 9 +++-- src/Resque/Job/Factory.php | 3 ++ src/Resque/Redis.php | 11 ------ src/Resque/Resque.php | 2 +- src/Resque/Worker.php | 1 + 8 files changed, 74 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a3379e..db43114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.5.0 (205-06-08) +- Update packages + # 2.4.0 (2024-12-11) - Update packages (psr/log ^3.0.2) diff --git a/README.md b/README.md index 552717c..c2d7234 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ On top of the original fork (chrisboulton/php-resque) I have added: ## Requirements ## -* PHP 7.0+ +* PHP 8.1+ * phpredis * Redis 2.2+ @@ -74,7 +74,7 @@ Resque::setBackend('redis:6379'); $args = ['name' => 'TestName']; -Resque::enqueue('default', 'My_Job', $args); +Resque::enqueue('default', '\App\MyJobClass', $args); ``` ### Defining Jobs ### @@ -82,7 +82,9 @@ Resque::enqueue('default', 'My_Job', $args); Each job should be in its own class, and include a `perform` method. ```php -class My_Job +namespace \App; + +class MyJobClass { public function perform() { @@ -105,7 +107,9 @@ The `tearDown` method, if defined, will be called after the job finishes. ```php -class My_Job +namespace App; + +class MyJobClass { public function setUp() { @@ -129,17 +133,17 @@ class My_Job This method can be used to conveniently remove a job from a queue. ```php -// Removes job class 'My_Job' of queue 'default' -Resque::dequeue('default', ['My_Job']); +// Removes job class '\App\MyJobClass' of queue 'default' +Resque::dequeue('default', ['\App\MyJobClass']); -// Removes job class 'My_Job' with Job ID '087df5819a790ac666c9608e2234b21e' of queue 'default' -Resque::dequeue('default', ['My_Job' => '087df5819a790ac666c9608e2234b21e']); +// Removes job class '\App\MyJobClass' with Job ID '087df5819a790ac666c9608e2234b21e' of queue 'default' +Resque::dequeue('default', ['\App\MyJobClass' => '087df5819a790ac666c9608e2234b21e']); -// Removes job class 'My_Job' with arguments of queue 'default' -Resque::dequeue('default', ['My_Job' => ['foo' => 1, 'bar' => 2]]); +// Removes job class '\App\MyJobClass' with arguments of queue 'default' +Resque::dequeue('default', ['\App\MyJobClass' => ['foo' => 1, 'bar' => 2]]); // Removes multiple jobs -Resque::dequeue('default', ['My_Job', 'My_Job2']); +Resque::dequeue('default', ['\App\MyJobClass', '\App\MyJobClass2']); ``` If no jobs are given, this method will dequeue all jobs matching the provided queue. @@ -160,7 +164,7 @@ To track the status of a job, pass `true` as the fourth argument to returned: ```php -$token = Resque::enqueue('default', 'My_Job', $args, true); +$token = Resque::enqueue('default', '\App\MyJobClass', $args, true); echo $token; ``` diff --git a/composer.lock b/composer.lock index d1be433..d5f144c 100644 --- a/composer.lock +++ b/composer.lock @@ -8,20 +8,20 @@ "packages": [ { "name": "colinmollenhour/credis", - "version": "v1.16.1", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/colinmollenhour/credis.git", - "reference": "f11a89fd068d3e5db0c2b5a9ba8663bc36162e95" + "reference": "f4930b426f6b1238b687a1ffe6ee5af7f835b40a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/f11a89fd068d3e5db0c2b5a9ba8663bc36162e95", - "reference": "f11a89fd068d3e5db0c2b5a9ba8663bc36162e95", + "url": "https://api.github.com/repos/colinmollenhour/credis/zipball/f4930b426f6b1238b687a1ffe6ee5af7f835b40a", + "reference": "f4930b426f6b1238b687a1ffe6ee5af7f835b40a", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": ">=7.4.0" }, "suggest": { "ext-redis": "Improved performance for communicating with redis" @@ -49,9 +49,9 @@ "homepage": "https://github.com/colinmollenhour/credis", "support": { "issues": "https://github.com/colinmollenhour/credis/issues", - "source": "https://github.com/colinmollenhour/credis/tree/v1.16.1" + "source": "https://github.com/colinmollenhour/credis/tree/v1.17.0" }, - "time": "2024-07-04T15:08:03+00:00" + "time": "2025-02-10T18:58:46+00:00" }, { "name": "psr/log", @@ -255,16 +255,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.1", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", "shasum": "" }, "require": { @@ -303,7 +303,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" }, "funding": [ { @@ -311,20 +311,20 @@ "type": "tidelift" } ], - "time": "2024-11-08T17:47:46+00:00" + "time": "2025-04-29T12:36:36+00:00" }, { "name": "nikic/php-parser", - "version": "v5.3.1", + "version": "v5.5.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + "reference": "ae59794362fe85e051a58ad36b289443f57be7a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ae59794362fe85e051a58ad36b289443f57be7a9", + "reference": "ae59794362fe85e051a58ad36b289443f57be7a9", "shasum": "" }, "require": { @@ -367,9 +367,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.5.0" }, - "time": "2024-10-08T18:51:32+00:00" + "time": "2025-05-31T08:24:38+00:00" }, { "name": "phar-io/manifest", @@ -872,16 +872,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.22", + "version": "9.6.23", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c" + "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f80235cb4d3caa59ae09be3adf1ded27521d1a9c", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", + "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", "shasum": "" }, "require": { @@ -892,7 +892,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.12.1", + "myclabs/deep-copy": "^1.13.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", @@ -955,7 +955,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.22" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23" }, "funding": [ { @@ -966,12 +966,20 @@ "url": "https://github.com/sebastianbergmann", "type": "github" }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, { "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "type": "tidelift" } ], - "time": "2024-12-05T13:48:26+00:00" + "time": "2025-05-02T06:40:34+00:00" }, { "name": "sebastian/cli-parser", @@ -1938,16 +1946,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.11.1", + "version": "3.13.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87" + "reference": "65ff2489553b83b4597e89c3b8b721487011d186" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", - "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/65ff2489553b83b4597e89c3b8b721487011d186", + "reference": "65ff2489553b83b4597e89c3b8b721487011d186", "shasum": "" }, "require": { @@ -2012,9 +2020,13 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" } ], - "time": "2024-11-16T12:02:36+00:00" + "time": "2025-05-11T03:36:00+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/Resque/Event.php b/src/Resque/Event.php index 7886640..f445375 100644 --- a/src/Resque/Event.php +++ b/src/Resque/Event.php @@ -22,6 +22,7 @@ class Event * * @param string $event Name of event to be raised. * @param mixed $data Optional, any data that should be passed to each callback. + * * @return true */ public static function trigger($event, $data = null) @@ -49,7 +50,8 @@ class Event * Listen in on a given event to have a specified callback fired. * * @param string $event Name of event to listen on. - * @param mixed $callback Any callback callable by call_user_func_array. + * @param mixed $callback Any callback callable by call_user_func_array + * * @return true */ public static function listen($event, $callback) @@ -67,6 +69,7 @@ class Event * * @param string $event Name of event. * @param mixed $callback The callback as defined when listen() was called. + * * @return true */ public static function stopListening($event, $callback) @@ -85,8 +88,10 @@ class Event /** * Call all registered listeners. + * + * @return void */ - public static function clearListeners() + public static function clearListeners(): void { self::$events = []; } diff --git a/src/Resque/Job/Factory.php b/src/Resque/Job/Factory.php index be04d8e..9ee0b74 100644 --- a/src/Resque/Job/Factory.php +++ b/src/Resque/Job/Factory.php @@ -9,6 +9,7 @@ namespace Resque\Job; * @author Daniel Mason * @license http://www.opensource.org/licenses/mit-license.php */ + class Factory implements FactoryInterface { public ?Job $job; @@ -16,6 +17,8 @@ class Factory implements FactoryInterface public array $args; /** + * Create job factory + * * @param $className * @param array $args * @param $queue diff --git a/src/Resque/Redis.php b/src/Resque/Redis.php index 6590748..5537b55 100644 --- a/src/Resque/Redis.php +++ b/src/Resque/Redis.php @@ -97,17 +97,6 @@ class Redis 'rename', 'rpoplpush' ]; - // sinterstore - // sunion - // sunionstore - // sdiff - // sdiffstore - // sinter - // smove - // mget - // msetnx - // mset - // renamenx /** * Set Redis namespace (prefix) default: resque diff --git a/src/Resque/Resque.php b/src/Resque/Resque.php index 4ebdb5d..4e933a8 100644 --- a/src/Resque/Resque.php +++ b/src/Resque/Resque.php @@ -12,7 +12,7 @@ namespace Resque; class Resque { - public const VERSION = '2.3.0'; + public const VERSION = '2.5.0'; public const DEFAULT_INTERVAL = 5; diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index ffcdbb4..fc08303 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -97,6 +97,7 @@ class Worker foreach ($workers as $workerId) { $instances[] = self::find($workerId); } + return $instances; } From eb3395645ff078b5256296fe288c3819b740cd15 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 8 Jun 2025 13:59:27 +1200 Subject: [PATCH 43/45] v2.5.1 - Update psr/log reqs --- CHANGELOG.md | 5 ++++- composer.json | 2 +- src/Resque/Resque.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db43114..44c37b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ -# 2.5.0 (205-06-08) +# 2.5.1 (2025-06-08) +- Update psr/log version requirements + +# 2.5.0 (2025-06-08) - Update packages # 2.4.0 (2024-12-11) diff --git a/composer.json b/composer.json index 183efaa..15199f0 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=8.1", - "psr/log": "^3.0.2", + "psr/log": "^1.1 || ^2.0 || ^3.0", "colinmollenhour/credis": "^1.14.0" }, "require-dev": { diff --git a/src/Resque/Resque.php b/src/Resque/Resque.php index 4e933a8..aca7065 100644 --- a/src/Resque/Resque.php +++ b/src/Resque/Resque.php @@ -12,7 +12,7 @@ namespace Resque; class Resque { - public const VERSION = '2.5.0'; + public const VERSION = '2.5.1'; public const DEFAULT_INTERVAL = 5; From b9042358e16748996e1844abd3194fb7375f9940 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 8 Jun 2025 14:21:33 +1200 Subject: [PATCH 44/45] v2.5.2 add support for psr/log ^1 --- CHANGELOG.md | 3 +++ composer.lock | 2 +- src/Resque/Log.php | 3 ++- src/Resque/Resque.php | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44c37b4..f65b2b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.5.2 (2025-06-08) +- Update typing of Log() to support all psr\log versions + # 2.5.1 (2025-06-08) - Update psr/log version requirements diff --git a/composer.lock b/composer.lock index d5f144c..bb2aed1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "41f50fbbaf38787881da45b3077408fb", + "content-hash": "d8e5313006d5c73b54ee6a410b1ad016", "packages": [ { "name": "colinmollenhour/credis", diff --git a/src/Resque/Log.php b/src/Resque/Log.php index d759a0e..3756f52 100644 --- a/src/Resque/Log.php +++ b/src/Resque/Log.php @@ -25,9 +25,10 @@ class Log extends \Psr\Log\AbstractLogger * @param mixed $level PSR-3 log level constant, or equivalent string * @param string $message Message to log, may contain a { placeholder } * @param array $context Variables to replace { placeholder } + * * @return null */ - public function log($level, \Stringable|string $message, array $context = []): void + public function log($level, string|\Stringable $message, array $context = []): void { $logLevels = [ 'emergency', diff --git a/src/Resque/Resque.php b/src/Resque/Resque.php index aca7065..97d579d 100644 --- a/src/Resque/Resque.php +++ b/src/Resque/Resque.php @@ -12,7 +12,7 @@ namespace Resque; class Resque { - public const VERSION = '2.5.1'; + public const VERSION = '2.5.2'; public const DEFAULT_INTERVAL = 5; From aad9334fbab946946aad5d8a4bb424c33bed4809 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 8 Jun 2025 15:20:22 +1200 Subject: [PATCH 45/45] 2.5.3 - Update LOG() --- CHANGELOG.md | 5 ++++- src/Resque/Log.php | 2 +- src/Resque/Resque.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f65b2b7..276f6e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ -# 2.5.2 (2025-06-08) +# 2.5.3 (2025-06-08) +- Update typing of Log() to support all psr\log versions + +- # 2.5.2 (2025-06-08) - Update typing of Log() to support all psr\log versions # 2.5.1 (2025-06-08) diff --git a/src/Resque/Log.php b/src/Resque/Log.php index 3756f52..2608d87 100644 --- a/src/Resque/Log.php +++ b/src/Resque/Log.php @@ -28,7 +28,7 @@ class Log extends \Psr\Log\AbstractLogger * * @return null */ - public function log($level, string|\Stringable $message, array $context = []): void + public function log($level, $message, array $context = []): void { $logLevels = [ 'emergency', diff --git a/src/Resque/Resque.php b/src/Resque/Resque.php index 97d579d..f193e18 100644 --- a/src/Resque/Resque.php +++ b/src/Resque/Resque.php @@ -12,7 +12,7 @@ namespace Resque; class Resque { - public const VERSION = '2.5.2'; + public const VERSION = '2.5.3'; public const DEFAULT_INTERVAL = 5;