More PHP8.4 updates

This commit is contained in:
James Cole
2025-05-04 13:47:00 +02:00
parent e42107c03c
commit 51e86448c7
195 changed files with 524 additions and 715 deletions

View File

@@ -41,11 +41,8 @@ class UnknownUserLoginAttempt extends Notification
{
use Queueable;
private string $address;
public function __construct(string $address)
public function __construct(private string $address)
{
$this->address = $address;
}
/**

View File

@@ -45,11 +45,8 @@ class UserInvitation extends Notification
{
use Queueable;
private InvitedUser $invitee;
public function __construct(InvitedUser $invitee)
public function __construct(private InvitedUser $invitee)
{
$this->invitee = $invitee;
}
/**
@@ -72,7 +69,7 @@ class UserInvitation extends Notification
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())
return new MailMessage()
->markdown('emails.invitation-created', ['email' => $this->invitee->user->email, 'invitee' => $this->invitee->email, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])
->subject((string) trans('email.invitation_created_subject'))
;

View File

@@ -45,11 +45,8 @@ class UserRegistration extends Notification
{
use Queueable;
private User $user;
public function __construct(User $user)
public function __construct(private User $user)
{
$this->user = $user;
}
/**
@@ -71,7 +68,7 @@ class UserRegistration extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())
return new MailMessage()
->markdown('emails.registered-admin', ['email' => $this->user->email, 'id' => $this->user->id, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])
->subject((string) trans('email.registered_subject_admin'))
;

View File

@@ -42,11 +42,8 @@ class VersionCheckResult extends Notification
{
use Queueable;
private string $message;
public function __construct(string $message)
public function __construct(private string $message)
{
$this->message = $message;
}
/**
@@ -63,7 +60,7 @@ class VersionCheckResult extends Notification
*/
public function toMail(OwnerNotifiable $notifiable): MailMessage
{
return (new MailMessage())
return new MailMessage()
->markdown('emails.new-version', ['message' => $this->message])
->subject((string) trans('email.new_version_email_subject'))
;

View File

@@ -40,11 +40,8 @@ class DisabledMFANotification extends Notification
{
use Queueable;
private User $user;
public function __construct(User $user)
public function __construct(private User $user)
{
$this->user = $user;
}
/**
@@ -67,7 +64,7 @@ class DisabledMFANotification extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())->markdown('emails.security.disabled-mfa', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
return new MailMessage()->markdown('emails.security.disabled-mfa', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
public function toNtfy(User $notifiable): Message

View File

@@ -40,11 +40,8 @@ class EnabledMFANotification extends Notification
{
use Queueable;
private User $user;
public function __construct(User $user)
public function __construct(private User $user)
{
$this->user = $user;
}
/**
@@ -67,7 +64,7 @@ class EnabledMFANotification extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())->markdown('emails.security.enabled-mfa', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
return new MailMessage()->markdown('emails.security.enabled-mfa', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
public function toNtfy(User $notifiable): Message

View File

@@ -40,13 +40,8 @@ class MFABackupFewLeftNotification extends Notification
{
use Queueable;
private int $count;
private User $user;
public function __construct(User $user, int $count)
public function __construct(private User $user, private int $count)
{
$this->user = $user;
$this->count = $count;
}
/**
@@ -69,7 +64,7 @@ class MFABackupFewLeftNotification extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())->markdown('emails.security.few-backup-codes', ['user' => $this->user, 'count' => $this->count, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
return new MailMessage()->markdown('emails.security.few-backup-codes', ['user' => $this->user, 'count' => $this->count, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
public function toNtfy(User $notifiable): Message

View File

@@ -40,11 +40,8 @@ class MFABackupNoLeftNotification extends Notification
{
use Queueable;
private User $user;
public function __construct(User $user)
public function __construct(private User $user)
{
$this->user = $user;
}
/**
@@ -67,7 +64,7 @@ class MFABackupNoLeftNotification extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())->markdown('emails.security.no-backup-codes', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
return new MailMessage()->markdown('emails.security.no-backup-codes', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
public function toNtfy(User $notifiable): Message

View File

@@ -40,13 +40,8 @@ class MFAManyFailedAttemptsNotification extends Notification
{
use Queueable;
private int $count;
private User $user;
public function __construct(User $user, int $count)
public function __construct(private User $user, private int $count)
{
$this->user = $user;
$this->count = $count;
}
public function toArray(User $notifiable): array
@@ -66,7 +61,7 @@ class MFAManyFailedAttemptsNotification extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())->markdown('emails.security.many-failed-attempts', ['user' => $this->user, 'count' => $this->count, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
return new MailMessage()->markdown('emails.security.many-failed-attempts', ['user' => $this->user, 'count' => $this->count, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
public function toNtfy(User $notifiable): Message

View File

@@ -40,11 +40,8 @@ class MFAUsedBackupCodeNotification extends Notification
{
use Queueable;
private User $user;
public function __construct(User $user)
public function __construct(private User $user)
{
$this->user = $user;
}
/**
@@ -67,7 +64,7 @@ class MFAUsedBackupCodeNotification extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())->markdown('emails.security.used-backup-code', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
return new MailMessage()->markdown('emails.security.used-backup-code', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
public function toNtfy(User $notifiable): Message

View File

@@ -40,11 +40,8 @@ class NewBackupCodesNotification extends Notification
{
use Queueable;
private User $user;
public function __construct(User $user)
public function __construct(private User $user)
{
$this->user = $user;
}
/**
@@ -67,7 +64,7 @@ class NewBackupCodesNotification extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())->markdown('emails.security.new-backup-codes', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
return new MailMessage()->markdown('emails.security.new-backup-codes', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
public function toNtfy(User $notifiable): Message

View File

@@ -41,11 +41,8 @@ class UserFailedLoginAttempt extends Notification
{
use Queueable;
private User $user;
public function __construct(User $user)
public function __construct(private User $user)
{
$this->user = $user;
}
public function toArray(User $notifiable): array
@@ -65,7 +62,7 @@ class UserFailedLoginAttempt extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())->markdown('emails.security.failed-login', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
return new MailMessage()->markdown('emails.security.failed-login', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
public function toNtfy(User $notifiable): Message

View File

@@ -53,7 +53,7 @@ class OwnerTestNotificationEmail extends Notification
{
$address = (string) config('firefly.site_owner');
return (new MailMessage())
return new MailMessage()
->markdown('emails.admin-test', ['email' => $address])
->subject((string) trans('email.admin_test_subject'))
;

View File

@@ -50,7 +50,7 @@ class UserTestNotificationEmail extends Notification
{
$address = (string) $notifiable->email;
return (new MailMessage())
return new MailMessage()
->markdown('emails.admin-test', ['email' => $address])
->subject((string) trans('email.admin_test_subject'))
;

View File

@@ -42,15 +42,8 @@ class BillReminder extends Notification
{
use Queueable;
private Bill $bill;
private int $diff;
private string $field;
public function __construct(Bill $bill, string $field, int $diff)
public function __construct(private Bill $bill, private string $field, private int $diff)
{
$this->bill = $bill;
$this->field = $field;
$this->diff = $diff;
}
/**
@@ -67,7 +60,7 @@ class BillReminder extends Notification
*/
public function toMail(User $notifiable): MailMessage
{
return (new MailMessage())
return new MailMessage()
->markdown('emails.bill-warning', ['field' => $this->field, 'diff' => $this->diff, 'bill' => $this->bill])
->subject($this->getSubject())
;

View File

@@ -62,7 +62,7 @@ class NewAccessToken extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())
return new MailMessage()
->markdown('emails.token-created', ['ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])
->subject((string) trans('email.access_token_created_subject'))
;

View File

@@ -36,11 +36,8 @@ class TransactionCreation extends Notification
{
use Queueable;
private array $collection;
public function __construct(array $collection)
public function __construct(private array $collection)
{
$this->collection = $collection;
}
/**
@@ -57,7 +54,7 @@ class TransactionCreation extends Notification
*/
public function toMail(User $notifiable): MailMessage
{
return (new MailMessage())
return new MailMessage()
->markdown('emails.report-new-journals', ['transformed' => $this->collection])
->subject(trans_choice('email.new_journals_subject', count($this->collection)))
;

View File

@@ -59,7 +59,7 @@ class UserLogin extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())
return new MailMessage()
->markdown('emails.new-ip', ['ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])
->subject((string) trans('email.login_from_new_ip'))
;

View File

@@ -43,11 +43,8 @@ class UserNewPassword extends Notification
{
use Queueable;
private string $url;
public function __construct(string $url)
public function __construct(private string $url)
{
$this->url = $url;
}
/**
@@ -69,7 +66,7 @@ class UserNewPassword extends Notification
$userAgent = Request::userAgent();
$time = now(config('app.timezone'))->isoFormat((string) trans('config.date_time_js'));
return (new MailMessage())
return new MailMessage()
->markdown('emails.password', ['url' => $this->url, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])
->subject((string) trans('email.reset_pw_subject'))
;

View File

@@ -52,7 +52,7 @@ class UserRegistration extends Notification
*/
public function toMail(User $notifiable): MailMessage
{
return (new MailMessage())
return new MailMessage()
->markdown('emails.registered', ['address' => route('index')])
->subject((string) trans('email.registered_subject'))
;