Skip to content

Commit b398f86

Browse files
committed
Apply coding standard
1 parent 4d10355 commit b398f86

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/ReactMqttClient.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,7 @@ function (Throwable $reason) use ($connection, $deferred): void {
243243
$this->emitError($reason);
244244
$deferred->reject($reason);
245245

246-
if ($this->stream !== null) {
247-
$this->stream->close();
248-
}
246+
$this->stream?->close();
249247

250248
$this->emit('close', [$connection, $this]);
251249
}
@@ -323,9 +321,7 @@ function (?Connection $result) use ($timeout, &$flowResult): void {
323321
$this->timer[] = $this->loop->addTimer(
324322
$timeout,
325323
function (): void {
326-
if ($this->stream !== null) {
327-
$this->stream->close();
328-
}
324+
$this->stream?->close();
329325
}
330326
);
331327
}
@@ -353,7 +349,7 @@ function (Throwable $exception) use ($deferred, &$isResolved): void {
353349
*
354350
* @phpstan-return ($subscription is Subscription ? PromiseInterface<Subscription> : PromiseInterface<array<int, Subscription>>)
355351
*/
356-
public function subscribe($subscription): PromiseInterface
352+
public function subscribe(Subscription|array $subscription): PromiseInterface
357353
{
358354
if (! $this->isConnected) {
359355
return reject(new LogicException('The client is not connected.'));
@@ -381,7 +377,7 @@ public function subscribe($subscription): PromiseInterface
381377
*
382378
* @phpstan-return ($subscription is Subscription ? PromiseInterface<Subscription> : PromiseInterface<array<int, Subscription>>)
383379
*/
384-
public function unsubscribe($subscription): PromiseInterface
380+
public function unsubscribe(Subscription|array $subscription): PromiseInterface
385381
{
386382
if (! $this->isConnected) {
387383
return reject(new LogicException('The client is not connected.'));
@@ -765,9 +761,7 @@ private function startFlow(Flow $flow, bool $isSilent = false, bool $forceSingle
765761
if ($this->writtenFlow !== null) {
766762
$this->sendingFlows[] = $internalFlow;
767763
} else {
768-
if ($this->stream !== null) {
769-
$this->stream->write($packet);
770-
}
764+
$this->stream?->write($packet);
771765

772766
$this->writtenFlow = $internalFlow;
773767
$this->handleSend();
@@ -800,9 +794,7 @@ private function continueFlow(ReactFlow $flow, Packet $packet): void
800794
if ($this->writtenFlow !== null) {
801795
$this->sendingFlows[] = $flow;
802796
} else {
803-
if ($this->stream !== null) {
804-
$this->stream->write($response);
805-
}
797+
$this->stream?->write($response);
806798

807799
$this->writtenFlow = $flow;
808800
$this->handleSend();

0 commit comments

Comments
 (0)