Skip to content

Commit

Permalink
PHP 8: clean up Email package
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed Oct 31, 2022
1 parent 2ddb926 commit eddc48d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 159 deletions.
27 changes: 6 additions & 21 deletions src/Email/Body.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,11 @@ class Body
{
use Properties;

/**
* @var string
*/
protected $html;

/**
* @var string
*/
protected $text;
protected string|null $html = null;
protected string|null $text = null;

/**
* Email body constructor
*
* @param array $props
*/
public function __construct(array $props = [])
{
Expand All @@ -41,31 +32,26 @@ public function __construct(array $props = [])

/**
* Returns the HTML content of the email body
*
* @return string
*/
public function html()
public function html(): string
{
return $this->html ?? '';
}

/**
* Returns the plain text content of the email body
*
* @return string
*/
public function text()
public function text(): string
{
return $this->text ?? '';
}

/**
* Sets the HTML content for the email body
*
* @param string|null $html
* @return $this
*/
protected function setHtml(string $html = null)
protected function setHtml(string|null $html = null): static
{
$this->html = $html;
return $this;
Expand All @@ -74,10 +60,9 @@ protected function setHtml(string $html = null)
/**
* Sets the plain text content for the email body
*
* @param string|null $text
* @return $this
*/
protected function setText(string $text = null)
protected function setText(string|null $text = null): static
{
$this->text = $text;
return $this;
Expand Down
Loading

0 comments on commit eddc48d

Please sign in to comment.