Skip to content

Commit b3c2d6d

Browse files
committed
fix
1 parent bf91ba3 commit b3c2d6d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/Queue.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ public function __construct(
4040

4141
public function getChannel(): string
4242
{
43-
if ($this->adapter === null) {
44-
throw new LogicException('Adapter is not set.');
45-
}
46-
43+
$this->checkAdapter();
4744
return $this->adapter->getChannel();
4845
}
4946

@@ -86,7 +83,6 @@ public function run(int $max = 0): int
8683
return true;
8784
};
8885

89-
/** @psalm-suppress PossiblyNullReference */
9086
$this->adapter->runExisting($handlerCallback);
9187

9288
$this->logger->info(
@@ -102,16 +98,13 @@ public function listen(): void
10298
$this->checkAdapter();
10399

104100
$this->logger->info('Start listening to the queue.');
105-
/** @psalm-suppress PossiblyNullReference */
106101
$this->adapter->subscribe(fn (MessageInterface $message) => $this->handle($message));
107102
$this->logger->info('Finish listening to the queue.');
108103
}
109104

110105
public function status(string|int $id): JobStatus
111106
{
112107
$this->checkAdapter();
113-
114-
/** @psalm-suppress PossiblyNullReference */
115108
return $this->adapter->status($id);
116109
}
117110

@@ -146,6 +139,9 @@ private function handle(MessageInterface $message): bool
146139
return $this->loop->canContinue();
147140
}
148141

142+
/**
143+
* @psalm-assert AdapterInterface $this->adapter
144+
*/
149145
private function checkAdapter(): void
150146
{
151147
if ($this->adapter === null) {

0 commit comments

Comments
 (0)