From 5027120a0f0e110b6c5b15887d68fb4ca98d6041 Mon Sep 17 00:00:00 2001 From: Arnaud TARROUX Date: Wed, 22 Aug 2018 14:21:55 +0200 Subject: [PATCH 1/2] Remove bool typehint for php < 7 supports --- pkg/enqueue/Consumption/QueueConsumer.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/enqueue/Consumption/QueueConsumer.php b/pkg/enqueue/Consumption/QueueConsumer.php index c41028b91..80c59178f 100644 --- a/pkg/enqueue/Consumption/QueueConsumer.php +++ b/pkg/enqueue/Consumption/QueueConsumer.php @@ -347,8 +347,17 @@ public function consume(ExtensionInterface $runtimeExtension = null) /** * @param bool $enableSubscriptionConsumer */ - public function enableSubscriptionConsumer(bool $enableSubscriptionConsumer) + public function enableSubscriptionConsumer($enableSubscriptionConsumer) { + if (!is_bool($enableSubscriptionConsumer) { + throw new InvalidArgumentException( + sprintf( + 'The argument must be a boolean but got %s.', + is_object($argument) ? get_class($argument) : gettype($argument) + ) + ); + } + $this->enableSubscriptionConsumer = $enableSubscriptionConsumer; } From 89d23308b239496e09f562ec9b89562cd1437a77 Mon Sep 17 00:00:00 2001 From: Arnaud TARROUX Date: Wed, 22 Aug 2018 14:39:02 +0200 Subject: [PATCH 2/2] Missing parenthesis --- pkg/enqueue/Consumption/QueueConsumer.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/enqueue/Consumption/QueueConsumer.php b/pkg/enqueue/Consumption/QueueConsumer.php index 80c59178f..58209db8d 100644 --- a/pkg/enqueue/Consumption/QueueConsumer.php +++ b/pkg/enqueue/Consumption/QueueConsumer.php @@ -346,19 +346,18 @@ public function consume(ExtensionInterface $runtimeExtension = null) /** * @param bool $enableSubscriptionConsumer + * @throws \Enqueue\Consumption\Exception\InvalidArgumentException */ public function enableSubscriptionConsumer($enableSubscriptionConsumer) { - if (!is_bool($enableSubscriptionConsumer) { + if (!is_bool($enableSubscriptionConsumer)) { throw new InvalidArgumentException( sprintf( 'The argument must be a boolean but got %s.', - is_object($argument) ? get_class($argument) : gettype($argument) + is_object($enableSubscriptionConsumer) ? get_class($enableSubscriptionConsumer) : gettype($enableSubscriptionConsumer) ) ); } - - $this->enableSubscriptionConsumer = $enableSubscriptionConsumer; } /**