From a50057c979c1bdc5ba211ea12f5c2694a773a90e Mon Sep 17 00:00:00 2001 From: Ema Panz Date: Thu, 10 May 2018 14:45:26 +0200 Subject: [PATCH 1/4] Improve exeption messages for topic-subscribers --- .../ExtractProcessorTagSubscriptionsTrait.php | 14 ++++++++++++-- .../Compiler/BuildClientRoutingPassTest.php | 2 +- .../Compiler/BuildProcessorRegistryPassTest.php | 2 +- .../Compiler/BuildTopicMetaSubscribersPassTest.php | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pkg/enqueue-bundle/DependencyInjection/Compiler/ExtractProcessorTagSubscriptionsTrait.php b/pkg/enqueue-bundle/DependencyInjection/Compiler/ExtractProcessorTagSubscriptionsTrait.php index e7a49ffe3..58fa57622 100644 --- a/pkg/enqueue-bundle/DependencyInjection/Compiler/ExtractProcessorTagSubscriptionsTrait.php +++ b/pkg/enqueue-bundle/DependencyInjection/Compiler/ExtractProcessorTagSubscriptionsTrait.php @@ -83,7 +83,16 @@ protected function extractSubscriptions(ContainerBuilder $container, $processorS if (is_subclass_of($processorClass, TopicSubscriberInterface::class)) { /** @var TopicSubscriberInterface $processorClass */ - foreach ($processorClass::getSubscribedTopics() as $topicName => $params) { + $topics = $processorClass::getSubscribedTopics(); + if (!is_array($topics)) { + throw new \LogicException(sprintf( + 'Topic subscriber configuration is invalid for "%s::getSubscribedTopics()": expected array, got %s.', + $processorClass, + gettype($topics) + )); + } + + foreach ($topics as $topicName => $params) { if (is_string($params)) { $data[] = [ 'topicName' => $params, @@ -102,7 +111,8 @@ protected function extractSubscriptions(ContainerBuilder $container, $processorS ]; } else { throw new \LogicException(sprintf( - 'Topic subscriber configuration is invalid. "%s"', + 'Topic subscriber configuration is invalid for "%s::getSubscribedTopics()". "%s"', + $processorClass, json_encode($processorClass::getSubscribedTopics()) )); } diff --git a/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildClientRoutingPassTest.php b/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildClientRoutingPassTest.php index 2b493f5df..f1b678570 100644 --- a/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildClientRoutingPassTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildClientRoutingPassTest.php @@ -254,7 +254,7 @@ public function testShouldThrowExceptionWhenTopicSubscriberConfigurationIsInvali $pass = new BuildClientRoutingPass(); $this->expectException(\LogicException::class); - $this->expectExceptionMessage('Topic subscriber configuration is invalid. "[12345]"'); + $this->expectExceptionMessage('Topic subscriber configuration is invalid'); $pass->process($container); } diff --git a/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildProcessorRegistryPassTest.php b/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildProcessorRegistryPassTest.php index c84a5aeba..9c7a00cdd 100644 --- a/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildProcessorRegistryPassTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildProcessorRegistryPassTest.php @@ -180,7 +180,7 @@ public function testShouldBuildRouteFromSubscriberIfProcessorNameSpecified() public function testShouldThrowExceptionWhenTopicSubscriberConfigurationIsInvalid() { $this->expectException(\LogicException::class); - $this->expectExceptionMessage('Topic subscriber configuration is invalid. "[12345]"'); + $this->expectExceptionMessage('Topic subscriber configuration is invalid'); $container = $this->createContainerBuilder(); diff --git a/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildTopicMetaSubscribersPassTest.php b/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildTopicMetaSubscribersPassTest.php index d5128add1..7e166b06d 100644 --- a/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildTopicMetaSubscribersPassTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/Compiler/BuildTopicMetaSubscribersPassTest.php @@ -302,7 +302,7 @@ public function testShouldThrowExceptionWhenTopicSubscriberConfigurationIsInvali $pass = new BuildTopicMetaSubscribersPass(); $this->expectException(\LogicException::class); - $this->expectExceptionMessage('Topic subscriber configuration is invalid. "[12345]"'); + $this->expectExceptionMessage('Topic subscriber configuration is invalid'); $pass->process($container); } From 6059b9550be17bc4511847d7dfca61f14757e743 Mon Sep 17 00:00:00 2001 From: Dmitri Perunov Date: Tue, 15 May 2018 21:32:30 +0700 Subject: [PATCH 2/4] Fix mistype at async_events docs --- docs/bundle/async_events.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/bundle/async_events.md b/docs/bundle/async_events.md index b2e7ea5ee..84c347e85 100644 --- a/docs/bundle/async_events.md +++ b/docs/bundle/async_events.md @@ -112,7 +112,7 @@ class FooEventTransformer implements EventTransformer public function toMessage($eventName, Event $event = null) { $entity = $event->getSubject(); - $entityClass = get_class($event); + $entityClass = get_class($entity); $manager = $this->doctrine->getManagerForClass($entityClass); $meta = $manager->getClassMetadata($entityClass); From 408881951fbca88b74dcd026980438f98eafbf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Tou=C5=A1ek?= Date: Wed, 16 May 2018 11:07:39 +0200 Subject: [PATCH 3/4] Allow newer version of bunny --- pkg/amqp-bunny/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/amqp-bunny/composer.json b/pkg/amqp-bunny/composer.json index a7f5086dd..dbb76cfa3 100644 --- a/pkg/amqp-bunny/composer.json +++ b/pkg/amqp-bunny/composer.json @@ -9,7 +9,7 @@ "php": ">=5.6", "queue-interop/amqp-interop": "^0.7@dev", - "bunny/bunny": "^0.2.4", + "bunny/bunny": "^0.2.4|^0.3|^0.4", "enqueue/amqp-tools": "^0.8.4@dev" }, "require-dev": { From cc5229940130e24d3999c63cfcb6c3952469c0a2 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Thu, 24 May 2018 14:35:37 +0300 Subject: [PATCH 4/4] Release 0.8.31 --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dbf170e3..569f8980f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Change Log +## [0.8.31](https://github.com/php-enqueue/enqueue-dev/tree/0.8.31) (2018-05-24) +[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.30...0.8.31) + +- Improve exception messages for topic-subscribers [\#441](https://github.com/php-enqueue/enqueue-dev/pull/441) ([thePanz](https://github.com/thePanz)) + +- Gracefull shutdown? [\#440](https://github.com/php-enqueue/enqueue-dev/issues/440) + +- Allow newer version of bunny [\#446](https://github.com/php-enqueue/enqueue-dev/pull/446) ([enumag](https://github.com/enumag)) +- Fix mistype at async\_events docs [\#445](https://github.com/php-enqueue/enqueue-dev/pull/445) ([diimpp](https://github.com/diimpp)) + +## [0.8.30](https://github.com/php-enqueue/enqueue-dev/tree/0.8.30) (2018-05-08) +[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.29...0.8.30) + ## [0.8.29](https://github.com/php-enqueue/enqueue-dev/tree/0.8.29) (2018-05-08) [Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.8.28...0.8.29)