Skip to content

Commit

Permalink
Upgrade coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Aug 23, 2024
1 parent d0f0850 commit c824518
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"require-dev": {
"ext-xdebug": "*",
"aplus/coding-standard": "^2.0",
"aplus/coding-standard": "^2.8",
"ergebnis/composer-normalize": "^2.23",
"jetbrains/phpstorm-attributes": "^1.0",
"phpmd/phpmd": "^2.13",
Expand Down
6 changes: 3 additions & 3 deletions src/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public function __construct(
#[SensitiveParameter]
array | string $username,
#[SensitiveParameter]
string $password = null,
?string $password = null,
string $host = 'localhost',
int $port = 587,
string $hostname = null
?string $hostname = null
) {
$this->config = \is_array($username)
? $this->makeConfig($username)
Expand Down Expand Up @@ -280,7 +280,7 @@ public function send(Message $message) : bool
return $this->sendMessage($message) === 250;
}

protected function sendMessage(Message $message) : int | false
protected function sendMessage(Message $message) : false | int
{
if (!$this->connect()) {
return false;
Expand Down
18 changes: 9 additions & 9 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ protected function getCharset() : string
*
* @return static
*/
public function setBoundary(string $boundary = null) : static
public function setBoundary(?string $boundary = null) : static
{
$this->boundary = $boundary ?? \bin2hex(\random_bytes(16));
return $this;
Expand Down Expand Up @@ -470,7 +470,7 @@ public function getSubject() : ?string
*
* @return static
*/
public function addTo(string $address, string $name = null) : static
public function addTo(string $address, ?string $name = null) : static
{
$this->to[$address] = $name;
$this->setHeader(Header::TO, static::formatAddressList($this->to));
Expand Down Expand Up @@ -506,7 +506,7 @@ public function removeTo() : static
*
* @return static
*/
public function addCc(string $address, string $name = null) : static
public function addCc(string $address, ?string $name = null) : static
{
$this->cc[$address] = $name;
$this->setHeader(Header::CC, static::formatAddressList($this->cc));
Expand Down Expand Up @@ -551,7 +551,7 @@ public function getRecipients() : array
*
* @return static
*/
public function addBcc(string $address, string $name = null) : static
public function addBcc(string $address, ?string $name = null) : static
{
$this->bcc[$address] = $name;
$this->setHeader(Header::BCC, static::formatAddressList($this->bcc));
Expand Down Expand Up @@ -587,7 +587,7 @@ public function removeBcc() : static
*
* @return static
*/
public function addReplyTo(string $address, string $name = null) : static
public function addReplyTo(string $address, ?string $name = null) : static
{
$this->replyTo[$address] = $name;
$this->setHeader(Header::REPLY_TO, static::formatAddressList($this->replyTo));
Expand Down Expand Up @@ -623,7 +623,7 @@ public function removeReplyTo() : static
*
* @return static
*/
public function setFrom(string $address, string $name = null) : static
public function setFrom(string $address, ?string $name = null) : static
{
$this->from = [$address, $name];
$this->setHeader(Header::FROM, static::formatAddress($address, $name));
Expand Down Expand Up @@ -679,7 +679,7 @@ public function removeFrom() : static
*
* @return static
*/
public function setDate(DateTime $datetime = null) : static
public function setDate(?DateTime $datetime = null) : static
{
$date = $datetime ? $datetime->format('r') : \date('r');
$this->setHeader(Header::DATE, $date);
Expand Down Expand Up @@ -730,7 +730,7 @@ public function getXPriority() : ?XPriority
*
* @return static
*/
public function setXMailer(string $xMailer = null) : static
public function setXMailer(?string $xMailer = null) : static
{
$xMailer ??= 'Aplus Mailer';
$this->setHeader(Header::X_MAILER, $xMailer);
Expand All @@ -747,7 +747,7 @@ public function getXMailer() : ?string
return $this->getHeader(Header::X_MAILER);
}

protected static function formatAddress(string $address, string $name = null) : string
protected static function formatAddress(string $address, ?string $name = null) : string
{
return $name !== null ? '"' . $name . '" <' . $address . '>' : $address;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/MessageMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function renderData() : string
return parent::renderData();
}

public static function formatAddress(string $address, string $name = null) : string
public static function formatAddress(string $address, ?string $name = null) : string
{
return parent::formatAddress($address, $name);
}
Expand Down

0 comments on commit c824518

Please sign in to comment.