Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added packages.txt
Empty file.
14 changes: 8 additions & 6 deletions src/Messenger/Stamp/AzureBrokerPropertiesStamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AzureBrokerPropertiesStamp implements StampInterface
/** @var int|null */
private $sequenceNumber;

/** @var int|null */
/** @var float|null */
private $timeToLive;

/** @var string|null */
Expand All @@ -74,7 +74,7 @@ public function __construct(
?string $replyTo = null,
?\DateTimeInterface $enqueuedTimeUtc = null,
?int $sequenceNumber = null,
?int $timeToLive = null,
?float $timeToLive = null,
?string $to = null,
?\DateTimeInterface $scheduledEnqueueTimeUtc = null,
?string $replyToSessionId = null,
Expand Down Expand Up @@ -129,7 +129,7 @@ public static function createFromJson(string $json): self
* ReplyTo?: string,
* EnqueuedTimeUtc?: string,
* SequenceNumber?: int,
* TimeToLive?: int,
* TimeToLive?: float|int,
* To?: string,
* ScheduledEnqueueTimeUtc?: string,
* ReplyToSessionId?: string,
Expand Down Expand Up @@ -157,6 +157,8 @@ public static function createFromJson(string $json): self
$scheduledEnqueueTimeUtc = $scheduledEnqueueTimeUtc->setTimezone($defaultTimeZone);
}

$timeToLive = is_numeric($properties['TimeToLive']) ? floatval($properties['TimeToLive']) : null;

return new self(
$properties['ContentType'] ?? null,
$properties['CorrelationId'] ?? null,
Expand All @@ -169,7 +171,7 @@ public static function createFromJson(string $json): self
$properties['ReplyTo'] ?? null,
$enqueuedTimeUtc,
$properties['SequenceNumber'] ?? null,
$properties['TimeToLive'] ?? null,
$timeToLive,
$properties['To'] ?? null,
$scheduledEnqueueTimeUtc,
$properties['ReplyToSessionId'] ?? null,
Expand Down Expand Up @@ -307,12 +309,12 @@ public function getSequenceNumber(): ?int
return $this->sequenceNumber;
}

public function getTimeToLive(): ?int
public function getTimeToLive(): ?float
{
return $this->timeToLive;
}

public function setTimeToLive(?int $timeToLive): self
public function setTimeToLive(?float $timeToLive): self
{
$this->timeToLive = $timeToLive;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion tests/Messenger/Stamp/AzureBrokerPropertiesStampTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function testCreateFromResponse(): void
self::assertSame($enqueuedTimeUtc, $stamp->getEnqueuedTimeUtc()->format('Y-m-d H:i:s'));

self::assertSame($sequenceNumber, $stamp->getSequenceNumber());
self::assertSame($timeToLive, $stamp->getTimeToLive());
self::assertSame(floatval($timeToLive), $stamp->getTimeToLive());
self::assertSame($to, $stamp->getTo());

self::assertInstanceOf(\DateTimeInterface::class, $stamp->getScheduledEnqueueTimeUtc());
Expand Down