From 2c995bd613f5e5ff4196d9d87720e48dc4cd55c7 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 4 Sep 2024 18:50:32 +1200 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 5/6] 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 6/6] 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;