From 1c3cb85a46db7a4a31e630e9179d59a360d6868b Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 28 Nov 2023 18:57:10 +0100 Subject: [PATCH] Fix a bunch of phpstan issues. --- .../Model/BudgetLimit/ListController.php | 3 +- .../Model/PiggyBank/IndexController.php | 4 +- .../Controllers/Summary/BasicController.php | 1 + .../UserGroup/DestroyController.php | 3 +- .../Controllers/UserGroup/ShowController.php | 7 +- .../Autocomplete/AutocompleteRequest.php | 2 - .../Commands/System/CreateDatabase.php | 1 - .../Commands/Upgrade/AccountCurrencies.php | 6 +- .../Upgrade/UpgradeLiabilitiesEight.php | 37 ++++---- app/Factory/TransactionFactory.php | 3 +- app/Handlers/Events/UserEventHandler.php | 24 +++-- app/Helpers/Attachments/AttachmentHelper.php | 11 ++- .../Extensions/AttachmentCollection.php | 95 ++++++++++++------- .../Collector/Extensions/MetaCollection.php | 42 ++++---- .../Collector/Extensions/TimeCollection.php | 32 +++---- app/Helpers/Collector/GroupCollector.php | 6 +- app/Helpers/Fiscal/FiscalHelper.php | 4 +- app/Http/Controllers/Admin/HomeController.php | 4 +- app/Http/Controllers/AttachmentController.php | 3 +- app/Http/Controllers/Auth/LoginController.php | 2 +- app/Notifications/Admin/TestNotification.php | 4 + app/Notifications/Admin/UserInvitation.php | 4 + app/Notifications/Admin/UserRegistration.php | 4 + .../Admin/VersionCheckResult.php | 4 + app/Notifications/User/BillReminder.php | 6 +- app/Notifications/User/NewAccessToken.php | 4 + app/Notifications/User/RuleActionFailed.php | 3 + .../User/TransactionCreation.php | 3 + app/Notifications/User/UserLogin.php | 6 +- app/Notifications/User/UserNewPassword.php | 3 + app/Notifications/User/UserRegistration.php | 3 + 31 files changed, 197 insertions(+), 137 deletions(-) diff --git a/app/Api/V2/Controllers/Model/BudgetLimit/ListController.php b/app/Api/V2/Controllers/Model/BudgetLimit/ListController.php index 65c6fefc6d..5db8991f36 100644 --- a/app/Api/V2/Controllers/Model/BudgetLimit/ListController.php +++ b/app/Api/V2/Controllers/Model/BudgetLimit/ListController.php @@ -51,8 +51,9 @@ class ListController extends Controller /** * This endpoint is documented at: * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v2)#/budgets/listBudgetLimitByBudget + * // DateRequest $request, Budget $budget */ - public function index(DateRequest $request, Budget $budget): JsonResponse + public function index(): JsonResponse { return response()->json([]); // throw new FireflyException('Needs refactoring, move to IndexController.'); diff --git a/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php b/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php index 6627b99cd2..0133b440e2 100644 --- a/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php +++ b/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php @@ -60,13 +60,11 @@ class IndexController extends Controller } /** - * @param Request $request - * * TODO see autocomplete/accountcontroller for list. * * @return JsonResponse */ - public function index(Request $request): JsonResponse + public function index(): JsonResponse { $piggies = $this->repository->getPiggyBanks(); $pageSize = $this->parameters->get('limit'); diff --git a/app/Api/V2/Controllers/Summary/BasicController.php b/app/Api/V2/Controllers/Summary/BasicController.php index d5fc39c078..5b3b317447 100644 --- a/app/Api/V2/Controllers/Summary/BasicController.php +++ b/app/Api/V2/Controllers/Summary/BasicController.php @@ -100,6 +100,7 @@ class BasicController extends Controller * * @return JsonResponse * @throws Exception + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function basic(DateRequest $request): JsonResponse { diff --git a/app/Api/V2/Controllers/UserGroup/DestroyController.php b/app/Api/V2/Controllers/UserGroup/DestroyController.php index 123b9eded6..9c47d8be0c 100644 --- a/app/Api/V2/Controllers/UserGroup/DestroyController.php +++ b/app/Api/V2/Controllers/UserGroup/DestroyController.php @@ -57,12 +57,11 @@ class DestroyController extends Controller } /** - * @param Request $request * @param UserGroup $userGroup * * @return JsonResponse */ - public function destroy(Request $request, UserGroup $userGroup): JsonResponse + public function destroy(UserGroup $userGroup): JsonResponse { /** @var User $user */ $user = auth()->user(); diff --git a/app/Api/V2/Controllers/UserGroup/ShowController.php b/app/Api/V2/Controllers/UserGroup/ShowController.php index fbc441427e..c4f75d9365 100644 --- a/app/Api/V2/Controllers/UserGroup/ShowController.php +++ b/app/Api/V2/Controllers/UserGroup/ShowController.php @@ -57,11 +57,9 @@ class ShowController extends Controller } /** - * @param Request $request - * * @return JsonResponse */ - public function index(Request $request): JsonResponse + public function index(): JsonResponse { $collection = new Collection(); $pageSize = $this->parameters->get('limit'); @@ -85,12 +83,11 @@ class ShowController extends Controller } /** - * @param Request $request * @param UserGroup $userGroup * * @return JsonResponse */ - public function show(Request $request, UserGroup $userGroup): JsonResponse + public function show(UserGroup $userGroup): JsonResponse { $transformer = new UserGroupTransformer(); $transformer->setParameters($this->parameters); diff --git a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php index fbe991dc49..844c596e9c 100644 --- a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php +++ b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php @@ -55,8 +55,6 @@ class AutocompleteRequest extends FormRequest // remove 'initial balance' and another from allowed types. its internal $array = array_diff($array, [AccountType::INITIAL_BALANCE, AccountType::RECONCILIATION]); - /** @var User $user */ - $user = auth()->user(); return [ 'types' => $array, diff --git a/app/Console/Commands/System/CreateDatabase.php b/app/Console/Commands/System/CreateDatabase.php index 9d1142d7de..722e1ef885 100644 --- a/app/Console/Commands/System/CreateDatabase.php +++ b/app/Console/Commands/System/CreateDatabase.php @@ -55,7 +55,6 @@ class CreateDatabase extends Command } // try to set up a raw connection: $exists = false; - $checked = false; // checked for existence of DB? $dsn = sprintf('mysql:host=%s;port=%d;charset=utf8mb4', env('DB_HOST', 'localhost'), env('DB_PORT', '3306')); if ('' !== env('DB_SOCKET', '')) { diff --git a/app/Console/Commands/Upgrade/AccountCurrencies.php b/app/Console/Commands/Upgrade/AccountCurrencies.php index 0a05dbf1d5..cee07fc994 100644 --- a/app/Console/Commands/Upgrade/AccountCurrencies.php +++ b/app/Console/Commands/Upgrade/AccountCurrencies.php @@ -110,19 +110,17 @@ class AccountCurrencies extends Command private function updateAccountCurrencies(): void { $users = $this->userRepos->all(); - $defaultCurrencyCode = (string)config('firefly.default_currency', 'EUR'); foreach ($users as $user) { - $this->updateCurrenciesForUser($user, $defaultCurrencyCode); + $this->updateCurrenciesForUser($user); } } /** * @param User $user - * @param string $systemCurrencyCode * * @throws FireflyException */ - private function updateCurrenciesForUser(User $user, string $systemCurrencyCode): void + private function updateCurrenciesForUser(User $user): void { $this->accountRepos->setUser($user); $accounts = $this->accountRepos->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php index 487e5fa770..ff888d3646 100644 --- a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php +++ b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php @@ -26,7 +26,6 @@ namespace FireflyIII\Console\Commands\Upgrade; use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Models\Account; -use FireflyIII\Models\AccountType; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; @@ -230,24 +229,26 @@ class UpgradeLiabilitiesEight extends Command ->where('transactions.account_id', $account->id)->get(['transaction_journals.*']); /** @var TransactionJournal $journal */ foreach ($journals as $journal) { - $delete = false; - /** @var Transaction $source */ - $source = $journal->transactions()->where('amount', '<', 0)->first(); - /** @var Transaction $dest */ - $dest = $journal->transactions()->where('amount', '>', 0)->first(); +// $delete = false; +// /** @var Transaction $source */ +// $source = $journal->transactions()->where('amount', '<', 0)->first(); +// /** @var Transaction $dest */ +// $dest = $journal->transactions()->where('amount', '>', 0)->first(); - // if source is this liability and destination is expense, remove transaction. - // if source is revenue and destination is liability, remove transaction. - if ($source->account_id === $account->id && $dest->account->accountType->type === AccountType::EXPENSE) { - $delete = true; - } - if ($dest->account_id === $account->id && $source->account->accountType->type === AccountType::REVENUE) { - $delete = true; - } - - // overruled. No transaction will be deleted, ever. - // code is kept in place so I can revisit my reasoning. - $delete = false; + /** + * // if source is this liability and destination is expense, remove transaction. + * // if source is revenue and destination is liability, remove transaction. + * if ($source->account_id === $account->id && $dest->account->accountType->type === AccountType::EXPENSE) { + * $delete = true; + * } + * if ($dest->account_id === $account->id && $source->account->accountType->type === AccountType::REVENUE) { + * $delete = true; + * } + * + * // overruled. No transaction will be deleted, ever. + * // code is kept in place, so I can revisit my reasoning. + * $delete = false; + */ // if ($delete) { $service = app(TransactionGroupDestroyService::class); diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.php index eeb5cf830a..a5f8835984 100644 --- a/app/Factory/TransactionFactory.php +++ b/app/Factory/TransactionFactory.php @@ -254,8 +254,7 @@ class TransactionFactory /** * @param User $user - * - + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function setUser(User $user): void { diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index 6001e1f8b3..70e9698f88 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -45,7 +45,6 @@ use FireflyIII\Notifications\User\UserLogin; use FireflyIII\Notifications\User\UserNewPassword; use FireflyIII\Notifications\User\UserRegistration as UserRegistrationNotification; use FireflyIII\Repositories\User\UserRepositoryInterface; -use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\User; use Illuminate\Auth\Events\Login; use Illuminate\Support\Facades\Notification; @@ -109,6 +108,7 @@ class UserEventHandler /** * @param RegisteredUser $event + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function createExchangeRates(RegisteredUser $event): void { @@ -131,7 +131,8 @@ class UserEventHandler $group = null; // create a new group. - while (true === $groupExists) { /** @phpstan-ignore-line */ + while (true === $groupExists) { + /** @phpstan-ignore-line */ $groupExists = UserGroup::where('title', $groupTitle)->count() > 0; if (false === $groupExists) { $group = UserGroup::create(['title' => $groupTitle]); @@ -189,7 +190,6 @@ class UserEventHandler public function notifyNewIPAddress(DetectedNewIPAddress $event): void { $user = $event->user; - $email = $user->email; $ipAddress = $event->ipAddress; if ($user->hasRole('demo')) { @@ -197,7 +197,7 @@ class UserEventHandler } $list = app('preferences')->getForUser($user, 'login_ip_history', [])->data; - if(!is_array($list)) { + if (!is_array($list)) { $list = []; } @@ -206,7 +206,8 @@ class UserEventHandler if (false === $entry['notified']) { try { Notification::send($user, new UserLogin($ipAddress)); - } catch (Exception $e) { /** @phpstan-ignore-line */ + } catch (Exception $e) { + /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -231,7 +232,7 @@ class UserEventHandler */ public function sendAdminRegistrationNotification(RegisteredUser $event): void { - $sendMail = (bool) app('fireflyconfig')->get('notification_admin_new_reg', true)->data; + $sendMail = (bool)app('fireflyconfig')->get('notification_admin_new_reg', true)->data; if ($sendMail) { /** @var UserRepositoryInterface $repository */ $repository = app(UserRepositoryInterface::class); @@ -240,7 +241,8 @@ class UserEventHandler if ($repository->hasRole($user, 'owner')) { try { Notification::send($user, new AdminRegistrationNotification($event->user)); - } catch (Exception $e) { /** @phpstan-ignore-line */ + } catch (Exception $e) { + /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -317,7 +319,8 @@ class UserEventHandler { try { Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token]))); - } catch (Exception $e) { /** @phpstan-ignore-line */ + } catch (Exception $e) { + /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -361,11 +364,12 @@ class UserEventHandler */ public function sendRegistrationMail(RegisteredUser $event): void { - $sendMail = (bool) app('fireflyconfig')->get('notification_user_new_reg', true)->data; + $sendMail = (bool)app('fireflyconfig')->get('notification_user_new_reg', true)->data; if ($sendMail) { try { Notification::send($event->user, new UserRegistrationNotification()); - } catch (Exception $e) { /** @phpstan-ignore-line */ + } catch (Exception $e) { + /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index b828c1e886..380e437666 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -36,6 +36,7 @@ use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; use Illuminate\Support\MessageBag; use Symfony\Component\HttpFoundation\File\UploadedFile; +use const DIRECTORY_SEPARATOR; /** * Class AttachmentHelper. @@ -95,7 +96,7 @@ class AttachmentHelper implements AttachmentHelperInterface */ public function getAttachmentLocation(Attachment $attachment): string { - return sprintf('%sat-%d.data', \DIRECTORY_SEPARATOR, $attachment->id); + return sprintf('%sat-%d.data', DIRECTORY_SEPARATOR, $attachment->id); } /** @@ -166,7 +167,7 @@ class AttachmentHelper implements AttachmentHelperInterface fclose($resource); return false; } - $mime = (string) finfo_file($finfo, $path); + $mime = (string)finfo_file($finfo, $path); $allowedMime = config('firefly.allowedMimes'); if (!in_array($mime, $allowedMime, true)) { Log::error(sprintf('Mime type %s is not allowed for API file upload.', $mime)); @@ -182,7 +183,7 @@ class AttachmentHelper implements AttachmentHelperInterface $this->uploadDisk->put($file, $content); // update attachment. - $attachment->md5 = (string) md5_file($path); + $attachment->md5 = (string)md5_file($path); $attachment->mime = $mime; $attachment->size = strlen($content); $attachment->uploaded = true; @@ -251,7 +252,7 @@ class AttachmentHelper implements AttachmentHelperInterface $attachment = new Attachment(); // create Attachment object. $attachment->user()->associate($user); $attachment->attachable()->associate($model); - $attachment->md5 = (string) md5_file($file->getRealPath()); + $attachment->md5 = (string)md5_file($file->getRealPath()); $attachment->filename = $file->getClientOriginalName(); $attachment->mime = $file->getMimeType(); $attachment->size = $file->getSize(); @@ -266,7 +267,7 @@ class AttachmentHelper implements AttachmentHelperInterface throw new FireflyException('Cannot upload empty or non-existent file.'); } - $content = (string) $fileObject->fread($file->getSize()); + $content = (string)$fileObject->fread($file->getSize()); Log::debug(sprintf('Full file length is %d and upload size is %d.', strlen($content), $file->getSize())); // store it without encryption. diff --git a/app/Helpers/Collector/Extensions/AttachmentCollection.php b/app/Helpers/Collector/Extensions/AttachmentCollection.php index 6de6510044..1f9e84894c 100644 --- a/app/Helpers/Collector/Extensions/AttachmentCollection.php +++ b/app/Helpers/Collector/Extensions/AttachmentCollection.php @@ -44,15 +44,21 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($name): bool { + /** + * @param int $index + * @param array $object + * + * @return bool + */ + $filter = static function (array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ foreach ($transaction['attachments'] as $attachment) { $result = str_contains(strtolower($attachment['filename']), strtolower($name)) || str_contains( - strtolower($attachment['title']), - strtolower($name) - ); + strtolower($attachment['title']), + strtolower($name) + ); if (true === $result) { return true; } @@ -123,15 +129,22 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($name): bool { + /** + * @param int $index + * @param array $object + * + * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + $filter = static function (array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ foreach ($transaction['attachments'] as $attachment) { $result = !str_contains(strtolower($attachment['filename']), strtolower($name)) && !str_contains( - strtolower($attachment['title']), - strtolower($name) - ); + strtolower($attachment['title']), + strtolower($name) + ); if (true === $result) { return true; } @@ -153,15 +166,22 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($name): bool { + /** + * @param int $index + * @param array $object + * + * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + $filter = static function (array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ foreach ($transaction['attachments'] as $attachment) { $result = !str_ends_with(strtolower($attachment['filename']), strtolower($name)) && !str_ends_with( - strtolower($attachment['title']), - strtolower($name) - ); + strtolower($attachment['title']), + strtolower($name) + ); if (true === $result) { return true; } @@ -183,15 +203,22 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($name): bool { + /** + * @param int $index + * @param array $object + * + * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + $filter = static function (array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ foreach ($transaction['attachments'] as $attachment) { $result = !str_starts_with(strtolower($attachment['filename']), strtolower($name)) && !str_starts_with( - strtolower($attachment['title']), - strtolower($name) - ); + strtolower($attachment['title']), + strtolower($name) + ); if (true === $result) { return true; } @@ -213,15 +240,15 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($name): bool { + $filter = static function (array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ foreach ($transaction['attachments'] as $attachment) { $result = str_ends_with(strtolower($attachment['filename']), strtolower($name)) || str_ends_with( - strtolower($attachment['title']), - strtolower($name) - ); + strtolower($attachment['title']), + strtolower($name) + ); if (true === $result) { return true; } @@ -243,7 +270,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($name): bool { + $filter = static function (array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -270,7 +297,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($name): bool { + $filter = static function (array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -297,15 +324,15 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($name): bool { + $filter = static function (array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ foreach ($transaction['attachments'] as $attachment) { $result = str_starts_with(strtolower($attachment['filename']), strtolower($name)) || str_starts_with( - strtolower($attachment['title']), - strtolower($name) - ); + strtolower($attachment['title']), + strtolower($name) + ); if (true === $result) { return true; } @@ -327,7 +354,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($value): bool { + $filter = static function (array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -354,7 +381,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($value): bool { + $filter = static function (array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -381,7 +408,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($value): bool { + $filter = static function (array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -408,7 +435,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($value): bool { + $filter = static function (array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -435,7 +462,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($value): bool { + $filter = static function (array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -462,7 +489,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($value): bool { + $filter = static function (array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -489,7 +516,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($value): bool { + $filter = static function (array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -516,7 +543,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = static function (int $index, array $object) use ($value): bool { + $filter = static function (array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php index 636e98a522..334260173b 100644 --- a/app/Helpers/Collector/Extensions/MetaCollection.php +++ b/app/Helpers/Collector/Extensions/MetaCollection.php @@ -226,7 +226,7 @@ trait MetaCollection */ public function excludeInternalReference(string $internalReference): GroupCollectorInterface { - $internalReference = (string) json_encode($internalReference); + $internalReference = (string)json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -253,7 +253,7 @@ trait MetaCollection */ public function externalIdContains(string $externalId): GroupCollectorInterface { - $externalId = (string) json_encode($externalId); + $externalId = (string)json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -268,7 +268,7 @@ trait MetaCollection */ public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface { - $externalId = (string) json_encode($externalId); + $externalId = (string)json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -283,7 +283,7 @@ trait MetaCollection */ public function externalIdDoesNotEnd(string $externalId): GroupCollectorInterface { - $externalId = (string) json_encode($externalId); + $externalId = (string)json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -298,7 +298,7 @@ trait MetaCollection */ public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface { - $externalId = (string) json_encode($externalId); + $externalId = (string)json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -313,7 +313,7 @@ trait MetaCollection */ public function externalIdEnds(string $externalId): GroupCollectorInterface { - $externalId = (string) json_encode($externalId); + $externalId = (string)json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -328,7 +328,7 @@ trait MetaCollection */ public function externalIdStarts(string $externalId): GroupCollectorInterface { - $externalId = (string) json_encode($externalId); + $externalId = (string)json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -346,7 +346,7 @@ trait MetaCollection public function externalUrlContains(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) json_encode($url); + $url = (string)json_encode($url); $url = str_replace('\\', '\\\\', trim($url, '"')); $this->query->where('journal_meta.name', '=', 'external_url'); $this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s%%', $url)); @@ -362,7 +362,7 @@ trait MetaCollection public function externalUrlDoesNotContain(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) json_encode($url); + $url = (string)json_encode($url); $url = str_replace('\\', '\\\\', trim($url, '"')); $this->query->where('journal_meta.name', '=', 'external_url'); $this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s%%', $url)); @@ -378,7 +378,7 @@ trait MetaCollection public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) json_encode($url); + $url = (string)json_encode($url); $url = str_replace('\\', '\\\\', ltrim($url, '"')); $this->query->where('journal_meta.name', '=', 'external_url'); $this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s', $url)); @@ -394,7 +394,7 @@ trait MetaCollection public function externalUrlDoesNotStart(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) json_encode($url); + $url = (string)json_encode($url); $url = str_replace('\\', '\\\\', rtrim($url, '"')); //var_dump($url); @@ -412,7 +412,7 @@ trait MetaCollection public function externalUrlEnds(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) json_encode($url); + $url = (string)json_encode($url); $url = str_replace('\\', '\\\\', ltrim($url, '"')); $this->query->where('journal_meta.name', '=', 'external_url'); $this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s', $url)); @@ -428,7 +428,7 @@ trait MetaCollection public function externalUrlStarts(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) json_encode($url); + $url = (string)json_encode($url); $url = str_replace('\\', '\\\\', rtrim($url, '"')); //var_dump($url); @@ -487,7 +487,7 @@ trait MetaCollection */ public function internalReferenceContains(string $internalReference): GroupCollectorInterface { - $internalReference = (string) json_encode($internalReference); + $internalReference = (string)json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); //var_dump($internalReference); //exit; @@ -504,7 +504,7 @@ trait MetaCollection */ public function internalReferenceDoesNotContain(string $internalReference): GroupCollectorInterface { - $internalReference = (string) json_encode($internalReference); + $internalReference = (string)json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -519,7 +519,7 @@ trait MetaCollection */ public function internalReferenceDoesNotEnd(string $internalReference): GroupCollectorInterface { - $internalReference = (string) json_encode($internalReference); + $internalReference = (string)json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -534,7 +534,7 @@ trait MetaCollection */ public function internalReferenceDoesNotStart(string $internalReference): GroupCollectorInterface { - $internalReference = (string) json_encode($internalReference); + $internalReference = (string)json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -549,7 +549,7 @@ trait MetaCollection */ public function internalReferenceEnds(string $internalReference): GroupCollectorInterface { - $internalReference = (string) json_encode($internalReference); + $internalReference = (string)json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -564,7 +564,7 @@ trait MetaCollection */ public function internalReferenceStarts(string $internalReference): GroupCollectorInterface { - $internalReference = (string) json_encode($internalReference); + $internalReference = (string)json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -836,7 +836,7 @@ trait MetaCollection */ public function setInternalReference(string $internalReference): GroupCollectorInterface { - $internalReference = (string) json_encode($internalReference); + $internalReference = (string)json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -915,7 +915,7 @@ trait MetaCollection // this method adds a "postFilter" to the collector. $list = $tags->pluck('tag')->toArray(); - $filter = static function (int $index, array $object) use ($list): bool { + $filter = static function (array $object) use ($list): bool { foreach ($object['transactions'] as $transaction) { foreach ($transaction['tags'] as $tag) { if (in_array($tag['name'], $list, true)) { diff --git a/app/Helpers/Collector/Extensions/TimeCollection.php b/app/Helpers/Collector/Extensions/TimeCollection.php index 6a095d0100..90c88ada99 100644 --- a/app/Helpers/Collector/Extensions/TimeCollection.php +++ b/app/Helpers/Collector/Extensions/TimeCollection.php @@ -93,7 +93,7 @@ trait TimeCollection $start->startOfDay(); $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $start, $end): bool { + $filter = static function (array $object) use ($field, $start, $end): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon) { return $transaction[$field]->lt($start) || $transaction[$field]->gt($end); @@ -166,7 +166,7 @@ trait TimeCollection public function metaDayAfter(string $day, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $day): bool { + $filter = static function (array $object) use ($field, $day): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -190,7 +190,7 @@ trait TimeCollection public function metaDayBefore(string $day, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $day): bool { + $filter = static function (array $object) use ($field, $day): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -214,7 +214,7 @@ trait TimeCollection public function metaDayIs(string $day, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $day): bool { + $filter = static function (array $object) use ($field, $day): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -237,7 +237,7 @@ trait TimeCollection public function metaDayIsNot(string $day, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $day): bool { + $filter = static function (array $object) use ($field, $day): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -260,7 +260,7 @@ trait TimeCollection public function metaMonthAfter(string $month, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $month): bool { + $filter = static function (array $object) use ($field, $month): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -284,7 +284,7 @@ trait TimeCollection public function metaMonthBefore(string $month, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $month): bool { + $filter = static function (array $object) use ($field, $month): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -308,7 +308,7 @@ trait TimeCollection public function metaMonthIs(string $month, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $month): bool { + $filter = static function (array $object) use ($field, $month): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -331,7 +331,7 @@ trait TimeCollection public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $month): bool { + $filter = static function (array $object) use ($field, $month): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -354,7 +354,7 @@ trait TimeCollection public function metaYearAfter(string $year, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $year): bool { + $filter = static function (array $object) use ($field, $year): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -378,7 +378,7 @@ trait TimeCollection public function metaYearBefore(string $year, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $year): bool { + $filter = static function (array $object) use ($field, $year): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -402,7 +402,7 @@ trait TimeCollection public function metaYearIs(string $year, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $year): bool { + $filter = static function (array $object) use ($field, $year): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -426,7 +426,7 @@ trait TimeCollection public function metaYearIsNot(string $year, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $year): bool { + $filter = static function (array $object) use ($field, $year): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -702,7 +702,7 @@ trait TimeCollection { $this->withMetaDate($field); $date->startOfDay(); - $filter = static function (int $index, array $object) use ($field, $date): bool { + $filter = static function (array $object) use ($field, $date): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -726,7 +726,7 @@ trait TimeCollection public function setMetaBefore(Carbon $date, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $date): bool { + $filter = static function (array $object) use ($field, $date): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -758,7 +758,7 @@ trait TimeCollection $start->startOfDay(); $this->withMetaDate($field); - $filter = static function (int $index, array $object) use ($field, $start, $end): bool { + $filter = static function (array $object) use ($field, $start, $end): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index d880d50016..a28b2c764c 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -782,7 +782,7 @@ class GroupCollector implements GroupCollectorInterface /** @var array $transaction */ foreach ($group['transactions'] as $transaction) { $currencyId = (int)$transaction['currency_id']; - if(null === $transaction['amount']) { + if (null === $transaction['amount']) { throw new FireflyException(sprintf('Amount is NULL for a transaction in group #%d, please investigate.', $groudId)); } @@ -835,8 +835,8 @@ class GroupCollector implements GroupCollectorInterface * @var int $ii * @var array $item */ - foreach ($currentCollection as $ii => $item) { - $result = $function($ii, $item); + foreach ($currentCollection as $item) { + $result = $function($item); if (false === $result) { // skip other filters, continue to next item. continue; diff --git a/app/Helpers/Fiscal/FiscalHelper.php b/app/Helpers/Fiscal/FiscalHelper.php index 05d1fb453e..1b6b23dd06 100644 --- a/app/Helpers/Fiscal/FiscalHelper.php +++ b/app/Helpers/Fiscal/FiscalHelper.php @@ -80,10 +80,10 @@ class FiscalHelper implements FiscalHelperInterface $startDate = clone $date; if (true === $this->useCustomFiscalYear) { $prefStartStr = app('preferences')->get('fiscalYearStart', '01-01')->data; - if(is_array($prefStartStr)) { + if (is_array($prefStartStr)) { $prefStartStr = '01-01'; } - $prefStartStr = (string) $prefStartStr; + $prefStartStr = (string)$prefStartStr; [$mth, $day] = explode('-', $prefStartStr); $startDate->day((int)$day)->month((int)$mth); diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.php index dfbf747801..276767ea93 100644 --- a/app/Http/Controllers/Admin/HomeController.php +++ b/app/Http/Controllers/Admin/HomeController.php @@ -111,11 +111,9 @@ class HomeController extends Controller /** * Send a test message to the admin. * - * @param Request $request - * * @return RedirectResponse|Redirector */ - public function testMessage(Request $request) + public function testMessage() { Log::channel('audit')->info('User sends test message.'); /** @var User $user */ diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 75da44d68f..49f1590b7a 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -209,14 +209,13 @@ class AttachmentController extends Controller /** * View attachment in browser. * - * @param Request $request * @param Attachment $attachment * * @return LaravelResponse * @throws FireflyException * @throws BindingResolutionException */ - public function view(Request $request, Attachment $attachment): LaravelResponse + public function view(Attachment $attachment): LaravelResponse { if ($this->repository->exists($attachment)) { $content = $this->repository->getContent($attachment); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index b381b140ad..bd8a490e9c 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -148,7 +148,7 @@ class LoginController extends Controller * @param Request $request * * @return void - * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @throws ValidationException */ protected function sendFailedLoginResponse(Request $request) diff --git a/app/Notifications/Admin/TestNotification.php b/app/Notifications/Admin/TestNotification.php index 5af18e03c9..3d3a276092 100644 --- a/app/Notifications/Admin/TestNotification.php +++ b/app/Notifications/Admin/TestNotification.php @@ -53,6 +53,7 @@ class TestNotification extends Notification * Get the array representation of the notification. * * @param mixed $notifiable + * @SuppressWarnings(PHPMD.UnusedFormalParameter) * * @return array */ @@ -67,6 +68,7 @@ class TestNotification extends Notification * Get the mail representation of the notification. * * @param mixed $notifiable + * @SuppressWarnings(PHPMD.UnusedFormalParameter) * * @return MailMessage */ @@ -81,6 +83,7 @@ class TestNotification extends Notification * Get the Slack representation of the notification. * * @param mixed $notifiable + * @SuppressWarnings(PHPMD.UnusedFormalParameter) * * @return SlackMessage */ @@ -91,6 +94,7 @@ class TestNotification extends Notification /** * Get the notification's delivery channels. + * @SuppressWarnings(PHPMD.UnusedFormalParameter) * * @param mixed $notifiable * diff --git a/app/Notifications/Admin/UserInvitation.php b/app/Notifications/Admin/UserInvitation.php index 45384ca8d8..a9f05e7014 100644 --- a/app/Notifications/Admin/UserInvitation.php +++ b/app/Notifications/Admin/UserInvitation.php @@ -56,6 +56,7 @@ class UserInvitation extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -70,6 +71,7 @@ class UserInvitation extends Notification * @param mixed $notifiable * * @return MailMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { @@ -84,6 +86,7 @@ class UserInvitation extends Notification * @param mixed $notifiable * * @return SlackMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toSlack($notifiable) { @@ -98,6 +101,7 @@ class UserInvitation extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { diff --git a/app/Notifications/Admin/UserRegistration.php b/app/Notifications/Admin/UserRegistration.php index 4b0bce8971..cccb74cb8a 100644 --- a/app/Notifications/Admin/UserRegistration.php +++ b/app/Notifications/Admin/UserRegistration.php @@ -56,6 +56,7 @@ class UserRegistration extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -70,6 +71,7 @@ class UserRegistration extends Notification * @param mixed $notifiable * * @return MailMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { @@ -84,6 +86,7 @@ class UserRegistration extends Notification * @param mixed $notifiable * * @return SlackMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toSlack($notifiable) { @@ -96,6 +99,7 @@ class UserRegistration extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { diff --git a/app/Notifications/Admin/VersionCheckResult.php b/app/Notifications/Admin/VersionCheckResult.php index a4cf00e1b0..49dfaffa66 100644 --- a/app/Notifications/Admin/VersionCheckResult.php +++ b/app/Notifications/Admin/VersionCheckResult.php @@ -56,6 +56,7 @@ class VersionCheckResult extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -70,6 +71,7 @@ class VersionCheckResult extends Notification * @param mixed $notifiable * * @return MailMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { @@ -84,6 +86,7 @@ class VersionCheckResult extends Notification * @param mixed $notifiable * * @return SlackMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toSlack($notifiable) { @@ -99,6 +102,7 @@ class VersionCheckResult extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { diff --git a/app/Notifications/User/BillReminder.php b/app/Notifications/User/BillReminder.php index a6aad8fc3d..d017273a77 100644 --- a/app/Notifications/User/BillReminder.php +++ b/app/Notifications/User/BillReminder.php @@ -61,6 +61,7 @@ class BillReminder extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -75,6 +76,7 @@ class BillReminder extends Notification * @param mixed $notifiable * * @return MailMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { @@ -94,6 +96,7 @@ class BillReminder extends Notification * @param mixed $notifiable * * @return SlackMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toSlack($notifiable) { @@ -117,6 +120,7 @@ class BillReminder extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { @@ -126,7 +130,7 @@ class BillReminder extends Notification if (is_array($slackUrl)) { $slackUrl = ''; } - if (UrlValidator::isValidWebhookURL((string) $slackUrl)) { + if (UrlValidator::isValidWebhookURL((string)$slackUrl)) { return ['mail', 'slack']; } return ['mail']; diff --git a/app/Notifications/User/NewAccessToken.php b/app/Notifications/User/NewAccessToken.php index be8b50abd4..ed0ab00dc0 100644 --- a/app/Notifications/User/NewAccessToken.php +++ b/app/Notifications/User/NewAccessToken.php @@ -53,6 +53,7 @@ class NewAccessToken extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -67,6 +68,7 @@ class NewAccessToken extends Notification * @param mixed $notifiable * * @return MailMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { @@ -81,6 +83,7 @@ class NewAccessToken extends Notification * @param mixed $notifiable * * @return SlackMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toSlack($notifiable) { @@ -93,6 +96,7 @@ class NewAccessToken extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { diff --git a/app/Notifications/User/RuleActionFailed.php b/app/Notifications/User/RuleActionFailed.php index 5fa16410fe..4f4ec4e48a 100644 --- a/app/Notifications/User/RuleActionFailed.php +++ b/app/Notifications/User/RuleActionFailed.php @@ -66,6 +66,7 @@ class RuleActionFailed extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -80,6 +81,7 @@ class RuleActionFailed extends Notification * @param mixed $notifiable * * @return SlackMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toSlack($notifiable) { @@ -101,6 +103,7 @@ class RuleActionFailed extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { diff --git a/app/Notifications/User/TransactionCreation.php b/app/Notifications/User/TransactionCreation.php index ecd51b6825..5eefc7717c 100644 --- a/app/Notifications/User/TransactionCreation.php +++ b/app/Notifications/User/TransactionCreation.php @@ -53,6 +53,7 @@ class TransactionCreation extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -67,6 +68,7 @@ class TransactionCreation extends Notification * @param mixed $notifiable * * @return MailMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { @@ -81,6 +83,7 @@ class TransactionCreation extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { diff --git a/app/Notifications/User/UserLogin.php b/app/Notifications/User/UserLogin.php index dc642f6cc3..5f0a22728e 100644 --- a/app/Notifications/User/UserLogin.php +++ b/app/Notifications/User/UserLogin.php @@ -57,6 +57,7 @@ class UserLogin extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -71,6 +72,7 @@ class UserLogin extends Notification * @param mixed $notifiable * * @return MailMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { @@ -97,6 +99,7 @@ class UserLogin extends Notification * @param mixed $notifiable * * @return SlackMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toSlack($notifiable) { @@ -120,6 +123,7 @@ class UserLogin extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { @@ -129,7 +133,7 @@ class UserLogin extends Notification if (is_array($slackUrl)) { $slackUrl = ''; } - if (UrlValidator::isValidWebhookURL((string) $slackUrl)) { + if (UrlValidator::isValidWebhookURL((string)$slackUrl)) { return ['mail', 'slack']; } return ['mail']; diff --git a/app/Notifications/User/UserNewPassword.php b/app/Notifications/User/UserNewPassword.php index 4d69465717..bf0516fdb7 100644 --- a/app/Notifications/User/UserNewPassword.php +++ b/app/Notifications/User/UserNewPassword.php @@ -53,6 +53,7 @@ class UserNewPassword extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -67,6 +68,7 @@ class UserNewPassword extends Notification * @param mixed $notifiable * * @return MailMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { @@ -81,6 +83,7 @@ class UserNewPassword extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) { diff --git a/app/Notifications/User/UserRegistration.php b/app/Notifications/User/UserRegistration.php index dab21b71ba..3654e6fb97 100644 --- a/app/Notifications/User/UserRegistration.php +++ b/app/Notifications/User/UserRegistration.php @@ -50,6 +50,7 @@ class UserRegistration extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($notifiable) { @@ -64,6 +65,7 @@ class UserRegistration extends Notification * @param mixed $notifiable * * @return MailMessage + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toMail($notifiable) { @@ -78,6 +80,7 @@ class UserRegistration extends Notification * @param mixed $notifiable * * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function via($notifiable) {