diff --git a/.github/workflows/deptrac.yml b/.github/workflows/deptrac.yml index 78b7ecf..a41e15d 100644 --- a/.github/workflows/deptrac.yml +++ b/.github/workflows/deptrac.yml @@ -20,4 +20,4 @@ on: jobs: deptrac: - uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI46 + uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI47 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index f9550ba..8e6ec0f 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.2', '8.4'] + php-versions: ['8.2', '8.5'] steps: - name: Checkout diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index bc10d9f..bb545b6 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -38,7 +38,7 @@ jobs: if: "!contains(github.event.head_commit.message, '[ci skip]')" strategy: matrix: - php-versions: ['8.2', '8.3', '8.4'] + php-versions: ['8.2', '8.3', '8.4', '8.5'] db-platforms: ['MySQLi', 'SQLite3'] include: # Postgre diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 9ce2ffd..194bf9e 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.2', '8.4'] + php-versions: ['8.2', '8.5'] steps: - name: Checkout diff --git a/README.md b/README.md index f4c6ee0..caf5e99 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Queues for the CodeIgniter 4 framework. [![Deptrac](https://github.com/codeigniter4/queue/actions/workflows/deptrac.yml/badge.svg)](https://github.com/codeigniter4/queue/actions/workflows/deptrac.yml) [![Coverage Status](https://coveralls.io/repos/github/codeigniter4/queue/badge.svg?branch=develop)](https://coveralls.io/github/codeigniter4/queue?branch=develop) -![PHP](https://img.shields.io/badge/PHP-%5E8.1-blue) +![PHP](https://img.shields.io/badge/PHP-%5E8.2-blue) ![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.3-blue) ![License](https://img.shields.io/badge/License-MIT-blue) diff --git a/composer.json b/composer.json index bf1ace2..0320b25 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "homepage": "https://github.com/codeigniter4/queue", "require": { - "php": "^8.1" + "php": "^8.2" }, "require-dev": { "codeigniter4/devkit": "^1.3", diff --git a/docs/index.md b/docs/index.md index 0bd0af0..148fd72 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,7 +18,7 @@ Listen for queued jobs. ### Requirements -- PHP 8.1+ +- PHP 8.2+ - CodeIgniter 4.3+ If you use `database` handler: diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 399b947..92533f9 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -10,12 +10,6 @@ parameters: ignoreErrors: - message: '#Call to method PHPUnit\\Framework\\Assert::assertInstanceOf\(\) with.#' - - - message: '#Call to deprecated function random_string\(\):#' - paths: - - src/Handlers/RedisHandler.php - - src/Handlers/PredisHandler.php - - src/Handlers/RabbitMQHandler.php - message: '#Call to an undefined method CodeIgniter\\Queue\\Models\\QueueJobFailedModel::affectedRows\(\).#' paths: diff --git a/src/Commands/QueueWork.php b/src/Commands/QueueWork.php index 550da49..d3a8848 100644 --- a/src/Commands/QueueWork.php +++ b/src/Commands/QueueWork.php @@ -492,6 +492,8 @@ private function checkStop(string $queue, float $startTime): bool /** * Handle interruption + * + * @phpstan-ignore method.unused */ private function onInterruption(int $signal): void { diff --git a/src/Handlers/BaseHandler.php b/src/Handlers/BaseHandler.php index 38c9beb..48a4acd 100644 --- a/src/Handlers/BaseHandler.php +++ b/src/Handlers/BaseHandler.php @@ -70,6 +70,7 @@ public function retry(?int $id, ?string $queue): int ) ->findAll(); + /** @var list $jobs */ foreach ($jobs as $job) { $this->setPriority($job->priority)->push($job->queue, $job->payload['job'], $job->payload['data']); $this->forget($job->id); diff --git a/tests/DatabaseHandlerTest.php b/tests/DatabaseHandlerTest.php index 77df5be..dadd42e 100644 --- a/tests/DatabaseHandlerTest.php +++ b/tests/DatabaseHandlerTest.php @@ -345,6 +345,7 @@ public function testLater(): void 'id' => 2, 'status' => Status::RESERVED->value, ]); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->later($queueJob, 60); @@ -366,7 +367,8 @@ public function testFailedAndKeepJob(): void $handler = new DatabaseHandler($this->config); $queueJob = $handler->pop('queue1', ['default']); - $err = new Exception('Sample exception'); + $err = new Exception('Sample exception'); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->failed($queueJob, $err, true); $this->assertTrue($result); @@ -386,7 +388,8 @@ public function testFailedAndDontKeepJob(): void $handler = new DatabaseHandler($this->config); $queueJob = $handler->pop('queue1', ['default']); - $err = new Exception('Sample exception'); + $err = new Exception('Sample exception'); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->failed($queueJob, $err, false); $this->assertTrue($result); @@ -407,6 +410,7 @@ public function testDone(): void { $handler = new DatabaseHandler($this->config); $queueJob = $handler->pop('queue1', ['default']); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->done($queueJob); @@ -476,7 +480,8 @@ public function testFlush(): void $handler = new DatabaseHandler($this->config); $queueJob = $handler->pop('queue1', ['default']); - $err = new Exception('Sample exception here'); + $err = new Exception('Sample exception here'); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->failed($queueJob, $err, true); $this->assertTrue($result); diff --git a/tests/PredisHandlerTest.php b/tests/PredisHandlerTest.php index 935dd65..8fcf4e2 100644 --- a/tests/PredisHandlerTest.php +++ b/tests/PredisHandlerTest.php @@ -264,6 +264,7 @@ public function testLater(): void $predis = self::getPrivateProperty($handler, 'predis'); $this->assertSame(1, $predis->hexists('queues:queue1::reserved', $queueJob->id)); $this->assertSame(0, $predis->zcard('queues:queue1:default')); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->later($queueJob, 60); @@ -280,7 +281,8 @@ public function testFailedAndKeepJob(): void $handler = new PredisHandler($this->config); $queueJob = $handler->pop('queue1', ['default']); - $err = new Exception('Sample exception'); + $err = new Exception('Sample exception'); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->failed($queueJob, $err, true); $predis = self::getPrivateProperty($handler, 'predis'); @@ -304,7 +306,8 @@ public function testFailedAndDontKeepJob(): void $handler = new PredisHandler($this->config); $queueJob = $handler->pop('queue1', ['default']); - $err = new Exception('Sample exception'); + $err = new Exception('Sample exception'); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->failed($queueJob, $err, false); $predis = self::getPrivateProperty($handler, 'predis'); @@ -330,6 +333,7 @@ public function testDone(): void $predis = self::getPrivateProperty($handler, 'predis'); $this->assertSame(0, $predis->zcard('queues:queue1:default')); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->done($queueJob); diff --git a/tests/RedisHandlerTest.php b/tests/RedisHandlerTest.php index ba12413..0b64d0b 100644 --- a/tests/RedisHandlerTest.php +++ b/tests/RedisHandlerTest.php @@ -252,6 +252,7 @@ public function testLater(): void $redis = self::getPrivateProperty($handler, 'redis'); $this->assertTrue($redis->hExists('queues:queue1::reserved', (string) $queueJob->id)); $this->assertSame(0, $redis->zCard('queues:queue1:default')); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->later($queueJob, 60); @@ -265,7 +266,8 @@ public function testFailedAndKeepJob(): void $handler = new RedisHandler($this->config); $queueJob = $handler->pop('queue1', ['default']); - $err = new Exception('Sample exception'); + $err = new Exception('Sample exception'); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->failed($queueJob, $err, true); $redis = self::getPrivateProperty($handler, 'redis'); @@ -286,7 +288,8 @@ public function testFailedAndDontKeepJob(): void $handler = new RedisHandler($this->config); $queueJob = $handler->pop('queue1', ['default']); - $err = new Exception('Sample exception'); + $err = new Exception('Sample exception'); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->failed($queueJob, $err, false); $redis = self::getPrivateProperty($handler, 'redis'); @@ -309,6 +312,7 @@ public function testDone(): void $redis = self::getPrivateProperty($handler, 'redis'); $this->assertSame(0, $redis->zCard('queues:queue1:default')); + $this->assertInstanceOf(QueueJob::class, $queueJob); $result = $handler->done($queueJob);