Skip to content

Commit 33c42f7

Browse files
committed
cs nullable typehints
1 parent ab8cc4e commit 33c42f7

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/Mail/Message.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct()
5757
* Sets the sender of the message. Email or format "John Doe" <[email protected]>
5858
* @return static
5959
*/
60-
public function setFrom(string $email, string $name = null)
60+
public function setFrom(string $email, ?string $name = null)
6161
{
6262
$this->setHeader('From', $this->formatEmail($email, $name));
6363
return $this;
@@ -77,7 +77,7 @@ public function getFrom(): ?array
7777
* Adds the reply-to address. Email or format "John Doe" <[email protected]>
7878
* @return static
7979
*/
80-
public function addReplyTo(string $email, string $name = null)
80+
public function addReplyTo(string $email, ?string $name = null)
8181
{
8282
$this->setHeader('Reply-To', $this->formatEmail($email, $name), true);
8383
return $this;
@@ -108,7 +108,7 @@ public function getSubject(): ?string
108108
* Adds email recipient. Email or format "John Doe" <[email protected]>
109109
* @return static
110110
*/
111-
public function addTo(string $email, string $name = null) // addRecipient()
111+
public function addTo(string $email, ?string $name = null) // addRecipient()
112112
{
113113
$this->setHeader('To', $this->formatEmail($email, $name), true);
114114
return $this;
@@ -119,7 +119,7 @@ public function addTo(string $email, string $name = null) // addRecipient()
119119
* Adds carbon copy email recipient. Email or format "John Doe" <[email protected]>
120120
* @return static
121121
*/
122-
public function addCc(string $email, string $name = null)
122+
public function addCc(string $email, ?string $name = null)
123123
{
124124
$this->setHeader('Cc', $this->formatEmail($email, $name), true);
125125
return $this;
@@ -130,7 +130,7 @@ public function addCc(string $email, string $name = null)
130130
* Adds blind carbon copy email recipient. Email or format "John Doe" <[email protected]>
131131
* @return static
132132
*/
133-
public function addBcc(string $email, string $name = null)
133+
public function addBcc(string $email, ?string $name = null)
134134
{
135135
$this->setHeader('Bcc', $this->formatEmail($email, $name), true);
136136
return $this;
@@ -140,7 +140,7 @@ public function addBcc(string $email, string $name = null)
140140
/**
141141
* Formats recipient email.
142142
*/
143-
private function formatEmail(string $email, string $name = null): array
143+
private function formatEmail(string $email, ?string $name = null): array
144144
{
145145
if (!$name && preg_match('#^(.+) +<(.*)>$#D', $email, $matches)) {
146146
[, $name, $email] = $matches;
@@ -200,7 +200,7 @@ public function getPriority(): ?int
200200
* Sets HTML body.
201201
* @return static
202202
*/
203-
public function setHtmlBody(string $html, string $basePath = null)
203+
public function setHtmlBody(string $html, ?string $basePath = null)
204204
{
205205
if ($basePath) {
206206
$cids = [];
@@ -259,7 +259,7 @@ public function getHtmlBody(): string
259259
/**
260260
* Adds embedded file.
261261
*/
262-
public function addEmbeddedFile(string $file, string $content = null, string $contentType = null): MimePart
262+
public function addEmbeddedFile(string $file, ?string $content = null, ?string $contentType = null): MimePart
263263
{
264264
return $this->inlines[$file] = $this->createAttachment($file, $content, $contentType, 'inline')
265265
->setHeader('Content-ID', $this->getRandomId());
@@ -280,7 +280,7 @@ public function addInlinePart(MimePart $part)
280280
/**
281281
* Adds attachment.
282282
*/
283-
public function addAttachment(string $file, string $content = null, string $contentType = null): MimePart
283+
public function addAttachment(string $file, ?string $content = null, ?string $contentType = null): MimePart
284284
{
285285
return $this->attachments[] = $this->createAttachment($file, $content, $contentType, 'attachment');
286286
}

src/Mail/MimePart.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function getHeaders(): array
161161
* Sets Content-Type header.
162162
* @return static
163163
*/
164-
public function setContentType(string $contentType, string $charset = null)
164+
public function setContentType(string $contentType, ?string $charset = null)
165165
{
166166
$this->setHeader('Content-Type', $contentType . ($charset ? "; charset=$charset" : ''));
167167
return $this;
@@ -191,7 +191,7 @@ public function getEncoding(): string
191191
/**
192192
* Adds or creates new multipart.
193193
*/
194-
public function addPart(self $part = null): self
194+
public function addPart(?self $part = null): self
195195
{
196196
return $this->parts[] = $part ?? new self;
197197
}
@@ -287,7 +287,7 @@ public function getEncodedMessage(): string
287287
/**
288288
* Converts a 8 bit header to a string.
289289
*/
290-
private static function encodeSequence(string $s, int &$offset = 0, int $type = null): string
290+
private static function encodeSequence(string $s, int &$offset = 0, ?int $type = null): string
291291
{
292292
if (
293293
(strlen($s) < self::LINE_LENGTH - 3) && // 3 is tab + quotes

src/Mail/SmtpMailer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ protected function disconnect(): void
227227
* Writes data to server and checks response against expected code if some provided.
228228
* @param int|int[] $expectedCode
229229
*/
230-
protected function write(string $line, $expectedCode = null, string $message = null): void
230+
protected function write(string $line, $expectedCode = null, ?string $message = null): void
231231
{
232232
fwrite($this->connection, $line . Message::EOL);
233233
if ($expectedCode) {

0 commit comments

Comments
 (0)