Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
PHP `7.x` has reached its end of life on the first of january 2023 and `8.0` will reach it by the end of 2023, thus bumping the version to at least `8.1`.
It also upgrades some of the other dependencies and allows `2.x` for `doctrine/annotations` and `doctrine/collections`.
  • Loading branch information
Spea committed Jul 22, 2023
1 parent 971ab19 commit 2d3e3a6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
}
],
"require": {
"php": "^7.2|^8.0",
"php-amqplib/php-amqplib": "^2.12.3|^3.0.0",
"doctrine/annotations": "^1.10",
"php": "^8.1",
"php-amqplib/php-amqplib": "^3.0.0",
"doctrine/annotations": "^1.10|^2.0.1",
"symfony/event-dispatcher": "^4.4|^5.0|^6.0",
"doctrine/collections": "^1.6"
"doctrine/collections": "^1.6|^2.1.2"
},
"require-dev": {
"jms/serializer": "^3.15.0",
Expand Down
18 changes: 8 additions & 10 deletions src/Rebuy/Amqp/Consumer/Annotation/ConsumerContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public function getBindings()
return [];
}

$class = $this->method->getParameters()[0]->getClass();
$class = $this->method->getParameters()[0]->getType()?->getName();
if (null === $class) {
return [];
}

if (!$class->implementsInterface(MessageInterface::class)) {
if (!is_a($class, MessageInterface::class, true)) {
return [];
}

Expand All @@ -76,22 +76,20 @@ public function getConsumerIdentification()
*/
public function getRoutingKey()
{
$class = $this->method->getParameters()[0]->getClass();
$class = $this->method->getParameters()[0]->getType()?->getName();
if (!is_a($class, MessageInterface::class, true)) {
return null;
}

return $class->getMethod('getRoutingKey')->invoke(null);
return $class::getRoutingKey();
}

/**
* @return string
*/
public function getMessageClass()
{
$class = $this->method->getParameters()[0]->getClass();
if (null === $class) {
return null;
}

return $class->getName();
return $this->method->getParameters()[0]->getType()?->getName();
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Rebuy/Amqp/Consumer/Annotation/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ private function validateMethod(ReflectionMethod $method)
}

$parameter = $method->getParameters()[0];
if (null === $parameter->getClass() || !$parameter->getClass()->implementsInterface(MessageInterface::class)) {
$class = $parameter->getType()?->getName();
if (!is_a($class, MessageInterface::class, true)) {
throw new InvalidArgumentException('A @Consumer\'s parameter must implement ' . MessageInterface::class);
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/Rebuy/Amqp/Consumer/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
namespace Rebuy\Amqp\Consumer;

use InvalidArgumentException;
use JMS\Serializer\SerializationContext;
use JMS\Serializer\Serializer;
use PhpAmqpLib\Channel\AMQPChannel;
use PhpAmqpLib\Message\AMQPMessage;
use Rebuy\Amqp\Consumer\Message\MessageInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function preConsume_with_postConsume_should_add_timing_entry()
$consumerName = 'consumer';
$eventName = $consumerName . '-' . $deliveryTag;
$message = new AMQPMessage('body');
$message->delivery_info['delivery_tag'] = $deliveryTag;
$message->setDeliveryTag($deliveryTag);

$container = $this->prophesize(ConsumerContainer::class);
$container->getConsumerName()->willReturn($consumerName);
Expand Down

0 comments on commit 2d3e3a6

Please sign in to comment.