Skip to content

Commit 91f486c

Browse files
Narrow existing return types on private/internal/final/test methods
1 parent 9e77f6d commit 91f486c

File tree

3 files changed

+17
-67
lines changed

3 files changed

+17
-67
lines changed

Crypto/DkimOptions.php

+7-28
Original file line numberDiff line numberDiff line change
@@ -25,70 +25,49 @@ public function toArray(): array
2525
return $this->options;
2626
}
2727

28-
/**
29-
* @return $this
30-
*/
31-
public function algorithm(int $algo): self
28+
public function algorithm(int $algo): static
3229
{
3330
$this->options['algorithm'] = $algo;
3431

3532
return $this;
3633
}
3734

38-
/**
39-
* @return $this
40-
*/
41-
public function signatureExpirationDelay(int $show): self
35+
public function signatureExpirationDelay(int $show): static
4236
{
4337
$this->options['signature_expiration_delay'] = $show;
4438

4539
return $this;
4640
}
4741

48-
/**
49-
* @return $this
50-
*/
51-
public function bodyMaxLength(int $max): self
42+
public function bodyMaxLength(int $max): static
5243
{
5344
$this->options['body_max_length'] = $max;
5445

5546
return $this;
5647
}
5748

58-
/**
59-
* @return $this
60-
*/
61-
public function bodyShowLength(bool $show): self
49+
public function bodyShowLength(bool $show): static
6250
{
6351
$this->options['body_show_length'] = $show;
6452

6553
return $this;
6654
}
6755

68-
/**
69-
* @return $this
70-
*/
71-
public function headerCanon(string $canon): self
56+
public function headerCanon(string $canon): static
7257
{
7358
$this->options['header_canon'] = $canon;
7459

7560
return $this;
7661
}
7762

78-
/**
79-
* @return $this
80-
*/
81-
public function bodyCanon(string $canon): self
63+
public function bodyCanon(string $canon): static
8264
{
8365
$this->options['body_canon'] = $canon;
8466

8567
return $this;
8668
}
8769

88-
/**
89-
* @return $this
90-
*/
91-
public function headersToIgnore(array $headers): self
70+
public function headersToIgnore(array $headers): static
9271
{
9372
$this->options['headers_to_ignore'] = $headers;
9473

Email.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,7 @@ private function createDataPart(array $attachment): DataPart
491491
return $part;
492492
}
493493

494-
/**
495-
* @return $this
496-
*/
497-
private function setHeaderBody(string $type, string $name, $body): object
494+
private function setHeaderBody(string $type, string $name, $body): static
498495
{
499496
$this->getHeaders()->setHeaderBody($type, $name, $body);
500497

Header/Headers.php

+9-35
Original file line numberDiff line numberDiff line change
@@ -76,66 +76,43 @@ public function getMaxLineLength(): int
7676

7777
/**
7878
* @param array<Address|string> $addresses
79-
*
80-
* @return $this
8179
*/
82-
public function addMailboxListHeader(string $name, array $addresses): self
80+
public function addMailboxListHeader(string $name, array $addresses): static
8381
{
8482
return $this->add(new MailboxListHeader($name, Address::createArray($addresses)));
8583
}
8684

87-
/**
88-
* @return $this
89-
*/
90-
public function addMailboxHeader(string $name, Address|string $address): self
85+
public function addMailboxHeader(string $name, Address|string $address): static
9186
{
9287
return $this->add(new MailboxHeader($name, Address::create($address)));
9388
}
9489

95-
/**
96-
* @return $this
97-
*/
98-
public function addIdHeader(string $name, string|array $ids): self
90+
public function addIdHeader(string $name, string|array $ids): static
9991
{
10092
return $this->add(new IdentificationHeader($name, $ids));
10193
}
10294

103-
/**
104-
* @return $this
105-
*/
106-
public function addPathHeader(string $name, Address|string $path): self
95+
public function addPathHeader(string $name, Address|string $path): static
10796
{
10897
return $this->add(new PathHeader($name, $path instanceof Address ? $path : new Address($path)));
10998
}
11099

111-
/**
112-
* @return $this
113-
*/
114-
public function addDateHeader(string $name, \DateTimeInterface $dateTime): self
100+
public function addDateHeader(string $name, \DateTimeInterface $dateTime): static
115101
{
116102
return $this->add(new DateHeader($name, $dateTime));
117103
}
118104

119-
/**
120-
* @return $this
121-
*/
122-
public function addTextHeader(string $name, string $value): self
105+
public function addTextHeader(string $name, string $value): static
123106
{
124107
return $this->add(new UnstructuredHeader($name, $value));
125108
}
126109

127-
/**
128-
* @return $this
129-
*/
130-
public function addParameterizedHeader(string $name, string $value, array $params = []): self
110+
public function addParameterizedHeader(string $name, string $value, array $params = []): static
131111
{
132112
return $this->add(new ParameterizedHeader($name, $value, $params));
133113
}
134114

135-
/**
136-
* @return $this
137-
*/
138-
public function addHeader(string $name, mixed $argument, array $more = []): self
115+
public function addHeader(string $name, mixed $argument, array $more = []): static
139116
{
140117
$parts = explode('\\', self::HEADER_CLASS_MAP[strtolower($name)] ?? UnstructuredHeader::class);
141118
$method = 'add'.ucfirst(array_pop($parts));
@@ -153,10 +130,7 @@ public function has(string $name): bool
153130
return isset($this->headers[strtolower($name)]);
154131
}
155132

156-
/**
157-
* @return $this
158-
*/
159-
public function add(HeaderInterface $header): self
133+
public function add(HeaderInterface $header): static
160134
{
161135
self::checkHeaderClass($header);
162136

0 commit comments

Comments
 (0)