From 037a3f5582de9e68596c0bf1b85e595931b1ceba Mon Sep 17 00:00:00 2001 From: Dima Sorokin Date: Tue, 30 Dec 2025 13:16:54 +0200 Subject: [PATCH 1/2] Add support for Symfony 8.x - Update composer.json to allow Symfony 8 components - Test compatibility with Symfony 8.0 --- .github/workflows/test.yaml | 2 +- DataCollector/MessageDataCollector.php | 10 +++++----- README.md | 2 +- Tests/Command/SetupFabricCommandTest.php | 16 ++++++++++++++-- composer.json | 18 +++++++++--------- 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ba8da949..df8043ce 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,7 +11,7 @@ jobs: strategy: matrix: php-version: ['8.2', '8.3', '8.4', '8.5'] - symfony-version: ['6.4', '7.4'] + symfony-version: ['6.4', '7.4', '8.0'] coverage: ['none'] include: - php-version: '8.3' diff --git a/DataCollector/MessageDataCollector.php b/DataCollector/MessageDataCollector.php index 95b7f7f4..34350c78 100644 --- a/DataCollector/MessageDataCollector.php +++ b/DataCollector/MessageDataCollector.php @@ -21,7 +21,7 @@ public function __construct($channels) $this->data = []; } - public function collect(Request $request, Response $response, ?\Throwable $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { foreach ($this->channels as $channel) { foreach ($channel->getBasicPublishLog() as $log) { @@ -30,22 +30,22 @@ public function collect(Request $request, Response $response, ?\Throwable $excep } } - public function getName() + public function getName(): string { return 'rabbit_mq'; } - public function getPublishedMessagesCount() + public function getPublishedMessagesCount(): int { return count($this->data); } - public function getPublishedMessagesLog() + public function getPublishedMessagesLog(): array { return $this->data; } - public function reset() + public function reset(): void { $this->data = []; } diff --git a/README.md b/README.md index b2b0642d..6529a5a0 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ All the examples expect a running RabbitMQ server. This bundle was presented at [Symfony Live Paris 2011](http://www.symfony-live.com/paris/schedule#session-av1) conference. See the slides [here](http://www.slideshare.net/old_sound/theres-a-rabbit-on-my-symfony). -## Version 2 ## +## Version 2 ##vendor/bin/phpunit Due to the breaking changes happened caused by Symfony >=4.4, a new tag was released, making the bundle compatible with Symfony >=4.4. ## Installation ## diff --git a/Tests/Command/SetupFabricCommandTest.php b/Tests/Command/SetupFabricCommandTest.php index f7f92143..09e61109 100644 --- a/Tests/Command/SetupFabricCommandTest.php +++ b/Tests/Command/SetupFabricCommandTest.php @@ -54,7 +54,13 @@ public function testExecute(): void $command->setContainer($container); // TODO: Use addCommand() once Symfony Support for < 7.4 is dropped - $application->add($command); + // TODO: Use addCommand() once Symfony Support for < 7.4 is dropped + if (method_exists($application, 'addCommand')) { + $application->addCommand($command); + } else { + // @phpstan-ignore-next-line + $application->add($command); + } $registeredCommand = $application->find('rabbitmq:setup-fabric'); @@ -102,7 +108,13 @@ public function testExecute_withSkipAnonConsumers(): void $command->setContainer($container); // TODO: Use addCommand() once Symfony Support for < 7.4 is dropped - $application->add($command); + // TODO: Use addCommand() once Symfony Support for < 7.4 is dropped + if (method_exists($application, 'addCommand')) { + $application->addCommand($command); + } else { + // @phpstan-ignore-next-line + $application->add($command); + } $registeredCommand = $application->find('rabbitmq:setup-fabric'); diff --git a/composer.json b/composer.json index 42978a8d..f541082b 100644 --- a/composer.json +++ b/composer.json @@ -8,19 +8,19 @@ "name" : "Alvaro Videla" }], "require": { - "php": "^8.2", - "symfony/dependency-injection": "^6.0 || ^7.0", - "symfony/event-dispatcher": "^6.0 || ^7.0", - "symfony/config": "^6.0 || ^7.0", - "symfony/yaml": "^6.0 || ^7.0", - "symfony/console": "^6.0 || ^7.0", + "php": "^8.4", + "symfony/dependency-injection": "^6.0 || ^7.0 || ^8.0", + "symfony/event-dispatcher": "^6.0 || ^7.0 || ^8.0", + "symfony/config": "^6.0 || ^7.0 || ^8.0", + "symfony/yaml": "^6.0 || ^7.0 || ^8.0", + "symfony/console": "^6.0 || ^7.0 || ^8.0", "php-amqplib/php-amqplib": "^2.12.2 || ^3.0", "psr/log": "^2.0 || ^3.0", - "symfony/http-kernel": "^6.0 || ^7.0", - "symfony/framework-bundle": "^6.0 || ^7.0" + "symfony/http-kernel": "^6.0 || ^7.0 || ^8.0", + "symfony/framework-bundle": "^6.0 || ^7.0 || ^8.0" }, "require-dev": { - "symfony/serializer": "^6.0 || ^7.0", + "symfony/serializer": "^6.0 || ^7.0 || ^8.0", "phpunit/phpunit": "^9.5", "phpstan/phpstan": "^1.2", "phpstan/phpstan-phpunit": "^1.0" From 3e4086a6874cc85f649d6b15edd95dc924a70161 Mon Sep 17 00:00:00 2001 From: DimaSorokin <31204619+DimaSorokin@users.noreply.github.com> Date: Fri, 2 Jan 2026 12:54:59 +0200 Subject: [PATCH 2/2] Fix README.md Co-authored-by: Andrii Dembitskyi --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6529a5a0..b2b0642d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ All the examples expect a running RabbitMQ server. This bundle was presented at [Symfony Live Paris 2011](http://www.symfony-live.com/paris/schedule#session-av1) conference. See the slides [here](http://www.slideshare.net/old_sound/theres-a-rabbit-on-my-symfony). -## Version 2 ##vendor/bin/phpunit +## Version 2 ## Due to the breaking changes happened caused by Symfony >=4.4, a new tag was released, making the bundle compatible with Symfony >=4.4. ## Installation ##