We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 71ed073 commit 0a19905Copy full SHA for 0a19905
src/Mailbox.php
@@ -8,6 +8,7 @@
8
use DirectoryTree\ImapEngine\Connection\Loggers\FileLogger;
9
use DirectoryTree\ImapEngine\Connection\Streams\ImapStream;
10
use DirectoryTree\ImapEngine\Connection\Tokens\Atom;
11
+use Exception;
12
13
class Mailbox implements MailboxInterface
14
{
@@ -167,12 +168,14 @@ protected function authenticate(): void
167
168
*/
169
public function disconnect(): void
170
- if ($this->connected()) {
171
- $this->connection->logout();
172
- $this->connection->disconnect();
+ try {
+ $this->connection?->logout();
173
+ $this->connection?->disconnect();
174
+ } catch (Exception) {
175
+ // Do nothing.
176
+ } finally {
177
+ $this->connection = null;
178
}
-
- $this->connection = null;
179
180
181
/**
0 commit comments