diff --git a/psalm.baseline.xml b/psalm.baseline.xml index f7c000e8..58af3edd 100644 --- a/psalm.baseline.xml +++ b/psalm.baseline.xml @@ -11,9 +11,8 @@ - + \is_int($retriesNum) - \is_array($params) \is_resource($this->imapStream) @@ -28,9 +27,6 @@ $mailId $mailId - - initMailPart - $mail->subject $mail->subject @@ -83,9 +79,8 @@ $t[1]->personal $t[1]->personal - + $value - $mail $to $cc $bcc @@ -112,17 +107,7 @@ $recipient->host $t[0]->mailbox - - $mail - $mail - $mail - $mail - - - $mail->subject - $mail->from - $mail->sender - $mail->to + $param->value $param->value $param->attribute @@ -148,9 +133,6 @@ $str $str - - strpos($name, '}') - $mailStructure @@ -201,10 +183,12 @@ subscribeMailbox unsubscribeMailbox - + + null != $params and !empty($params) + + !\is_int($retriesNum) or $retriesNum < 0 \is_int($retriesNum) - null != $params and !empty($params) !\is_resource($this->imapStream) || !imap_ping($this->imapStream) diff --git a/src/PhpImap/Mailbox.php b/src/PhpImap/Mailbox.php index 8f9f5777..876a53df 100644 --- a/src/PhpImap/Mailbox.php +++ b/src/PhpImap/Mailbox.php @@ -340,9 +340,14 @@ public function getLogin() * @param int $retriesNum * @param array|null $params * + * @psalm-param mixed $params + * * @throws InvalidParameterException * + * @todo drop support for php 5.6, set $options and $retriesNum to int * @todo drop support for php 5.6, set $param to `array $param = null` + * @todo drop support for php 5.6, remove @psalm-param entry + * @todo drop support for php 5.6, set `!empty($params)` to `count($params) > 0` */ public function setConnectionArgs($options = 0, $retriesNum = 0, $params = null) { @@ -481,6 +486,8 @@ public function encodeStringToUtf7Imap($str) * Returns the provided string in UTF-8 encoded format. * * @return string $str UTF-7 encoded string or same as before, when it's no string + * + * @todo revisit return issues pending fix of https://github.com/vimeo/psalm/issues/2625 */ public function decodeStringFromUtf7ImapToUtf8($str) { @@ -857,9 +864,12 @@ public function clearFlag(array $mailsIds, $flag) * draft - this mail is flagged as being a draft * * @return array $mailsIds Array of mail IDs + * + * @psalm-return list */ public function getMailsInfo(array $mailsIds) { + /** @var list|false */ $mails = $this->imap('fetch_overview', [implode(',', $mailsIds), (SE_UID == $this->imapSearchOption) ? FT_UID : 0]); if (\is_array($mails) && \count($mails)) { foreach ($mails as &$mail) { @@ -878,7 +888,7 @@ public function getMailsInfo(array $mailsIds) } } - /** @var array */ + /** @var list */ return $mails; } @@ -1195,6 +1205,8 @@ public function getMail($mailId, $markAsSeen = true) * @param bool $markAsSeen * @param bool $emlParse * + * @return void + * * @todo flesh out shape of $partStructure */ protected function initMailPart(IncomingMail $mail, $partStructure, $partNum, $markAsSeen = true, $emlParse = false) @@ -1256,7 +1268,7 @@ protected function initMailPart(IncomingMail $mail, $partStructure, $partNum, $m && (TYPEMULTIPART !== $partStructure->type && (TYPETEXT !== $partStructure->type || !\in_array(strtolower($partStructure->subtype), ['plain', 'html']))) ) { - return false; + return; } if ($isAttachment) { @@ -1731,6 +1743,8 @@ protected function possiblyGetHostNameAndAddress($t) /** * @return void + * + * @todo revisit redundant condition issues pending fix of https://github.com/vimeo/psalm/issues/2626 */ protected function pingOrDisconnect() {