From ae2b6e3bb7284189d9d0503448538d557391a247 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 23 Dec 2024 10:45:15 +0000 Subject: [PATCH] Fix PHPStan errors from upstream --- src/Protocol/ATProtocol.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Protocol/ATProtocol.php b/src/Protocol/ATProtocol.php index cc996b6861..ad3537d377 100644 --- a/src/Protocol/ATProtocol.php +++ b/src/Protocol/ATProtocol.php @@ -129,17 +129,26 @@ final class ATProtocol } $data = $this->get($pds . '/xrpc/' . $url, [HttpClientOptions::HEADERS => $headers]); - if (empty($data) || (!empty($data->code) && ($data->code < 200 || $data->code >= 400))) { + + if ($data === null) { $this->pConfig->set($uid, 'bluesky', 'status', self::STATUS_API_FAIL); + + return null; + } + + if (!empty($data->code) && ($data->code < 200 || $data->code >= 400)) { if (!empty($data->message)) { $this->pConfig->set($uid, 'bluesky', 'status-message', $data->message); } elseif (!empty($data->code)) { $this->pConfig->set($uid, 'bluesky', 'status-message', 'Error Code: ' . $data->code); } - } elseif (!empty($data)) { - $this->pConfig->set($uid, 'bluesky', 'status', self::STATUS_SUCCESS); - $this->pConfig->set($uid, 'bluesky', 'status-message', ''); + + return $data; } + + $this->pConfig->set($uid, 'bluesky', 'status', self::STATUS_SUCCESS); + $this->pConfig->set($uid, 'bluesky', 'status-message', ''); + return $data; }