Skip to content

Commit c824518

Browse files
committedAug 23, 2024··
Upgrade coding standard
1 parent d0f0850 commit c824518

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed
 

‎composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
"require-dev": {
3939
"ext-xdebug": "*",
40-
"aplus/coding-standard": "^2.0",
40+
"aplus/coding-standard": "^2.8",
4141
"ergebnis/composer-normalize": "^2.23",
4242
"jetbrains/phpstorm-attributes": "^1.0",
4343
"phpmd/phpmd": "^2.13",

‎src/Mailer.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public function __construct(
4848
#[SensitiveParameter]
4949
array | string $username,
5050
#[SensitiveParameter]
51-
string $password = null,
51+
?string $password = null,
5252
string $host = 'localhost',
5353
int $port = 587,
54-
string $hostname = null
54+
?string $hostname = null
5555
) {
5656
$this->config = \is_array($username)
5757
? $this->makeConfig($username)
@@ -280,7 +280,7 @@ public function send(Message $message) : bool
280280
return $this->sendMessage($message) === 250;
281281
}
282282

283-
protected function sendMessage(Message $message) : int | false
283+
protected function sendMessage(Message $message) : false | int
284284
{
285285
if (!$this->connect()) {
286286
return false;

‎src/Message.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function getCharset() : string
153153
*
154154
* @return static
155155
*/
156-
public function setBoundary(string $boundary = null) : static
156+
public function setBoundary(?string $boundary = null) : static
157157
{
158158
$this->boundary = $boundary ?? \bin2hex(\random_bytes(16));
159159
return $this;
@@ -470,7 +470,7 @@ public function getSubject() : ?string
470470
*
471471
* @return static
472472
*/
473-
public function addTo(string $address, string $name = null) : static
473+
public function addTo(string $address, ?string $name = null) : static
474474
{
475475
$this->to[$address] = $name;
476476
$this->setHeader(Header::TO, static::formatAddressList($this->to));
@@ -506,7 +506,7 @@ public function removeTo() : static
506506
*
507507
* @return static
508508
*/
509-
public function addCc(string $address, string $name = null) : static
509+
public function addCc(string $address, ?string $name = null) : static
510510
{
511511
$this->cc[$address] = $name;
512512
$this->setHeader(Header::CC, static::formatAddressList($this->cc));
@@ -551,7 +551,7 @@ public function getRecipients() : array
551551
*
552552
* @return static
553553
*/
554-
public function addBcc(string $address, string $name = null) : static
554+
public function addBcc(string $address, ?string $name = null) : static
555555
{
556556
$this->bcc[$address] = $name;
557557
$this->setHeader(Header::BCC, static::formatAddressList($this->bcc));
@@ -587,7 +587,7 @@ public function removeBcc() : static
587587
*
588588
* @return static
589589
*/
590-
public function addReplyTo(string $address, string $name = null) : static
590+
public function addReplyTo(string $address, ?string $name = null) : static
591591
{
592592
$this->replyTo[$address] = $name;
593593
$this->setHeader(Header::REPLY_TO, static::formatAddressList($this->replyTo));
@@ -623,7 +623,7 @@ public function removeReplyTo() : static
623623
*
624624
* @return static
625625
*/
626-
public function setFrom(string $address, string $name = null) : static
626+
public function setFrom(string $address, ?string $name = null) : static
627627
{
628628
$this->from = [$address, $name];
629629
$this->setHeader(Header::FROM, static::formatAddress($address, $name));
@@ -679,7 +679,7 @@ public function removeFrom() : static
679679
*
680680
* @return static
681681
*/
682-
public function setDate(DateTime $datetime = null) : static
682+
public function setDate(?DateTime $datetime = null) : static
683683
{
684684
$date = $datetime ? $datetime->format('r') : \date('r');
685685
$this->setHeader(Header::DATE, $date);
@@ -730,7 +730,7 @@ public function getXPriority() : ?XPriority
730730
*
731731
* @return static
732732
*/
733-
public function setXMailer(string $xMailer = null) : static
733+
public function setXMailer(?string $xMailer = null) : static
734734
{
735735
$xMailer ??= 'Aplus Mailer';
736736
$this->setHeader(Header::X_MAILER, $xMailer);
@@ -747,7 +747,7 @@ public function getXMailer() : ?string
747747
return $this->getHeader(Header::X_MAILER);
748748
}
749749

750-
protected static function formatAddress(string $address, string $name = null) : string
750+
protected static function formatAddress(string $address, ?string $name = null) : string
751751
{
752752
return $name !== null ? '"' . $name . '" <' . $address . '>' : $address;
753753
}

‎tests/MessageMock.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function renderData() : string
4848
return parent::renderData();
4949
}
5050

51-
public static function formatAddress(string $address, string $name = null) : string
51+
public static function formatAddress(string $address, ?string $name = null) : string
5252
{
5353
return parent::formatAddress($address, $name);
5454
}

0 commit comments

Comments
 (0)
Please sign in to comment.