diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 025d423..635aa48 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -7,11 +7,19 @@ jobs: strategy: fail-fast: false matrix: - php: [7.4, 8.0, 8.1] - symfony: [4.4.*, 5.4.*, 6.0.*] + php: [7.4, 8.0, 8.1, 8.2, 8.3] + symfony: [5.4.*, 6.4.*, 7.0.*] exclude: - php: 7.4 - symfony: 6.0.* + symfony: 6.4.* + - php: 7.4 + symfony: 7.0.* + - php: 8.0 + symfony: 6.4.* + - php: 8.0 + symfony: 7.0.* + - php: 8.1 + symfony: 7.0.* services: rabbitmq: diff --git a/Broker/Publisher.php b/Broker/Publisher.php index 157b156..636714f 100644 --- a/Broker/Publisher.php +++ b/Broker/Publisher.php @@ -6,14 +6,13 @@ use Psr\Log\NullLogger; use Swarrot\Broker\Message; use Swarrot\SwarrotBundle\Event\MessagePublishedEvent; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatcherInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class Publisher { /** @var FactoryInterface */ protected $factory; - /** @var ContractsEventDispatcherInterface|EventDispatcherInterface */ + /** @var EventDispatcherInterface */ protected $eventDispatcher; /** @var array */ protected $messageTypes; @@ -50,18 +49,10 @@ public function publish(string $messageType, Message $message, array $overridenC $messagePublisher->publish($message, $routingKey); - if ($this->eventDispatcher instanceof ContractsEventDispatcherInterface) { - $this->eventDispatcher->dispatch( - new MessagePublishedEvent($messageType, $message, $connection, $exchange, $routingKey), - MessagePublishedEvent::NAME - ); - } else { - // Dispatch the old way as we are using Event Dispatcher < 4.3 - $this->eventDispatcher->dispatch( - MessagePublishedEvent::NAME, - new MessagePublishedEvent($messageType, $message, $connection, $exchange, $routingKey) - ); - } + $this->eventDispatcher->dispatch( + new MessagePublishedEvent($messageType, $message, $connection, $exchange, $routingKey), + MessagePublishedEvent::NAME + ); } public function isKnownMessageType(string $messageType): bool diff --git a/CHANGELOG.md b/CHANGELOG.md index 72b8e6b..ca75a29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +- Add support to Symfony 7.0 +- - Remove Symfony <5.4 support + ## 2.4.1 - 2022-03-07 - Make command lazy loadable diff --git a/Command/SwarrotCommand.php b/Command/SwarrotCommand.php index 3159c11..e82ff82 100644 --- a/Command/SwarrotCommand.php +++ b/Command/SwarrotCommand.php @@ -33,9 +33,6 @@ class SwarrotCommand extends Command /** @var array */ protected $aliases; - /** @var string */ - protected static $defaultDescription = 'Consume messages from a given queue'; - public function __construct( FactoryInterface $swarrotFactory, string $name, @@ -65,7 +62,7 @@ protected function configure(): void $this ->setName('swarrot:consume:'.$this->name) ->setAliases($this->aliases) - ->setDescription(self::$defaultDescription) + ->setDescription('Consume messages from a given queue') ->addArgument('queue', InputArgument::OPTIONAL, 'Queue to consume', $this->queue) ->addArgument('connection', InputArgument::OPTIONAL, 'Connection to use', $this->connectionName) ->addOption( @@ -117,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $consumer->consume($options); - return 0; + return Command::SUCCESS; } protected function getOptions(InputInterface $input): array diff --git a/composer.json b/composer.json index be2ce5c..768b378 100644 --- a/composer.json +++ b/composer.json @@ -17,11 +17,11 @@ "php": "^7.4|^8.0", "psr/log": "^1.0|^2.0|^3.0", "swarrot/swarrot": "^4.0", - "symfony/config": "^4.4|^5.4|^6.0", - "symfony/console": "^4.4|^5.4|^6.0", - "symfony/dependency-injection": "^4.4|^5.4|^6.0", - "symfony/http-kernel": "^4.4|^5.4|^6.0", - "symfony/yaml": "^4.4|^5.4|^6.0" + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "require-dev": { "doctrine/common": "^2.9|^3.0", @@ -30,8 +30,8 @@ "phpspec/prophecy-phpunit": "^2.0", "phpstan/phpstan": "^1.2", "phpunit/phpunit": "^9.5", - "symfony/event-dispatcher": "^4.4|^5.4|^6.0", - "symfony/phpunit-bridge": "^4.4|^5.4|^6.0" + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/phpunit-bridge": "^5.4|^6.0|^7.0" }, "suggest": { "php-amqplib/php-amqplib": "Required if using amqp_lib"