Skip to content

Commit 095536f

Browse files
Add return types - batch 3/n
1 parent 91f486c commit 095536f

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

Email.php

+22-22
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Email extends Message
4747
/**
4848
* @return $this
4949
*/
50-
public function subject(string $subject)
50+
public function subject(string $subject): static
5151
{
5252
return $this->setHeaderBody('Text', 'Subject', $subject);
5353
}
@@ -60,7 +60,7 @@ public function getSubject(): ?string
6060
/**
6161
* @return $this
6262
*/
63-
public function date(\DateTimeInterface $dateTime)
63+
public function date(\DateTimeInterface $dateTime): static
6464
{
6565
return $this->setHeaderBody('Date', 'Date', $dateTime);
6666
}
@@ -73,7 +73,7 @@ public function getDate(): ?\DateTimeImmutable
7373
/**
7474
* @return $this
7575
*/
76-
public function returnPath(Address|string $address)
76+
public function returnPath(Address|string $address): static
7777
{
7878
return $this->setHeaderBody('Path', 'Return-Path', Address::create($address));
7979
}
@@ -86,7 +86,7 @@ public function getReturnPath(): ?Address
8686
/**
8787
* @return $this
8888
*/
89-
public function sender(Address|string $address)
89+
public function sender(Address|string $address): static
9090
{
9191
return $this->setHeaderBody('Mailbox', 'Sender', Address::create($address));
9292
}
@@ -99,15 +99,15 @@ public function getSender(): ?Address
9999
/**
100100
* @return $this
101101
*/
102-
public function addFrom(Address|string ...$addresses)
102+
public function addFrom(Address|string ...$addresses): static
103103
{
104104
return $this->addListAddressHeaderBody('From', $addresses);
105105
}
106106

107107
/**
108108
* @return $this
109109
*/
110-
public function from(Address|string ...$addresses)
110+
public function from(Address|string ...$addresses): static
111111
{
112112
return $this->setListAddressHeaderBody('From', $addresses);
113113
}
@@ -123,15 +123,15 @@ public function getFrom(): array
123123
/**
124124
* @return $this
125125
*/
126-
public function addReplyTo(Address|string ...$addresses)
126+
public function addReplyTo(Address|string ...$addresses): static
127127
{
128128
return $this->addListAddressHeaderBody('Reply-To', $addresses);
129129
}
130130

131131
/**
132132
* @return $this
133133
*/
134-
public function replyTo(Address|string ...$addresses)
134+
public function replyTo(Address|string ...$addresses): static
135135
{
136136
return $this->setListAddressHeaderBody('Reply-To', $addresses);
137137
}
@@ -147,15 +147,15 @@ public function getReplyTo(): array
147147
/**
148148
* @return $this
149149
*/
150-
public function addTo(Address|string ...$addresses)
150+
public function addTo(Address|string ...$addresses): static
151151
{
152152
return $this->addListAddressHeaderBody('To', $addresses);
153153
}
154154

155155
/**
156156
* @return $this
157157
*/
158-
public function to(Address|string ...$addresses)
158+
public function to(Address|string ...$addresses): static
159159
{
160160
return $this->setListAddressHeaderBody('To', $addresses);
161161
}
@@ -171,15 +171,15 @@ public function getTo(): array
171171
/**
172172
* @return $this
173173
*/
174-
public function addCc(Address|string ...$addresses)
174+
public function addCc(Address|string ...$addresses): static
175175
{
176176
return $this->addListAddressHeaderBody('Cc', $addresses);
177177
}
178178

179179
/**
180180
* @return $this
181181
*/
182-
public function cc(Address|string ...$addresses)
182+
public function cc(Address|string ...$addresses): static
183183
{
184184
return $this->setListAddressHeaderBody('Cc', $addresses);
185185
}
@@ -195,15 +195,15 @@ public function getCc(): array
195195
/**
196196
* @return $this
197197
*/
198-
public function addBcc(Address|string ...$addresses)
198+
public function addBcc(Address|string ...$addresses): static
199199
{
200200
return $this->addListAddressHeaderBody('Bcc', $addresses);
201201
}
202202

203203
/**
204204
* @return $this
205205
*/
206-
public function bcc(Address|string ...$addresses)
206+
public function bcc(Address|string ...$addresses): static
207207
{
208208
return $this->setListAddressHeaderBody('Bcc', $addresses);
209209
}
@@ -223,7 +223,7 @@ public function getBcc(): array
223223
*
224224
* @return $this
225225
*/
226-
public function priority(int $priority)
226+
public function priority(int $priority): static
227227
{
228228
if ($priority > 5) {
229229
$priority = 5;
@@ -252,7 +252,7 @@ public function getPriority(): int
252252
*
253253
* @return $this
254254
*/
255-
public function text($body, string $charset = 'utf-8')
255+
public function text($body, string $charset = 'utf-8'): static
256256
{
257257
$this->text = $body;
258258
$this->textCharset = $charset;
@@ -278,7 +278,7 @@ public function getTextCharset(): ?string
278278
*
279279
* @return $this
280280
*/
281-
public function html($body, string $charset = 'utf-8')
281+
public function html($body, string $charset = 'utf-8'): static
282282
{
283283
$this->html = $body;
284284
$this->htmlCharset = $charset;
@@ -304,7 +304,7 @@ public function getHtmlCharset(): ?string
304304
*
305305
* @return $this
306306
*/
307-
public function attach($body, string $name = null, string $contentType = null)
307+
public function attach($body, string $name = null, string $contentType = null): static
308308
{
309309
$this->attachments[] = ['body' => $body, 'name' => $name, 'content-type' => $contentType, 'inline' => false];
310310

@@ -314,7 +314,7 @@ public function attach($body, string $name = null, string $contentType = null)
314314
/**
315315
* @return $this
316316
*/
317-
public function attachFromPath(string $path, string $name = null, string $contentType = null)
317+
public function attachFromPath(string $path, string $name = null, string $contentType = null): static
318318
{
319319
$this->attachments[] = ['path' => $path, 'name' => $name, 'content-type' => $contentType, 'inline' => false];
320320

@@ -326,7 +326,7 @@ public function attachFromPath(string $path, string $name = null, string $conten
326326
*
327327
* @return $this
328328
*/
329-
public function embed($body, string $name = null, string $contentType = null)
329+
public function embed($body, string $name = null, string $contentType = null): static
330330
{
331331
$this->attachments[] = ['body' => $body, 'name' => $name, 'content-type' => $contentType, 'inline' => true];
332332

@@ -336,7 +336,7 @@ public function embed($body, string $name = null, string $contentType = null)
336336
/**
337337
* @return $this
338338
*/
339-
public function embedFromPath(string $path, string $name = null, string $contentType = null)
339+
public function embedFromPath(string $path, string $name = null, string $contentType = null): static
340340
{
341341
$this->attachments[] = ['path' => $path, 'name' => $name, 'content-type' => $contentType, 'inline' => true];
342342

@@ -346,7 +346,7 @@ public function embedFromPath(string $path, string $name = null, string $content
346346
/**
347347
* @return $this
348348
*/
349-
public function attachPart(DataPart $part)
349+
public function attachPart(DataPart $part): static
350350
{
351351
$this->attachments[] = ['part' => $part];
352352

Header/HeaderInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function setBody(mixed $body);
3232
*
3333
* @return mixed
3434
*/
35-
public function getBody();
35+
public function getBody(): mixed;
3636

3737
public function setCharset(string $charset);
3838

Header/UnstructuredHeader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function setBody(mixed $body)
3838
/**
3939
* @return string
4040
*/
41-
public function getBody()
41+
public function getBody(): string
4242
{
4343
return $this->getValue();
4444
}

Message.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __clone()
4242
/**
4343
* @return $this
4444
*/
45-
public function setBody(AbstractPart $body = null)
45+
public function setBody(AbstractPart $body = null): static
4646
{
4747
$this->body = $body;
4848

@@ -57,7 +57,7 @@ public function getBody(): ?AbstractPart
5757
/**
5858
* @return $this
5959
*/
60-
public function setHeaders(Headers $headers)
60+
public function setHeaders(Headers $headers): static
6161
{
6262
$this->headers = $headers;
6363

Part/DataPart.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static function fromPath(string $path, string $name = null, string $conte
7272
/**
7373
* @return $this
7474
*/
75-
public function asInline()
75+
public function asInline(): static
7676
{
7777
return $this->setDisposition('inline');
7878
}
@@ -132,7 +132,7 @@ public function __destruct()
132132
/**
133133
* @return array
134134
*/
135-
public function __sleep()
135+
public function __sleep(): array
136136
{
137137
// converts the body to a string
138138
parent::__sleep();

Part/TextPart.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getMediaSubtype(): string
7777
*
7878
* @return $this
7979
*/
80-
public function setDisposition(string $disposition)
80+
public function setDisposition(string $disposition): static
8181
{
8282
$this->disposition = $disposition;
8383

@@ -89,7 +89,7 @@ public function setDisposition(string $disposition)
8989
*
9090
* @return $this
9191
*/
92-
public function setName(string $name)
92+
public function setName(string $name): static
9393
{
9494
$this->name = $name;
9595

@@ -187,7 +187,7 @@ private function chooseEncoding(): string
187187
/**
188188
* @return array
189189
*/
190-
public function __sleep()
190+
public function __sleep(): array
191191
{
192192
// convert resources to strings for serialization
193193
if (null !== $this->seekable) {

0 commit comments

Comments
 (0)