diff --git a/src/Torrents/TorrentPeerInfo.php b/src/Torrents/TorrentPeerInfo.php index 00d754b..b99c81f 100644 --- a/src/Torrents/TorrentPeerInfo.php +++ b/src/Torrents/TorrentPeerInfo.php @@ -49,9 +49,10 @@ readonly class TorrentPeerInfo { return $this->userId !== null; } - public function verifyUser(UserInfo $userInfo): bool { - return !$this->hasUserId() - || ($userInfo !== null && $userInfo->getId() === $this->userId); + public function verifyUser(?UserInfo $userInfo): bool { + return $this->userId === null + ? $userInfo === null + : $this->userId === $userInfo->getId(); } public function getAddress(): string {