aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Mail/Mailer.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Mail/Mailer.php')
-rw-r--r--lib/private/Mail/Mailer.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index 3637bb1e27d..5a054d2efd2 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -91,7 +92,7 @@ class Mailer implements IMailer {
*
* @return IMessage
*/
- public function createMessage() {
+ public function createMessage(): IMessage {
return new Message(new \Swift_Message());
}
@@ -102,7 +103,7 @@ class Mailer implements IMailer {
* @return IAttachment
* @since 13.0.0
*/
- public function createAttachment($data = null, $filename = null, $contentType = null) {
+ public function createAttachment($data = null, $filename = null, $contentType = null): IAttachment {
return new Attachment(\Swift_Attachment::newInstance($data, $filename, $contentType));
}
@@ -112,7 +113,7 @@ class Mailer implements IMailer {
* @return IAttachment
* @since 13.0.0
*/
- public function createAttachmentFromPath($path, $contentType = null) {
+ public function createAttachmentFromPath(string $path, $contentType = null): IAttachment {
return new Attachment(\Swift_Attachment::fromPath($path, $contentType));
}
@@ -124,7 +125,7 @@ class Mailer implements IMailer {
* @return IEMailTemplate
* @since 12.0.0
*/
- public function createEMailTemplate($emailId, array $data = []) {
+ public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate {
$class = $this->config->getSystemValue('mail_template_class', '');
if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) {
@@ -156,7 +157,7 @@ class Mailer implements IMailer {
* @throws \Exception In case it was not possible to send the message. (for example if an invalid mail address
* has been supplied.)
*/
- public function send(IMessage $message) {
+ public function send(IMessage $message): array {
$debugMode = $this->config->getSystemValue('mail_smtpdebug', false);
if (empty($message->getFrom())) {
@@ -191,7 +192,7 @@ class Mailer implements IMailer {
* @param string $email Email address to be validated
* @return bool True if the mail address is valid, false otherwise
*/
- public function validateMailAddress($email) {
+ public function validateMailAddress(string $email): bool {
return \Swift_Validate::email($this->convertEmail($email));
}
@@ -203,7 +204,7 @@ class Mailer implements IMailer {
* @param string $email
* @return string Converted mail address if `idn_to_ascii` exists
*/
- protected function convertEmail($email) {
+ protected function convertEmail(string $email): string {
if (!function_exists('idn_to_ascii') || strpos($email, '@') === false) {
return $email;
}
@@ -246,7 +247,7 @@ class Mailer implements IMailer {
*
* @return \Swift_SmtpTransport
*/
- protected function getSmtpInstance() {
+ protected function getSmtpInstance(): \Swift_SmtpTransport {
$transport = \Swift_SmtpTransport::newInstance();
$transport->setTimeout($this->config->getSystemValue('mail_smtptimeout', 10));
$transport->setHost($this->config->getSystemValue('mail_smtphost', '127.0.0.1'));
@@ -269,7 +270,7 @@ class Mailer implements IMailer {
*
* @return \Swift_SendmailTransport
*/
- protected function getSendMailInstance() {
+ protected function getSendMailInstance(): \Swift_SendmailTransport {
switch ($this->config->getSystemValue('mail_smtpmode', 'php')) {
case 'qmail':
$binaryPath = '/var/qmail/bin/sendmail';
@@ -287,7 +288,7 @@ class Mailer implements IMailer {
*
* @return \Swift_MailTransport
*/
- protected function getMailInstance() {
+ protected function getMailInstance(): \Swift_MailTransport {
return \Swift_MailTransport::newInstance();
}