diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.php index 0bfaec642b..bbc4fd602f 100644 --- a/app/Http/Controllers/Account/IndexController.php +++ b/app/Http/Controllers/Account/IndexController.php @@ -194,7 +194,7 @@ class IndexController extends Controller return view('accounts.index', compact('objectType', 'inactiveCount', 'subTitleIcon', 'subTitle', 'page', 'accounts')); } - private function subtract(array $startBalances, array $endBalances) + private function subtract(array $startBalances, array $endBalances): array { $result = []; foreach ($endBalances as $key => $value) { diff --git a/app/Http/Controllers/Admin/NotificationController.php b/app/Http/Controllers/Admin/NotificationController.php index 91a9f42c6d..fb16ac7c74 100644 --- a/app/Http/Controllers/Admin/NotificationController.php +++ b/app/Http/Controllers/Admin/NotificationController.php @@ -31,10 +31,11 @@ use FireflyIII\Notifications\Notifiables\OwnerNotifiable; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; +use Illuminate\View\View; class NotificationController extends Controller { - public function index() + public function index(): View { Log::channel('audit')->info('User visits notifications index.'); $title = (string) trans('firefly.administration'); diff --git a/app/Notifications/Admin/UnknownUserLoginAttempt.php b/app/Notifications/Admin/UnknownUserLoginAttempt.php index 6fa01590fe..b19dd53ad6 100644 --- a/app/Notifications/Admin/UnknownUserLoginAttempt.php +++ b/app/Notifications/Admin/UnknownUserLoginAttempt.php @@ -50,7 +50,7 @@ class UnknownUserLoginAttempt extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(OwnerNotifiable $notifiable) + public function toArray(OwnerNotifiable $notifiable): array { return [ ]; @@ -109,7 +109,7 @@ class UnknownUserLoginAttempt extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(OwnerNotifiable $notifiable) + public function via(OwnerNotifiable $notifiable): array { return ReturnsAvailableChannels::returnChannels('owner'); } diff --git a/app/Notifications/Admin/UserInvitation.php b/app/Notifications/Admin/UserInvitation.php index d348f08247..eed76f98a3 100644 --- a/app/Notifications/Admin/UserInvitation.php +++ b/app/Notifications/Admin/UserInvitation.php @@ -55,7 +55,7 @@ class UserInvitation extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(OwnerNotifiable $notifiable) + public function toArray(OwnerNotifiable $notifiable): array { return [ ]; @@ -64,7 +64,7 @@ class UserInvitation extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(OwnerNotifiable $notifiable) + public function toMail(OwnerNotifiable $notifiable): MailMessage { $ip = Request::ip(); $host = Steam::getHostName($ip); @@ -108,7 +108,7 @@ class UserInvitation extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(OwnerNotifiable $notifiable) + public function toSlack(OwnerNotifiable $notifiable): SlackMessage { return new SlackMessage()->content( (string) trans('email.invitation_created_body', ['email' => $this->invitee->user->email, 'invitee' => $this->invitee->email]) @@ -118,7 +118,7 @@ class UserInvitation extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(OwnerNotifiable $notifiable) + public function via(OwnerNotifiable $notifiable): array { return ReturnsAvailableChannels::returnChannels('owner'); } diff --git a/app/Notifications/Admin/UserRegistration.php b/app/Notifications/Admin/UserRegistration.php index 8e896a8fd0..9fbd1ea148 100644 --- a/app/Notifications/Admin/UserRegistration.php +++ b/app/Notifications/Admin/UserRegistration.php @@ -55,7 +55,7 @@ class UserRegistration extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(OwnerNotifiable $notifiable) + public function toArray(OwnerNotifiable $notifiable): array { return [ ]; @@ -64,7 +64,7 @@ class UserRegistration extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(OwnerNotifiable $notifiable) + public function toMail(OwnerNotifiable $notifiable): MailMessage { $ip = Request::ip(); $host = Steam::getHostName($ip); @@ -107,7 +107,7 @@ class UserRegistration extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(OwnerNotifiable $notifiable) + public function toSlack(OwnerNotifiable $notifiable): SlackMessage { return new SlackMessage()->content((string) trans('email.admin_new_user_registered', ['email' => $this->user->email, 'id' => $this->user->id])); } @@ -115,7 +115,7 @@ class UserRegistration extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(OwnerNotifiable $notifiable) + public function via(OwnerNotifiable $notifiable): array { return ReturnsAvailableChannels::returnChannels('owner'); } diff --git a/app/Notifications/Admin/VersionCheckResult.php b/app/Notifications/Admin/VersionCheckResult.php index 3408257e4a..d966313d45 100644 --- a/app/Notifications/Admin/VersionCheckResult.php +++ b/app/Notifications/Admin/VersionCheckResult.php @@ -52,7 +52,7 @@ class VersionCheckResult extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(OwnerNotifiable $notifiable) + public function toArray(OwnerNotifiable $notifiable): array { return [ ]; @@ -61,7 +61,7 @@ class VersionCheckResult extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(OwnerNotifiable $notifiable) + public function toMail(OwnerNotifiable $notifiable): MailMessage { return (new MailMessage()) ->markdown('emails.new-version', ['message' => $this->message]) @@ -99,7 +99,7 @@ class VersionCheckResult extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(OwnerNotifiable $notifiable) + public function toSlack(OwnerNotifiable $notifiable): SlackMessage { return new SlackMessage()->content($this->message) ->attachment(static function ($attachment): void { @@ -111,7 +111,7 @@ class VersionCheckResult extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(OwnerNotifiable $notifiable) + public function via(OwnerNotifiable $notifiable): array { return ReturnsAvailableChannels::returnChannels('owner'); } diff --git a/app/Notifications/Notifiables/OwnerNotifiable.php b/app/Notifications/Notifiables/OwnerNotifiable.php index 300dd427fd..96198c5d39 100644 --- a/app/Notifications/Notifiables/OwnerNotifiable.php +++ b/app/Notifications/Notifiables/OwnerNotifiable.php @@ -55,7 +55,7 @@ class OwnerNotifiable }; } - public function routeNotificationForPushover() + public function routeNotificationForPushover(): PushoverReceiver { Log::debug('Return settings for routeNotificationForPushover'); $pushoverAppToken = (string) app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data; diff --git a/app/Notifications/ReturnsSettings.php b/app/Notifications/ReturnsSettings.php index 40b918d37d..2b8adb162a 100644 --- a/app/Notifications/ReturnsSettings.php +++ b/app/Notifications/ReturnsSettings.php @@ -40,7 +40,7 @@ class ReturnsSettings throw new FireflyException(sprintf('Cannot handle channel "%s"', $channel)); } - private static function getNtfySettings(string $type, ?User $user) + private static function getNtfySettings(string $type, ?User $user): array { $settings = [ 'ntfy_server' => 'https://ntfy.sh', diff --git a/app/Notifications/Security/DisabledMFANotification.php b/app/Notifications/Security/DisabledMFANotification.php index f5b7af8c63..991d98d7e8 100644 --- a/app/Notifications/Security/DisabledMFANotification.php +++ b/app/Notifications/Security/DisabledMFANotification.php @@ -50,7 +50,7 @@ class DisabledMFANotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -59,7 +59,7 @@ class DisabledMFANotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $subject = (string) trans('email.disabled_mfa_subject'); $ip = Request::ip(); @@ -94,7 +94,7 @@ class DisabledMFANotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $message = (string) trans('email.disabled_mfa_slack', ['email' => $this->user->email]); @@ -104,7 +104,7 @@ class DisabledMFANotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/Security/EnabledMFANotification.php b/app/Notifications/Security/EnabledMFANotification.php index 3074c89121..dea2facf36 100644 --- a/app/Notifications/Security/EnabledMFANotification.php +++ b/app/Notifications/Security/EnabledMFANotification.php @@ -50,7 +50,7 @@ class EnabledMFANotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -59,7 +59,7 @@ class EnabledMFANotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $subject = (string) trans('email.enabled_mfa_subject'); $ip = Request::ip(); @@ -94,7 +94,7 @@ class EnabledMFANotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $message = (string) trans('email.enabled_mfa_slack', ['email' => $this->user->email]); @@ -104,7 +104,7 @@ class EnabledMFANotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/Security/MFABackupFewLeftNotification.php b/app/Notifications/Security/MFABackupFewLeftNotification.php index 99f75b861c..da683b1f4e 100644 --- a/app/Notifications/Security/MFABackupFewLeftNotification.php +++ b/app/Notifications/Security/MFABackupFewLeftNotification.php @@ -52,7 +52,7 @@ class MFABackupFewLeftNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -61,7 +61,7 @@ class MFABackupFewLeftNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $subject = (string) trans('email.mfa_few_backups_left_subject', ['count' => $this->count]); $ip = Request::ip(); @@ -96,7 +96,7 @@ class MFABackupFewLeftNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $message = (string) trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email, 'count' => $this->count]); @@ -106,7 +106,7 @@ class MFABackupFewLeftNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/Security/MFABackupNoLeftNotification.php b/app/Notifications/Security/MFABackupNoLeftNotification.php index bcbd8d0cfb..5bea9e6aa2 100644 --- a/app/Notifications/Security/MFABackupNoLeftNotification.php +++ b/app/Notifications/Security/MFABackupNoLeftNotification.php @@ -50,7 +50,7 @@ class MFABackupNoLeftNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -59,7 +59,7 @@ class MFABackupNoLeftNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $subject = (string) trans('email.mfa_no_backups_left_subject'); $ip = Request::ip(); @@ -94,7 +94,7 @@ class MFABackupNoLeftNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $message = (string) trans('email.mfa_no_backups_left_slack', ['email' => $this->user->email]); @@ -104,7 +104,7 @@ class MFABackupNoLeftNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/Security/MFAManyFailedAttemptsNotification.php b/app/Notifications/Security/MFAManyFailedAttemptsNotification.php index 17638358c7..781bf62e95 100644 --- a/app/Notifications/Security/MFAManyFailedAttemptsNotification.php +++ b/app/Notifications/Security/MFAManyFailedAttemptsNotification.php @@ -49,7 +49,7 @@ class MFAManyFailedAttemptsNotification extends Notification $this->count = $count; } - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -58,7 +58,7 @@ class MFAManyFailedAttemptsNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $subject = (string) trans('email.mfa_many_failed_subject', ['count' => $this->count]); $ip = Request::ip(); @@ -93,7 +93,7 @@ class MFAManyFailedAttemptsNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $message = (string) trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]); @@ -103,7 +103,7 @@ class MFAManyFailedAttemptsNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/Security/MFAUsedBackupCodeNotification.php b/app/Notifications/Security/MFAUsedBackupCodeNotification.php index 5eba3c43c8..0b03853275 100644 --- a/app/Notifications/Security/MFAUsedBackupCodeNotification.php +++ b/app/Notifications/Security/MFAUsedBackupCodeNotification.php @@ -50,7 +50,7 @@ class MFAUsedBackupCodeNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -59,7 +59,7 @@ class MFAUsedBackupCodeNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $subject = (string) trans('email.used_backup_code_subject'); $ip = Request::ip(); @@ -94,7 +94,7 @@ class MFAUsedBackupCodeNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $message = (string) trans('email.used_backup_code_slack', ['email' => $this->user->email]); @@ -104,7 +104,7 @@ class MFAUsedBackupCodeNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/Security/NewBackupCodesNotification.php b/app/Notifications/Security/NewBackupCodesNotification.php index 1251c6cf88..06ef35f89e 100644 --- a/app/Notifications/Security/NewBackupCodesNotification.php +++ b/app/Notifications/Security/NewBackupCodesNotification.php @@ -50,7 +50,7 @@ class NewBackupCodesNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -59,7 +59,7 @@ class NewBackupCodesNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $subject = (string) trans('email.new_backup_codes_subject'); $ip = Request::ip(); @@ -94,7 +94,7 @@ class NewBackupCodesNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $message = (string) trans('email.new_backup_codes_slack', ['email' => $this->user->email]); @@ -104,7 +104,7 @@ class NewBackupCodesNotification extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/Security/UserFailedLoginAttempt.php b/app/Notifications/Security/UserFailedLoginAttempt.php index 7ed59f4127..69bb04110c 100644 --- a/app/Notifications/Security/UserFailedLoginAttempt.php +++ b/app/Notifications/Security/UserFailedLoginAttempt.php @@ -47,7 +47,7 @@ class UserFailedLoginAttempt extends Notification $this->user = $user; } - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -56,7 +56,7 @@ class UserFailedLoginAttempt extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $subject = (string) trans('email.failed_login_subject'); $ip = Request::ip(); @@ -91,7 +91,7 @@ class UserFailedLoginAttempt extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $message = (string) trans('email.failed_login_message', ['email' => $this->user->email]); @@ -101,7 +101,7 @@ class UserFailedLoginAttempt extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/Test/OwnerTestNotificationEmail.php b/app/Notifications/Test/OwnerTestNotificationEmail.php index c1fd32a779..57df79296d 100644 --- a/app/Notifications/Test/OwnerTestNotificationEmail.php +++ b/app/Notifications/Test/OwnerTestNotificationEmail.php @@ -39,7 +39,7 @@ class OwnerTestNotificationEmail extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(OwnerNotifiable $notifiable) + public function toArray(OwnerNotifiable $notifiable): array { return [ ]; @@ -48,7 +48,7 @@ class OwnerTestNotificationEmail extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(OwnerNotifiable $notifiable) + public function toMail(OwnerNotifiable $notifiable): MailMessage { $address = (string) config('firefly.site_owner'); @@ -61,7 +61,7 @@ class OwnerTestNotificationEmail extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(OwnerNotifiable $notifiable) + public function via(OwnerNotifiable $notifiable): array { return ['mail']; } diff --git a/app/Notifications/Test/OwnerTestNotificationNtfy.php b/app/Notifications/Test/OwnerTestNotificationNtfy.php index 53a82e5376..9f72e8544b 100644 --- a/app/Notifications/Test/OwnerTestNotificationNtfy.php +++ b/app/Notifications/Test/OwnerTestNotificationNtfy.php @@ -42,10 +42,8 @@ class OwnerTestNotificationNtfy extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") - * - * @param mixed $notifiable */ - public function toArray($notifiable) + public function toArray(OwnerNotifiable $notifiable): array { return [ ]; @@ -69,7 +67,7 @@ class OwnerTestNotificationNtfy extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(OwnerNotifiable $notifiable) + public function via(OwnerNotifiable $notifiable): array { return [NtfyChannel::class]; } diff --git a/app/Notifications/Test/OwnerTestNotificationPushover.php b/app/Notifications/Test/OwnerTestNotificationPushover.php index 4c19060e5c..0e2c444f01 100644 --- a/app/Notifications/Test/OwnerTestNotificationPushover.php +++ b/app/Notifications/Test/OwnerTestNotificationPushover.php @@ -43,7 +43,7 @@ class OwnerTestNotificationPushover extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(OwnerNotifiable $notifiable) + public function toArray(OwnerNotifiable $notifiable): array { return [ ]; @@ -64,7 +64,7 @@ class OwnerTestNotificationPushover extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(OwnerNotifiable $notifiable) + public function via(OwnerNotifiable $notifiable): array { return [PushoverChannel::class]; } diff --git a/app/Notifications/Test/OwnerTestNotificationSlack.php b/app/Notifications/Test/OwnerTestNotificationSlack.php index f243ce460f..7a0a6e40de 100644 --- a/app/Notifications/Test/OwnerTestNotificationSlack.php +++ b/app/Notifications/Test/OwnerTestNotificationSlack.php @@ -41,7 +41,7 @@ class OwnerTestNotificationSlack extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(OwnerNotifiable $notifiable) + public function toArray(OwnerNotifiable $notifiable): array { return [ ]; @@ -50,7 +50,7 @@ class OwnerTestNotificationSlack extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(OwnerNotifiable $notifiable) + public function toSlack(OwnerNotifiable $notifiable): SlackMessage { return new SlackMessage()->content((string) trans('email.admin_test_subject')); // return new SlackMessage()->text((string) trans('email.admin_test_subject'))->to($url); @@ -59,7 +59,7 @@ class OwnerTestNotificationSlack extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(OwnerNotifiable $notifiable) + public function via(OwnerNotifiable $notifiable): array { return ['slack']; } diff --git a/app/Notifications/Test/UserTestNotificationEmail.php b/app/Notifications/Test/UserTestNotificationEmail.php index aeefc9a061..07f5b42e73 100644 --- a/app/Notifications/Test/UserTestNotificationEmail.php +++ b/app/Notifications/Test/UserTestNotificationEmail.php @@ -39,13 +39,13 @@ class UserTestNotificationEmail extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; } - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $address = (string) $notifiable->email; @@ -58,7 +58,7 @@ class UserTestNotificationEmail extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ['mail']; } diff --git a/app/Notifications/Test/UserTestNotificationNtfy.php b/app/Notifications/Test/UserTestNotificationNtfy.php index b5bbf8bbea..babcb459f8 100644 --- a/app/Notifications/Test/UserTestNotificationNtfy.php +++ b/app/Notifications/Test/UserTestNotificationNtfy.php @@ -43,7 +43,7 @@ class UserTestNotificationNtfy extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -67,7 +67,7 @@ class UserTestNotificationNtfy extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $user) + public function via(User $user): array { return [NtfyChannel::class]; } diff --git a/app/Notifications/Test/UserTestNotificationPushover.php b/app/Notifications/Test/UserTestNotificationPushover.php index 05e1901820..e963b4bca9 100644 --- a/app/Notifications/Test/UserTestNotificationPushover.php +++ b/app/Notifications/Test/UserTestNotificationPushover.php @@ -43,7 +43,7 @@ class UserTestNotificationPushover extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -64,7 +64,7 @@ class UserTestNotificationPushover extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return [PushoverChannel::class]; } diff --git a/app/Notifications/Test/UserTestNotificationSlack.php b/app/Notifications/Test/UserTestNotificationSlack.php index 35febbb0d2..59cedc0b4c 100644 --- a/app/Notifications/Test/UserTestNotificationSlack.php +++ b/app/Notifications/Test/UserTestNotificationSlack.php @@ -41,7 +41,7 @@ class UserTestNotificationSlack extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $user) + public function toArray(User $user): array { return [ ]; @@ -50,7 +50,7 @@ class UserTestNotificationSlack extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $user) + public function toSlack(User $user): SlackMessage { return new SlackMessage()->content((string) trans('email.admin_test_subject')); // return new SlackMessage()->text((string) trans('email.admin_test_subject'))->to($url); @@ -59,7 +59,7 @@ class UserTestNotificationSlack extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $user) + public function via(User $user): array { return ['slack']; } diff --git a/app/Notifications/User/BillReminder.php b/app/Notifications/User/BillReminder.php index eadde2d75c..77de530d55 100644 --- a/app/Notifications/User/BillReminder.php +++ b/app/Notifications/User/BillReminder.php @@ -56,7 +56,7 @@ class BillReminder extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -65,7 +65,7 @@ class BillReminder extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { return (new MailMessage()) ->markdown('emails.bill-warning', ['field' => $this->field, 'diff' => $this->diff, 'bill' => $this->bill]) @@ -107,7 +107,7 @@ class BillReminder extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $bill = $this->bill; $url = route('bills.show', [$bill->id]); @@ -124,7 +124,7 @@ class BillReminder extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/User/NewAccessToken.php b/app/Notifications/User/NewAccessToken.php index 9e659ac40d..1634638caa 100644 --- a/app/Notifications/User/NewAccessToken.php +++ b/app/Notifications/User/NewAccessToken.php @@ -45,7 +45,7 @@ class NewAccessToken extends Notification public function __construct() {} - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -54,7 +54,7 @@ class NewAccessToken extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $ip = Request::ip(); $host = Steam::getHostName($ip); @@ -91,7 +91,7 @@ class NewAccessToken extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { return new SlackMessage()->content((string) trans('email.access_token_created_body')); } @@ -99,7 +99,7 @@ class NewAccessToken extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/User/RuleActionFailed.php b/app/Notifications/User/RuleActionFailed.php index b9f3ed9f05..9a518edb2e 100644 --- a/app/Notifications/User/RuleActionFailed.php +++ b/app/Notifications/User/RuleActionFailed.php @@ -59,7 +59,7 @@ class RuleActionFailed extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -86,7 +86,7 @@ class RuleActionFailed extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $groupTitle = $this->groupTitle; $groupLink = $this->groupLink; @@ -103,7 +103,7 @@ class RuleActionFailed extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { $channels = ReturnsAvailableChannels::returnChannels('user', $notifiable); if (($key = array_search('mail', $channels, true)) !== false) { diff --git a/app/Notifications/User/TransactionCreation.php b/app/Notifications/User/TransactionCreation.php index 82a5606e86..bca7218b62 100644 --- a/app/Notifications/User/TransactionCreation.php +++ b/app/Notifications/User/TransactionCreation.php @@ -46,7 +46,7 @@ class TransactionCreation extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -55,7 +55,7 @@ class TransactionCreation extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { return (new MailMessage()) ->markdown('emails.report-new-journals', ['transformed' => $this->collection]) @@ -66,7 +66,7 @@ class TransactionCreation extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ['mail']; } diff --git a/app/Notifications/User/UserLogin.php b/app/Notifications/User/UserLogin.php index 3cadefb41c..c142c1ea69 100644 --- a/app/Notifications/User/UserLogin.php +++ b/app/Notifications/User/UserLogin.php @@ -43,7 +43,7 @@ class UserLogin extends Notification { use Queueable; - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -52,7 +52,7 @@ class UserLogin extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $ip = Request::ip(); $host = Steam::getHostName($ip); @@ -94,7 +94,7 @@ class UserLogin extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { $ip = Request::ip(); $host = Steam::getHostName($ip); @@ -105,7 +105,7 @@ class UserLogin extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Notifications/User/UserNewPassword.php b/app/Notifications/User/UserNewPassword.php index 372e8c0df3..d69e4abd8e 100644 --- a/app/Notifications/User/UserNewPassword.php +++ b/app/Notifications/User/UserNewPassword.php @@ -53,7 +53,7 @@ class UserNewPassword extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toArray(User $notifiable) + public function toArray(User $notifiable): array { return [ ]; @@ -62,7 +62,7 @@ class UserNewPassword extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toMail(User $notifiable) + public function toMail(User $notifiable): MailMessage { $ip = Request::ip(); $host = Steam::getHostName($ip); @@ -96,12 +96,12 @@ class UserNewPassword extends Notification /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function toSlack(User $notifiable) + public function toSlack(User $notifiable): SlackMessage { return new SlackMessage()->content((string) trans('email.reset_pw_message')); } - public function via(User $notifiable) + public function via(User $notifiable): array { return ReturnsAvailableChannels::returnChannels('user', $notifiable); } diff --git a/app/Support/Models/BillDateCalculator.php b/app/Support/Models/BillDateCalculator.php index 038f2b0364..f8b5e9f376 100644 --- a/app/Support/Models/BillDateCalculator.php +++ b/app/Support/Models/BillDateCalculator.php @@ -117,7 +117,7 @@ class BillDateCalculator } } Log::debug('end of loop'); - $simple = $set->map( + $simple = $set->map( // @phpstan-ignore-line static function (Carbon $date) { return $date->format('Y-m-d'); } diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php index d627b00afd..2e5b10ef9d 100644 --- a/app/Support/Preferences.php +++ b/app/Support/Preferences.php @@ -195,7 +195,7 @@ class Preferences return $result; } - public function getEncrypted(string $name, $default = null): ?Preference + public function getEncrypted(string $name, mixed $default = null): ?Preference { $result = $this->get($name, $default); if (null === $result) { diff --git a/app/Transformers/V2/BillTransformer.php b/app/Transformers/V2/BillTransformer.php index e52d17d38d..04041785f6 100644 --- a/app/Transformers/V2/BillTransformer.php +++ b/app/Transformers/V2/BillTransformer.php @@ -326,7 +326,7 @@ class BillTransformer extends AbstractTransformer break; } } - $simple = $set->map( + $simple = $set->map( // @phpstan-ignore-line static function (Carbon $date) { return $date->toAtomString(); } diff --git a/app/User.php b/app/User.php index 60dccbce9b..51d27e3b6f 100644 --- a/app/User.php +++ b/app/User.php @@ -400,7 +400,7 @@ class User extends Authenticatable return $this->belongsToMany(Role::class); } - public function routeNotificationForPushover() + public function routeNotificationForPushover(): PushoverReceiver { $appToken = (string) app('preferences')->getEncrypted('pushover_app_token', '')->data; $userToken = (string) app('preferences')->getEncrypted('pushover_user_token', '')->data; diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index ffe70c6ea4..2dc360a134 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -100,12 +100,9 @@ class FireflyValidator extends Validator } /** - * @param mixed $attribute - * @param mixed $value - * * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ - public function validateBic($attribute, $value): bool + public function validateBic(mixed $attribute,mixed $value): bool { $regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i'; $result = preg_match($regex, $value); @@ -116,7 +113,7 @@ class FireflyValidator extends Validator return true; } - public function validateExistingMfaCode($attribute, $value): bool + public function validateExistingMfaCode(mixed $attribute, mixed $value): bool { if (!is_string($value) || 6 !== strlen($value)) { return false;