From eac2ab4a2becb6f270a4ca8c679c71d43e310543 Mon Sep 17 00:00:00 2001 From: bota Date: Wed, 28 Oct 2026 13:21:46 +0200 Subject: [PATCH 1/3] Issue #100: Block symfony/polyfill-php83 <1.30 to fix PHP 8.4 deprecations in lowest-deps CI Signed-off-by: bota --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 479b3bc..7bde9e8 100644 --- a/composer.json +++ b/composer.json @@ -62,6 +62,9 @@ "roave/security-advisories": "dev-master", "swoole/ide-helper": "~6.0.0" }, + "conflict": { + "symfony/polyfill-php83": "<1.30" + }, "autoload": { "psr-4": { "Queue\\": "src/" From 81953e3166897236c55b89513701c8b6b26eadad Mon Sep 17 00:00:00 2001 From: bota Date: Wed, 28 Oct 2026 13:31:47 +0200 Subject: [PATCH 2/3] fixed linting error Signed-off-by: bota --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0611d2a..019b933 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ The queue system uses logs to ensure maintainability and implements retry featur ## Version History -| Branch | Release | PSR-11 | OSS Lifecycle | PHP Version | -|--------|---------|--------|----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| Branch | Release | PSR-11 | OSS Lifecycle | PHP Version | +|--------|---------|--------|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| | 2.0 | `> 2.0` | 1 | ![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/queue) | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/queue/2.0.0) | | 1.0 | `< 2.0` | 1 | ![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/queue) | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/queue/1.0.0) | From c3c309e4dd1e98accd4721521f1a53384dd94c36 Mon Sep 17 00:00:00 2001 From: bota Date: Wed, 28 Oct 2026 14:44:31 +0200 Subject: [PATCH 3/3] fixed qodana issues Signed-off-by: bota --- src/App/Message/Message.php | 12 +----------- src/App/Message/MessageHandler.php | 4 ++-- src/Swoole/Command/StartCommand.php | 4 ++-- src/Swoole/Command/StopCommand.php | 2 +- src/Swoole/PidManager.php | 2 +- src/Swoole/ServerFactory.php | 14 ++++---------- test/App/Message/MessageHandlerTest.php | 6 +++--- test/App/Message/MessageTest.php | 2 +- test/Swoole/Delegators/TCPServerDelegatorTest.php | 4 ++-- 9 files changed, 17 insertions(+), 33 deletions(-) diff --git a/src/App/Message/Message.php b/src/App/Message/Message.php index 2ac080b..68c5874 100644 --- a/src/App/Message/Message.php +++ b/src/App/Message/Message.php @@ -7,17 +7,7 @@ class Message { public function __construct( - private array $payload, + public array $payload, ) { } - - public function getPayload(): array - { - return $this->payload; - } - - public function setPayload(array $payload): void - { - $this->payload = $payload; - } } diff --git a/src/App/Message/MessageHandler.php b/src/App/Message/MessageHandler.php index 39a0d2b..0a505cb 100644 --- a/src/App/Message/MessageHandler.php +++ b/src/App/Message/MessageHandler.php @@ -28,7 +28,7 @@ public function __construct( */ public function __invoke(Message $message): void { - $payload = $message->getPayload(); + $payload = $message->payload; try { if ($payload['foo'] === 'control') { @@ -52,7 +52,7 @@ public function __invoke(Message $message): void } $payload['retry_count'] = $retryCount + 1; - $message->setPayload($payload); + $message->payload = $payload; throw $e; } diff --git a/src/Swoole/Command/StartCommand.php b/src/Swoole/Command/StartCommand.php index c1eb1cd..8651703 100644 --- a/src/Swoole/Command/StartCommand.php +++ b/src/Swoole/Command/StartCommand.php @@ -24,9 +24,9 @@ class StartCommand extends Command public PidManager $pidManager; - public const DEFAULT_PROCESS_NAME = 'dotkernel-queue'; + public const string DEFAULT_PROCESS_NAME = 'dotkernel-queue'; - public const HELP = <<<'EOH' + public const string HELP = <<<'EOH' Start the web server. If --daemonize is provided, starts the server as a background process and returns handling to the shell; otherwise, the server runs in the current process. diff --git a/src/Swoole/Command/StopCommand.php b/src/Swoole/Command/StopCommand.php index b64d2b3..b9b530b 100644 --- a/src/Swoole/Command/StopCommand.php +++ b/src/Swoole/Command/StopCommand.php @@ -18,7 +18,7 @@ class StopCommand extends Command { use IsRunningTrait; - public const HELP = <<<'EOH' + public const string HELP = <<<'EOH' Stop the web server. Kills all worker processes and stops the web server. This command is only relevant when the server was started using the diff --git a/src/Swoole/PidManager.php b/src/Swoole/PidManager.php index 427d529..19a3c1d 100644 --- a/src/Swoole/PidManager.php +++ b/src/Swoole/PidManager.php @@ -17,7 +17,7 @@ class PidManager { - public function __construct(private string $pidFile) + public function __construct(private readonly string $pidFile) { } diff --git a/src/Swoole/ServerFactory.php b/src/Swoole/ServerFactory.php index 5f7a59f..0f5be88 100644 --- a/src/Swoole/ServerFactory.php +++ b/src/Swoole/ServerFactory.php @@ -31,22 +31,16 @@ class ServerFactory { - /** - * @var string - */ - public const DEFAULT_HOST = '127.0.0.1'; + public const string DEFAULT_HOST = '127.0.0.1'; - /** - * @var int - */ - public const DEFAULT_PORT = 8080; + public const int DEFAULT_PORT = 8080; /** * Swoole server supported modes * * @var int[] */ - private const MODES = [ + private const array MODES = [ SWOOLE_BASE, SWOOLE_PROCESS, ]; @@ -56,7 +50,7 @@ class ServerFactory * * @var int[] */ - private const PROTOCOLS = [ + private const array PROTOCOLS = [ SWOOLE_SOCK_TCP, SWOOLE_SOCK_TCP6, SWOOLE_SOCK_UDP, diff --git a/test/App/Message/MessageHandlerTest.php b/test/App/Message/MessageHandlerTest.php index 4c2277a..e33d14a 100644 --- a/test/App/Message/MessageHandlerTest.php +++ b/test/App/Message/MessageHandlerTest.php @@ -65,7 +65,7 @@ public function testControlMessageDoesNotThrowAndDoesNotSetRetryCount(): void $message = new Message(['foo' => 'control']); $handler($message); - $payload = $message->getPayload(); + $payload = $message->payload; $this->assertArrayNotHasKey('retry_count', $payload); } @@ -81,7 +81,7 @@ public function testRetryMessageThrowsExceptionAndSetsRetryCount(): void try { $handler($message); } finally { - $payload = $message->getPayload(); + $payload = $message->payload; $this->assertArrayHasKey('retry_count', $payload); $this->assertEquals(1, $payload['retry_count']); // first retry } @@ -101,7 +101,7 @@ public function testRetryMessageWithExistingRetryCountIncrementsIt(): void try { $handler($message); } finally { - $payload = $message->getPayload(); + $payload = $message->payload; $this->assertEquals(3, $payload['retry_count']); // incremented from 2 → 3 } } diff --git a/test/App/Message/MessageTest.php b/test/App/Message/MessageTest.php index 8c733a6..3f9d317 100644 --- a/test/App/Message/MessageTest.php +++ b/test/App/Message/MessageTest.php @@ -12,6 +12,6 @@ class MessageTest extends TestCase public function testMessageAccessors(): void { $admin = new Message(['payload' => 'test message payload']); - $this->assertSame(['payload' => 'test message payload'], $admin->getPayload()); + $this->assertSame(['payload' => 'test message payload'], $admin->payload); } } diff --git a/test/Swoole/Delegators/TCPServerDelegatorTest.php b/test/Swoole/Delegators/TCPServerDelegatorTest.php index 15d690e..1f419b2 100644 --- a/test/Swoole/Delegators/TCPServerDelegatorTest.php +++ b/test/Swoole/Delegators/TCPServerDelegatorTest.php @@ -132,10 +132,10 @@ public function testReceiveDispatchesMessagesAndLogsWhenUnknownCommand(): void if ($callCount === 1) { $this->assertInstanceOf(Message::class, $message); - $this->assertEquals('hello', $message->getPayload()['foo']); + $this->assertEquals('hello', $message->payload['foo']); } elseif ($callCount === 2) { $this->assertInstanceOf(Message::class, $message); - $this->assertEquals('with 5 seconds delay', $message->getPayload()['foo']); + $this->assertEquals('with 5 seconds delay', $message->payload['foo']); } else { $this->fail('dispatch called more than twice'); }