2424use Exception ;
2525use Generator ;
2626use LogicException ;
27+ use Throwable ;
2728
2829class ImapConnection implements ConnectionInterface
2930{
@@ -122,6 +123,8 @@ public function connect(string $host, ?int $port = null, array $options = []): v
122123
123124 /**
124125 * Get the default socket options for the given transport.
126+ *
127+ * @param 'ssl'|'tls'|'starttls'|'tcp' $transport
125128 */
126129 protected function getDefaultSocketOptions (string $ transport , array $ proxy = [], bool $ validateCert = true ): array
127130 {
@@ -595,6 +598,8 @@ public function done(): void
595598
596599 /**
597600 * Send an IMAP command.
601+ *
602+ * @param-out string $tag
598603 */
599604 public function send (string $ name , array $ tokens = [], ?string &$ tag = null ): void
600605 {
@@ -722,8 +727,12 @@ protected function assertTaggedResponse(string $tag, ?callable $exception = null
722727 *
723728 * @template T of Response
724729 *
725- * @param callable(T): bool $filter
730+ * @param callable(Response): bool $filter
731+ * @param callable(T): bool $assertion
732+ * @param callable(T): Throwable $exception
726733 * @return T
734+ *
735+ * @throws ImapResponseException
727736 */
728737 protected function assertNextResponse (callable $ filter , callable $ assertion , callable $ exception ): Response
729738 {
@@ -744,9 +753,9 @@ protected function assertNextResponse(callable $filter, callable $assertion, cal
744753 * @template T of Response
745754 *
746755 * @param callable(T): bool $filter
747- * @return T
756+ * @return T|null
748757 */
749- protected function nextResponse (callable $ filter ): Response
758+ protected function nextResponse (callable $ filter ): ? Response
750759 {
751760 if (! $ this ->parser ) {
752761 throw new LogicException ('No parser instance set ' );
@@ -764,7 +773,7 @@ protected function nextResponse(callable $filter): Response
764773 }
765774 }
766775
767- throw new ImapResponseException ( ' No matching response found ' ) ;
776+ return null ;
768777 }
769778
770779 /**
0 commit comments