Skip to content

Commit 33ee4d2

Browse files
committed
Type casting added to several ImapProtocol return values #261
1 parent cf8a4f6 commit 33ee4d2

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
66

77
## [UNRELEASED]
88
### Fixed
9-
- NaN
9+
- Type casting added to several ImapProtocol return values #261
1010

1111
### Added
1212
- NaN

src/Connection/Protocols/ImapProtocol.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ public function moveMessage(string $folder, $from, $to = null, $uid = IMAP::ST_U
891891
$set = $this->buildSet($from, $to);
892892
$command = $this->buildUIDCommand("MOVE", $uid);
893893

894-
return $this->requestAndResponse($command, [$set, $this->escapeString($folder)], true);
894+
return (bool)$this->requestAndResponse($command, [$set, $this->escapeString($folder)], true);
895895
}
896896

897897
/**
@@ -943,7 +943,7 @@ public function ID($ids = null) {
943943
* @throws RuntimeException
944944
*/
945945
public function createFolder(string $folder): bool {
946-
return $this->requestAndResponse('CREATE', [$this->escapeString($folder)], true);
946+
return (bool)$this->requestAndResponse('CREATE', [$this->escapeString($folder)], true);
947947
}
948948

949949
/**
@@ -955,7 +955,7 @@ public function createFolder(string $folder): bool {
955955
* @throws RuntimeException
956956
*/
957957
public function renameFolder(string $old, string $new): bool {
958-
return $this->requestAndResponse('RENAME', $this->escapeString($old, $new), true);
958+
return (bool)$this->requestAndResponse('RENAME', $this->escapeString($old, $new), true);
959959
}
960960

961961
/**
@@ -966,7 +966,7 @@ public function renameFolder(string $old, string $new): bool {
966966
* @throws RuntimeException
967967
*/
968968
public function deleteFolder(string $folder): bool {
969-
return $this->requestAndResponse('DELETE', [$this->escapeString($folder)], true);
969+
return (bool)$this->requestAndResponse('DELETE', [$this->escapeString($folder)], true);
970970
}
971971

972972
/**
@@ -977,7 +977,7 @@ public function deleteFolder(string $folder): bool {
977977
* @throws RuntimeException
978978
*/
979979
public function subscribeFolder(string $folder): bool {
980-
return $this->requestAndResponse('SUBSCRIBE', [$this->escapeString($folder)], true);
980+
return (bool)$this->requestAndResponse('SUBSCRIBE', [$this->escapeString($folder)], true);
981981
}
982982

983983
/**
@@ -988,7 +988,7 @@ public function subscribeFolder(string $folder): bool {
988988
* @throws RuntimeException
989989
*/
990990
public function unsubscribeFolder(string $folder): bool {
991-
return $this->requestAndResponse('UNSUBSCRIBE', [$this->escapeString($folder)], true);
991+
return (bool)$this->requestAndResponse('UNSUBSCRIBE', [$this->escapeString($folder)], true);
992992
}
993993

994994
/**
@@ -998,7 +998,7 @@ public function unsubscribeFolder(string $folder): bool {
998998
* @throws RuntimeException
999999
*/
10001000
public function expunge(): bool {
1001-
return $this->requestAndResponse('EXPUNGE');
1001+
return (bool)$this->requestAndResponse('EXPUNGE');
10021002
}
10031003

10041004
/**
@@ -1008,7 +1008,7 @@ public function expunge(): bool {
10081008
* @throws RuntimeException
10091009
*/
10101010
public function noop(): bool {
1011-
return $this->requestAndResponse('NOOP');
1011+
return (bool)$this->requestAndResponse('NOOP');
10121012
}
10131013

10141014
/**

src/Connection/Protocols/LegacyProtocol.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ public function copyMessage(string $folder, $from, $to = null, $uid = IMAP::ST_U
412412
*/
413413
public function copyManyMessages(array $messages, string $folder, $uid = IMAP::ST_UID) {
414414
foreach($messages as $msg) {
415-
if ($this->copyMessage($folder, $msg, null, $uid) == false) {
415+
if (!$this->copyMessage($folder, $msg, null, $uid)) {
416416
return false;
417417
}
418418
}
@@ -421,7 +421,7 @@ public function copyManyMessages(array $messages, string $folder, $uid = IMAP::S
421421
}
422422

423423
/**
424-
* Move a message set from current folder to an other folder
424+
* Move a message set from current folder to another folder
425425
* @param string $folder destination folder
426426
* @param $from
427427
* @param int|null $to if null only one message ($from) is fetched, else it's the
@@ -444,7 +444,7 @@ public function moveMessage(string $folder, $from, $to = null, $uid = IMAP::ST_U
444444
*/
445445
public function moveManyMessages(array $messages, string $folder, $uid = IMAP::ST_UID) {
446446
foreach($messages as $msg) {
447-
if ($this->moveMessage($folder, $msg, null, $uid) == false) {
447+
if (!$this->moveMessage($folder, $msg, null, $uid)) {
448448
return false;
449449
}
450450
}

0 commit comments

Comments
 (0)