Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-03-01 23:15:39 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2018-03-05 11:06:51 +0300
commit0cef93829998fd6d5879f91fb34639a5a193365c (patch)
tree1ced5de03e419b5b34662fd157ded5978c7b205d /lib/public/Mail
parent6c49cc0294b4a9e1e89c5510486e37d475a3e806 (diff)
Make \OCP\Mail strict
* Fix typehints * Made strict Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/public/Mail')
-rw-r--r--lib/public/Mail/IAttachment.php13
-rw-r--r--lib/public/Mail/IEMailTemplate.php21
-rw-r--r--lib/public/Mail/IMailer.php13
-rw-r--r--lib/public/Mail/IMessage.php29
4 files changed, 40 insertions, 36 deletions
diff --git a/lib/public/Mail/IAttachment.php b/lib/public/Mail/IAttachment.php
index 4b617d67f5e..71fa841b26c 100644
--- a/lib/public/Mail/IAttachment.php
+++ b/lib/public/Mail/IAttachment.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*
@@ -33,23 +34,23 @@ interface IAttachment {
/**
* @param string $filename
- * @return $this
+ * @return IAttachment
* @since 13.0.0
*/
- public function setFilename($filename);
+ public function setFilename(string $filename): IAttachment;
/**
* @param string $contentType
- * @return $this
+ * @return IAttachment
* @since 13.0.0
*/
- public function setContentType($contentType);
+ public function setContentType(string $contentType): IAttachment;
/**
* @param string $body
- * @return $this
+ * @return IAttachment
* @since 13.0.0
*/
- public function setBody($body);
+ public function setBody(string $body): IAttachment;
}
diff --git a/lib/public/Mail/IEMailTemplate.php b/lib/public/Mail/IEMailTemplate.php
index 6d37c21ada1..6abcdd12b9c 100644
--- a/lib/public/Mail/IEMailTemplate.php
+++ b/lib/public/Mail/IEMailTemplate.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright 2017, Morris Jobke <hey@morrisjobke.de>
*
@@ -62,7 +63,7 @@ interface IEMailTemplate {
*
* @since 13.0.0
*/
- public function setSubject($subject);
+ public function setSubject(string $subject);
/**
* Adds a header to the email
@@ -80,7 +81,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addHeading($title, $plainTitle = '');
+ public function addHeading(string $title, $plainTitle = '');
/**
* Adds a paragraph to the body of the email
@@ -91,7 +92,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addBodyText($text, $plainText = '');
+ public function addBodyText(string $text, $plainText = '');
/**
* Adds a list item to the body of the email
@@ -105,7 +106,7 @@ interface IEMailTemplate {
* if empty the $metaInfo is used, if false none will be used
* @since 12.0.0
*/
- public function addBodyListItem($text, $metaInfo = '', $icon = '', $plainText = '', $plainMetaInfo = '');
+ public function addBodyListItem(string $text, string $metaInfo = '', string $icon = '', string $plainText = '', string $plainMetaInfo = '');
/**
* Adds a button group of two buttons to the body of the email
@@ -119,7 +120,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addBodyButtonGroup($textLeft, $urlLeft, $textRight, $urlRight, $plainTextLeft = '', $plainTextRight = '');
+ public function addBodyButtonGroup(string $textLeft, string $urlLeft, string $textRight, string $urlRight, string $plainTextLeft = '', string $plainTextRight = '');
/**
* Adds a button to the body of the email
@@ -131,7 +132,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addBodyButton($text, $url, $plainText = '');
+ public function addBodyButton(string $text, string $url, string $plainText = '');
/**
* Adds a logo and a text to the footer. <br> in the text will be replaced by new lines in the plain text email
@@ -140,7 +141,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function addFooter($text = '');
+ public function addFooter(string $text = '');
/**
* Returns the rendered email subject as string
@@ -149,7 +150,7 @@ interface IEMailTemplate {
*
* @since 13.0.0
*/
- public function renderSubject();
+ public function renderSubject(): string;
/**
* Returns the rendered HTML email as string
@@ -158,7 +159,7 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function renderHtml();
+ public function renderHtml(): string;
/**
* Returns the rendered plain text email as string
@@ -167,5 +168,5 @@ interface IEMailTemplate {
*
* @since 12.0.0
*/
- public function renderText();
+ public function renderText(): string;
}
diff --git a/lib/public/Mail/IMailer.php b/lib/public/Mail/IMailer.php
index 10096548256..e8f5d6e7d03 100644
--- a/lib/public/Mail/IMailer.php
+++ b/lib/public/Mail/IMailer.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -51,7 +52,7 @@ interface IMailer {
* @return IMessage
* @since 8.1.0
*/
- public function createMessage();
+ public function createMessage(): IMessage;
/**
* @param string|null $data
@@ -60,7 +61,7 @@ interface 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;
/**
* @param string $path
@@ -68,7 +69,7 @@ interface IMailer {
* @return IAttachment
* @since 13.0.0
*/
- public function createAttachmentFromPath($path, $contentType = null);
+ public function createAttachmentFromPath(string $path, $contentType = null): IAttachment;
/**
* Creates a new email template object
@@ -78,7 +79,7 @@ interface IMailer {
* @return IEMailTemplate
* @since 12.0.0 Parameters added in 12.0.3
*/
- public function createEMailTemplate($emailId, array $data = []);
+ public function createEMailTemplate(string $emailId, array $data = []): IEMailTemplate;
/**
* Send the specified message. Also sets the from address to the value defined in config.php
@@ -91,7 +92,7 @@ interface IMailer {
* has been supplied.)
* @since 8.1.0
*/
- public function send(IMessage $message);
+ public function send(IMessage $message): array;
/**
* Checks if an e-mail address is valid
@@ -100,5 +101,5 @@ interface IMailer {
* @return bool True if the mail address is valid, false otherwise
* @since 8.1.0
*/
- public function validateMailAddress($email);
+ public function validateMailAddress(string $email): bool;
}
diff --git a/lib/public/Mail/IMessage.php b/lib/public/Mail/IMessage.php
index cec47adc19d..638fd9d103f 100644
--- a/lib/public/Mail/IMessage.php
+++ b/lib/public/Mail/IMessage.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*
@@ -33,10 +34,10 @@ interface IMessage {
/**
* @param IAttachment $attachment
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function attach(IAttachment $attachment);
+ public function attach(IAttachment $attachment): IMessage;
/**
* Set the from address of this message.
@@ -44,51 +45,51 @@ interface IMessage {
* If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php
*
* @param array $addresses Example: array('sender@domain.org', 'other@domain.org' => 'A name')
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setFrom(array $addresses);
+ public function setFrom(array $addresses): IMessage;
/**
* Set the Reply-To address of this message
*
* @param array $addresses
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setReplyTo(array $addresses);
+ public function setReplyTo(array $addresses): IMessage;
/**
* Set the to addresses of this message.
*
* @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setTo(array $recipients);
+ public function setTo(array $recipients): IMessage;
/**
* Set the CC recipients of this message.
*
* @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setCc(array $recipients);
+ public function setCc(array $recipients): IMessage;
/**
* Set the BCC recipients of this message.
*
* @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function setBcc(array $recipients);
+ public function setBcc(array $recipients): IMessage;
/**
* @param IEMailTemplate $emailTemplate
- * @return $this
+ * @return IMessage
* @since 13.0.0
*/
- public function useTemplate(IEMailTemplate $emailTemplate);
+ public function useTemplate(IEMailTemplate $emailTemplate): IMessage;
}