diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-07-24 11:22:58 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-07-24 11:22:58 +0300 |
commit | db752f41f2f8f1f4b7477093b27e7a845dcf6090 (patch) | |
tree | 4ed8aa5616db645eac3b66faf2a197b1b2345a8b | |
parent | 1d17898cdd788346e89ebee355cccf9d2f0c1eac (diff) |
Make IMailManager strict
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r-- | lib/Contracts/IMailManager.php | 10 | ||||
-rw-r--r-- | lib/Service/MailManager.php | 17 |
2 files changed, 14 insertions, 13 deletions
diff --git a/lib/Contracts/IMailManager.php b/lib/Contracts/IMailManager.php index d1339377e..20c9bb3d8 100644 --- a/lib/Contracts/IMailManager.php +++ b/lib/Contracts/IMailManager.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @@ -32,14 +34,14 @@ interface IMailManager { * @param Account $account * @return Folder[] */ - public function getFolders(Account $account); + public function getFolders(Account $account): array; /** * @param Account * @param SyncRequest $syncRequest * @return SyncResponse */ - public function syncMessages(Account $account, SyncRequest $syncRequest); + public function syncMessages(Account $account, SyncRequest $syncRequest): SyncResponse; /** * @param Account $sourceAccount @@ -48,6 +50,6 @@ interface IMailManager { * @param Account $destinationAccount * @param string $destFolderId */ - public function moveMessage(Account $sourceAccount, $sourceFolderId, - $messageId, Account $destinationAccount, $destFolderId); + public function moveMessage(Account $sourceAccount, string $sourceFolderId, int $messageId, + Account $destinationAccount, string $destFolderId); } diff --git a/lib/Service/MailManager.php b/lib/Service/MailManager.php index b067c1945..23a3f612b 100644 --- a/lib/Service/MailManager.php +++ b/lib/Service/MailManager.php @@ -32,7 +32,6 @@ use OCA\Mail\IMAP\MessageMapper; use OCA\Mail\IMAP\Sync\Request; use OCA\Mail\IMAP\Sync\Response; use OCA\Mail\IMAP\Sync\Synchronizer; -use OCA\Mail\Service\FolderNameTranslator; class MailManager implements IMailManager { @@ -63,9 +62,9 @@ class MailManager implements IMailManager { * @param MessageMapper $messageMapper */ public function __construct(IMAPClientFactory $imapClientFactory, - FolderMapper $folderMapper, MailboxPrefixDetector $prefixDetector, - FolderNameTranslator $folderNameTranslator, Synchronizer $synchronizer, - MessageMapper $messageMapper) { + FolderMapper $folderMapper, MailboxPrefixDetector $prefixDetector, + FolderNameTranslator $folderNameTranslator, Synchronizer $synchronizer, + MessageMapper $messageMapper) { $this->imapClientFactory = $imapClientFactory; $this->folderMapper = $folderMapper; $this->prefixDetector = $prefixDetector; @@ -78,7 +77,7 @@ class MailManager implements IMailManager { * @param Account $account * @return Folder[] */ - public function getFolders(Account $account) { + public function getFolders(Account $account): array { $client = $this->imapClientFactory->getClient($account); $folders = $this->folderMapper->getFolders($account, $client); @@ -95,7 +94,7 @@ class MailManager implements IMailManager { * @param Request $syncRequest * @return Response */ - public function syncMessages(Account $account, Request $syncRequest) { + public function syncMessages(Account $account, Request $syncRequest): Response { $client = $this->imapClientFactory->getClient($account); return $this->synchronizer->sync($client, $syncRequest); @@ -108,8 +107,8 @@ class MailManager implements IMailManager { * @param Account $destinationAccount * @param string $destFolderId */ - public function moveMessage(Account $sourceAccount, $sourceFolderId, - $messageId, Account $destinationAccount, $destFolderId) { + public function moveMessage(Account $sourceAccount, string $sourceFolderId, int $messageId, + Account $destinationAccount, string $destFolderId) { if ($sourceAccount->getId() === $destinationAccount->getId()) { $this->moveMessageOnSameAccount($sourceAccount, $sourceFolderId, @@ -126,7 +125,7 @@ class MailManager implements IMailManager { * @param int $messageId */ private function moveMessageOnSameAccount(Account $account, $sourceFolderId, - $destFolderId, $messageId) { + $destFolderId, $messageId) { $client = $this->imapClientFactory->getClient($account); $this->messageMapper->move($client, $sourceFolderId, $messageId, $destFolderId); |