diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 8e7c8f2f1..69d2e396d 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -282,13 +282,6 @@ $pdo - - db->query("SELECT data_free FROM information_schema.tables WHERE table_schema=`{$database}` AND table_name=`{$this->table}`")->fetchRow()['data_free']]]> - - - getOptimizeIfWastedGtMb - getOptimizeIfWastedGtMb - @@ -487,6 +480,11 @@ $peersResolved + + + $peerResolved + + $adminIds @@ -648,12 +646,15 @@ getClient()->wrapMessage($this->getClient()->extractMessage($result))]]> + getClient()->wrapMessage($this->getClient()->extractMessage($result))]]> Message + Message getClient()->wrapMessage($this->getClient()->extractMessage($result))]]> + getClient()->wrapMessage($this->getClient()->extractMessage($result))]]> $html @@ -737,6 +738,12 @@ getIdInternal($rawPinned)]]> + + + $html + $htmlTelegram + + @@ -745,6 +752,7 @@ Message + Message getIdInternal($rawCallback['peer'])]]> @@ -1710,7 +1718,6 @@ getIdInternal($message['action']['from_id'])]]> - getIdInternal($message['action']['peer'])]]> getIdInternal($message['action']['to_id'])]]> @@ -2207,7 +2214,6 @@ botAPIToMTProto - logger $elem[1] @@ -2256,10 +2262,6 @@ - - $c->name !== null]]> - $c->name !== null]]> - $val @@ -2429,9 +2431,6 @@ authorization['phone_number']]]> authorization['phone_number']]]> - - $datacenter - \is_array($auth_key) diff --git a/src/EventHandler/Poll/QuizPoll.php b/src/EventHandler/Poll/QuizPoll.php index 9037d70ff..accd06ea2 100644 --- a/src/EventHandler/Poll/QuizPoll.php +++ b/src/EventHandler/Poll/QuizPoll.php @@ -47,8 +47,11 @@ final class QuizPoll extends AbstractPoll * * @param bool $allowTelegramTags Whether to allow telegram-specific tags like tg-spoiler, tg-emoji, mention links and so on... */ - public function getHTML(bool $allowTelegramTags = false): string + public function getHTML(bool $allowTelegramTags = false): ?string { + if ($this->solution === null) { + return null; + } if (!$this->entities) { return StrTools::htmlEscape($this->solution); } diff --git a/src/MTProtoTools/PeerDatabase.php b/src/MTProtoTools/PeerDatabase.php index b2c104ed9..0f4d797aa 100644 --- a/src/MTProtoTools/PeerDatabase.php +++ b/src/MTProtoTools/PeerDatabase.php @@ -242,15 +242,17 @@ final class PeerDatabase implements TLCallback $id = $content; } } - $id = strtolower(str_replace('@', '', $id)); - if ($id === 'me') { - $id = $this->API->authorization['user']['id']; - } elseif ($id === 'support') { - $id = $this->API->methodCallAsyncRead('help.getSupport', [])['user']; - } else { - $id = $this->resolveUsername($id); - if ($id === null) { - throw new PeerNotInDbException; + if (\is_string($id)) { + $id = strtolower(str_replace('@', '', $id)); + if ($id === 'me') { + $id = $this->API->authorization['user']['id']; + } elseif ($id === 'support') { + $id = $this->API->methodCallAsyncRead('help.getSupport', [])['user']; + } else { + $id = $this->resolveUsername($id); + if ($id === null) { + throw new PeerNotInDbException; + } } } } diff --git a/src/MTProtoTools/PeerHandler.php b/src/MTProtoTools/PeerHandler.php index a867d088d..2f4042747 100644 --- a/src/MTProtoTools/PeerHandler.php +++ b/src/MTProtoTools/PeerHandler.php @@ -457,21 +457,25 @@ trait PeerHandler $id = $content; } } - $id = strtolower(str_replace('@', '', $id)); - if ($id === 'me') { - return $this->getInfo($this->authorization['user']['id'], $type); - } - if ($id === 'support') { - if (!$this->supportUser) { - $this->methodCallAsyncRead('help.getSupport', []); + if (\is_string($id)) { + $id = strtolower(str_replace('@', '', $id)); + if ($id === 'me') { + return $this->getInfo($this->authorization['user']['id'], $type); } - return $this->getInfo($this->supportUser, $type); - } - if ($bot_api_id = $this->peerDatabase->getIdFromUsername($id)) { - return $this->getInfo($bot_api_id, $type); - } - if ($bot_api_id = $this->peerDatabase->resolveUsername($id)) { - return $this->getInfo($bot_api_id, $type); + if ($id === 'support') { + if (!$this->supportUser) { + $this->methodCallAsyncRead('help.getSupport', []); + } + return $this->getInfo($this->supportUser, $type); + } + if ($bot_api_id = $this->peerDatabase->getIdFromUsername($id)) { + return $this->getInfo($bot_api_id, $type); + } + if ($bot_api_id = $this->peerDatabase->resolveUsername($id)) { + return $this->getInfo($bot_api_id, $type); + } + } else { + return $this->getInfo($id, $type); } if ($this->cacheFullDialogs()) { return $this->getInfo($id, $type); @@ -602,16 +606,18 @@ trait PeerHandler $id = $content; } } - $id = strtolower(str_replace('@', '', $id)); - if ($id === 'me') { - $id = $this->authorization['user']['id']; - } elseif ($id === 'support') { - $this->methodCallAsyncRead('help.getSupport', []); - continue; - } else { - $id = $this->peerDatabase->resolveUsername($id); - if ($id === null) { - throw new PeerNotInDbException; + if (\is_string($id)) { + $id = strtolower(str_replace('@', '', $id)); + if ($id === 'me') { + $id = $this->authorization['user']['id']; + } elseif ($id === 'support') { + $this->methodCallAsyncRead('help.getSupport', []); + continue; + } else { + $id = $this->peerDatabase->resolveUsername($id); + if ($id === null) { + throw new PeerNotInDbException; + } } } }