From 337d14e71e7d27768cd5490c4fb7dc91aec9c598 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 21 Dec 2023 05:46:05 +0100 Subject: [PATCH] Pick up some phpmd things --- app/Support/Authentication/RemoteUserGuard.php | 5 +++++ app/Support/Authentication/RemoteUserProvider.php | 13 +++++++++++++ app/Support/Export/ExportDataGenerator.php | 6 ++++++ .../Actions/AppendNotesToDescription.php | 8 +++++++- .../Actions/MoveNotesToDescription.php | 8 +++++++- 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index 51937d0c2d..f24dff26a3 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -162,6 +162,11 @@ class RemoteUserGuard implements Guard app('log')->error(sprintf('Did not set user at %s', __METHOD__)); } + /** + * @throws FireflyException + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ public function validate(array $credentials = []): bool { app('log')->debug(sprintf('Now at %s', __METHOD__)); diff --git a/app/Support/Authentication/RemoteUserProvider.php b/app/Support/Authentication/RemoteUserProvider.php index 7c0f62bd4e..55dbbb1c2b 100644 --- a/app/Support/Authentication/RemoteUserProvider.php +++ b/app/Support/Authentication/RemoteUserProvider.php @@ -38,6 +38,8 @@ class RemoteUserProvider implements UserProvider { /** * @throws FireflyException + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function retrieveByCredentials(array $credentials): null|Authenticatable { @@ -83,6 +85,8 @@ class RemoteUserProvider implements UserProvider * @param mixed $token * * @throws FireflyException + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function retrieveByToken($identifier, $token): null|Authenticatable { @@ -91,6 +95,13 @@ class RemoteUserProvider implements UserProvider throw new FireflyException(sprintf('A) Did not implement %s', __METHOD__)); } + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * + * @param mixed $token + * + * @throws FireflyException + */ public function updateRememberToken(Authenticatable $user, $token): void { app('log')->debug(sprintf('Now at %s', __METHOD__)); @@ -100,6 +111,8 @@ class RemoteUserProvider implements UserProvider /** * @throws FireflyException + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function validateCredentials(Authenticatable $user, array $credentials): bool { diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php index 24454141bf..1227ff9e58 100644 --- a/app/Support/Export/ExportDataGenerator.php +++ b/app/Support/Export/ExportDataGenerator.php @@ -143,6 +143,9 @@ class ExportDataGenerator $this->user = $user; } + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ public function get(string $key, mixed $default = null): mixed { return null; @@ -153,6 +156,9 @@ class ExportDataGenerator $this->accounts = $accounts; } + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ public function has(mixed $key): mixed { return null; diff --git a/app/TransactionRules/Actions/AppendNotesToDescription.php b/app/TransactionRules/Actions/AppendNotesToDescription.php index 425bd303e5..7ba8abd032 100644 --- a/app/TransactionRules/Actions/AppendNotesToDescription.php +++ b/app/TransactionRules/Actions/AppendNotesToDescription.php @@ -70,7 +70,7 @@ class AppendNotesToDescription implements ActionInterface // only append if there is something to append if ('' !== $note->text) { $before = $object->description; - $object->description = trim(sprintf('%s %s', $object->description, (string)$this->clearString($note->text))); + $object->description = trim(sprintf('%s %s', $object->description, (string) $this->clearString($note->text))); $object->save(); app('log')->debug(sprintf('Journal description is updated to "%s".', $object->description)); @@ -83,11 +83,17 @@ class AppendNotesToDescription implements ActionInterface return false; } + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ public function get(string $key, mixed $default = null): mixed { return null; } + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ public function has(mixed $key): mixed { return null; diff --git a/app/TransactionRules/Actions/MoveNotesToDescription.php b/app/TransactionRules/Actions/MoveNotesToDescription.php index 4b8bcb164e..2a8b51fce7 100644 --- a/app/TransactionRules/Actions/MoveNotesToDescription.php +++ b/app/TransactionRules/Actions/MoveNotesToDescription.php @@ -77,7 +77,7 @@ class MoveNotesToDescription implements ActionInterface } $before = $object->description; $beforeNote = $note->text; - $object->description = (string)$this->clearString($note->text); + $object->description = (string) $this->clearString($note->text); $object->save(); $note->delete(); @@ -87,11 +87,17 @@ class MoveNotesToDescription implements ActionInterface return true; } + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ public function get(string $key, mixed $default = null): mixed { return null; } + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ public function has(mixed $key): mixed { return null;