Upgrade to 3.8.0

This commit is contained in:
Bastian Allgeier
2022-10-06 10:11:54 +02:00
parent a9ed4e45ca
commit 7d168aae58
332 changed files with 26337 additions and 21977 deletions

View File

@@ -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;

View File

@@ -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');
}
}