Skip to content

Commit 1586f33

Browse files
committed
added property typehints
1 parent 6fc8826 commit 1586f33

File tree

7 files changed

+31
-74
lines changed

7 files changed

+31
-74
lines changed

src/Mail/DkimSigner.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,11 @@ class DkimSigner implements Signer
2727
];
2828

2929
private const DkimSignature = 'DKIM-Signature';
30-
31-
/** @var string */
32-
private $domain;
33-
34-
/** @var array */
35-
private $signHeaders;
36-
37-
/** @var string */
38-
private $selector;
39-
40-
/** @var string */
41-
private $privateKey;
42-
43-
/** @var string */
44-
private $passPhrase;
30+
private string $domain;
31+
private array $signHeaders;
32+
private string $selector;
33+
private string $privateKey;
34+
private string $passPhrase;
4535

4636

4737
/** @throws Nette\NotSupportedException */
@@ -109,7 +99,7 @@ protected function computeSignature(string $rawHeader, string $signature): strin
10999

110100
$parts = [];
111101
foreach ($test = explode("\r\n", $rawHeader) as $key => $header) {
112-
if (strpos($header, ':') !== false) {
102+
if (str_contains($header, ':')) {
113103
[$heading, $value] = explode(':', $header, 2);
114104

115105
if (($index = array_search($heading, $selectedHeaders, true)) !== false) {

src/Mail/FallbackMailer.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,19 @@ class FallbackMailer implements Mailer
1717
use Nette\SmartObject;
1818

1919
/** @var callable[] function (FallbackMailer $sender, SendException $e, Mailer $mailer, Message $mail): void */
20-
public $onFailure;
20+
public iterable $onFailure = [];
2121

2222
/** @var Mailer[] */
23-
private $mailers;
23+
private array $mailers;
2424

25-
/** @var int */
26-
private $retryCount;
25+
private int $retryCount;
2726

28-
/** @var int in miliseconds */
29-
private $retryWaitTime;
27+
/** in miliseconds */
28+
private int $retryWaitTime;
3029

3130

3231
/**
3332
* @param Mailer[] $mailers
34-
* @param int $retryWaitTime in miliseconds
3533
*/
3634
public function __construct(array $mailers, int $retryCount = 3, int $retryWaitTime = 1000)
3735
{

src/Mail/Message.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,14 @@ class Message extends MimePart
2727
NORMAL = 3,
2828
LOW = 5;
2929

30-
/** @var array */
31-
public static $defaultHeaders = [
30+
public static array $defaultHeaders = [
3231
'MIME-Version' => '1.0',
3332
'X-Mailer' => 'Nette Framework',
3433
];
3534

36-
/** @var array */
37-
private $attachments = [];
38-
39-
/** @var array */
40-
private $inlines = [];
41-
42-
/** @var string */
43-
private $htmlBody = '';
35+
private array $attachments = [];
36+
private array $inlines = [];
37+
private string $htmlBody = '';
4438

4539

4640
public function __construct()

src/Mail/MimePart.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,9 @@ class MimePart
3939
SequenceValue = 1,
4040
SequenceWord = 2;
4141

42-
/** @var array */
43-
private $headers = [];
44-
45-
/** @var array */
46-
private $parts = [];
47-
48-
/** @var string */
49-
private $body = '';
42+
private array $headers = [];
43+
private array $parts = [];
44+
private string $body = '';
5045

5146

5247
/**

src/Mail/SendmailMailer.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ class SendmailMailer implements Mailer
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var string|null */
23-
public $commandArgs;
24-
25-
/** @var Signer|null */
26-
private $signer;
22+
public ?string $commandArgs = null;
23+
private ?Signer $signer = null;
2724

2825

2926
/** @return static */

src/Mail/SmtpMailer.php

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,21 @@ class SmtpMailer implements Mailer
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var Signer|null */
23-
private $signer;
22+
private ?Signer $signer = null;
2423

25-
/** @var resource|null */
24+
/** @var ?resource */
2625
private $connection;
27-
28-
/** @var string */
29-
private $host;
30-
31-
/** @var int */
32-
private $port;
33-
34-
/** @var string */
35-
private $username;
36-
37-
/** @var string */
38-
private $password;
39-
40-
/** @var string ssl | tls | (empty) */
41-
private $secure;
42-
43-
/** @var int */
44-
private $timeout;
26+
private string $host;
27+
private ?int $port;
28+
private string $username;
29+
private string $password;
30+
private string $secure;
31+
private int $timeout;
4532

4633
/** @var resource */
4734
private $context;
48-
49-
/** @var bool */
50-
private $persistent;
51-
52-
/** @var string */
53-
private $clientHost;
35+
private bool $persistent;
36+
private string $clientHost;
5437

5538

5639
public function __construct(array $options = [])

src/Mail/exceptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SmtpException extends SendException
3131
class FallbackMailerException extends SendException
3232
{
3333
/** @var SendException[] */
34-
public $failures;
34+
public array $failures;
3535
}
3636

3737

0 commit comments

Comments
 (0)