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) 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); 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": { 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); }