Upgrade to 3.8.0
This commit is contained in:
@@ -157,7 +157,7 @@ class Email
|
||||
*
|
||||
* @return \Closure|null
|
||||
*/
|
||||
public function beforeSend(): ?Closure
|
||||
public function beforeSend(): Closure|null
|
||||
{
|
||||
return $this->beforeSend;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ class Email
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function fromName(): ?string
|
||||
public function fromName(): string|null
|
||||
{
|
||||
return $this->fromName;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ class Email
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function replyToName(): ?string
|
||||
public function replyToName(): string|null
|
||||
{
|
||||
return $this->replyToName;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ class Email
|
||||
* @param \Closure|null $beforeSend
|
||||
* @return $this
|
||||
*/
|
||||
protected function setBeforeSend(?Closure $beforeSend = null)
|
||||
protected function setBeforeSend(Closure|null $beforeSend = null)
|
||||
{
|
||||
$this->beforeSend = $beforeSend;
|
||||
return $this;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Kirby\Email;
|
||||
|
||||
use Closure;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use PHPMailer\PHPMailer\PHPMailer as Mailer;
|
||||
|
||||
@@ -96,10 +97,10 @@ class PHPMailer extends Email
|
||||
// accessible phpMailer instance
|
||||
$beforeSend = $this->beforeSend();
|
||||
|
||||
if (empty($beforeSend) === false && is_a($beforeSend, 'Closure') === true) {
|
||||
if ($beforeSend instanceof Closure) {
|
||||
$mailer = $beforeSend->call($this, $mailer) ?? $mailer;
|
||||
|
||||
if (is_a($mailer, 'PHPMailer\PHPMailer\PHPMailer') === false) {
|
||||
if ($mailer instanceof Mailer === false) {
|
||||
throw new InvalidArgumentException('"beforeSend" option return should be instance of PHPMailer\PHPMailer\PHPMailer class');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user