Skip to content

Commit e93f2f8

Browse files
authored
Merge pull request vyuldashev#556 from vyuldashev/fix-lastpushed
Fix issue where was accessed before initialization
2 parents 33b7c83 + c63c217 commit e93f2f8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Horizon/RabbitMQQueue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function push($job, $data = '', $queue = null)
4848
*/
4949
public function pushRaw($payload, $queue = null, array $options = []): int|string|null
5050
{
51-
$payload = (new JobPayload($payload))->prepare($this->lastPushed)->value;
51+
$payload = (new JobPayload($payload))->prepare($this->lastPushed ?? null)->value;
5252

5353
return tap(parent::pushRaw($payload, $queue, $options), function () use ($queue, $payload): void {
5454
$this->event($this->getQueue($queue), new JobPushed($payload));

src/Queue/RabbitMQQueue.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ protected function getDelayQueueArguments(string $destination, int $ttl): array
631631
/**
632632
* Get the exchange name, or empty string; as default value.
633633
*/
634-
protected function getExchange(?string $exchange = null): string
634+
protected function getExchange(string $exchange = null): string
635635
{
636636
return $exchange ?? $this->getConfig()->getExchange();
637637
}
@@ -648,7 +648,7 @@ protected function getRoutingKey(string $destination): string
648648
/**
649649
* Get the exchangeType, or AMQPExchangeType::DIRECT as default.
650650
*/
651-
protected function getExchangeType(?string $type = null): string
651+
protected function getExchangeType(string $type = null): string
652652
{
653653
$constant = AMQPExchangeType::class.'::'.Str::upper($type ?: $this->getConfig()->getExchangeType());
654654

@@ -658,7 +658,7 @@ protected function getExchangeType(?string $type = null): string
658658
/**
659659
* Get the exchange for failed messages.
660660
*/
661-
protected function getFailedExchange(?string $exchange = null): string
661+
protected function getFailedExchange(string $exchange = null): string
662662
{
663663
return $exchange ?? $this->getConfig()->getFailedExchange();
664664
}
@@ -693,7 +693,7 @@ protected function isQueueDeclared(string $name): bool
693693
*
694694
* @throws AMQPProtocolChannelException
695695
*/
696-
protected function declareDestination(string $destination, ?string $exchange = null, string $exchangeType = AMQPExchangeType::DIRECT): void
696+
protected function declareDestination(string $destination, string $exchange = null, string $exchangeType = AMQPExchangeType::DIRECT): void
697697
{
698698
// When an exchange is provided and no exchange is present in RabbitMQ, create an exchange.
699699
if ($exchange && ! $this->isExchangeExists($exchange)) {

0 commit comments

Comments
 (0)