diff --git a/.ci/phpmd/phpmd.xml b/.ci/phpmd/phpmd.xml index 42328dc44f..3053b2eb40 100644 --- a/.ci/phpmd/phpmd.xml +++ b/.ci/phpmd/phpmd.xml @@ -43,8 +43,8 @@ - - + + @@ -67,7 +67,7 @@ - + diff --git a/app/Api/V1/Controllers/Data/Export/ExportController.php b/app/Api/V1/Controllers/Data/Export/ExportController.php index c722088a2e..5625472d5f 100644 --- a/app/Api/V1/Controllers/Data/Export/ExportController.php +++ b/app/Api/V1/Controllers/Data/Export/ExportController.php @@ -62,7 +62,11 @@ class ExportController extends Controller * @param ExportRequest $request * * @return LaravelResponse + * @throws ContainerExceptionInterface * @throws FireflyException + * @throws NotFoundExceptionInterface + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function accounts(ExportRequest $request): LaravelResponse { @@ -108,7 +112,10 @@ class ExportController extends Controller * @param ExportRequest $request * * @return LaravelResponse + * @throws ContainerExceptionInterface * @throws FireflyException + * @throws NotFoundExceptionInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function bills(ExportRequest $request): LaravelResponse { @@ -124,7 +131,10 @@ class ExportController extends Controller * @param ExportRequest $request * * @return LaravelResponse + * @throws ContainerExceptionInterface * @throws FireflyException + * @throws NotFoundExceptionInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function budgets(ExportRequest $request): LaravelResponse { @@ -140,7 +150,10 @@ class ExportController extends Controller * @param ExportRequest $request * * @return LaravelResponse + * @throws ContainerExceptionInterface * @throws FireflyException + * @throws NotFoundExceptionInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function categories(ExportRequest $request): LaravelResponse { @@ -156,7 +169,10 @@ class ExportController extends Controller * @param ExportRequest $request * * @return LaravelResponse + * @throws ContainerExceptionInterface * @throws FireflyException + * @throws NotFoundExceptionInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function piggyBanks(ExportRequest $request): LaravelResponse { @@ -172,7 +188,10 @@ class ExportController extends Controller * @param ExportRequest $request * * @return LaravelResponse + * @throws ContainerExceptionInterface * @throws FireflyException + * @throws NotFoundExceptionInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function recurring(ExportRequest $request): LaravelResponse { @@ -188,7 +207,10 @@ class ExportController extends Controller * @param ExportRequest $request * * @return LaravelResponse + * @throws ContainerExceptionInterface * @throws FireflyException + * @throws NotFoundExceptionInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function rules(ExportRequest $request): LaravelResponse { @@ -204,7 +226,10 @@ class ExportController extends Controller * @param ExportRequest $request * * @return LaravelResponse + * @throws ContainerExceptionInterface * @throws FireflyException + * @throws NotFoundExceptionInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function tags(ExportRequest $request): LaravelResponse { @@ -220,7 +245,9 @@ class ExportController extends Controller * @param ExportRequest $request * * @return LaravelResponse + * @throws ContainerExceptionInterface * @throws FireflyException + * @throws NotFoundExceptionInterface */ public function transactions(ExportRequest $request): LaravelResponse { diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php b/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php index 5957e74b0a..342475b2c6 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php @@ -75,13 +75,11 @@ class ShowController extends Controller * * Display a listing of the budget limits for this budget. * - * @param Request $request - * @param Budget $budget + * @param Budget $budget * * @return JsonResponse - * @throws FireflyException */ - public function index(Request $request, Budget $budget): JsonResponse + public function index(Budget $budget): JsonResponse { $manager = $this->getManager(); $manager->parseIncludes('budget'); @@ -111,7 +109,7 @@ class ShowController extends Controller * @param SameDateRequest $request * * @return JsonResponse - * @throws FireflyException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function indexAll(SameDateRequest $request): JsonResponse { @@ -138,14 +136,13 @@ class ShowController extends Controller * This endpoint is documented at: * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/getBudgetLimit * - * @param Request $request * @param Budget $budget * @param BudgetLimit $budgetLimit * * @return JsonResponse * @throws FireflyException */ - public function show(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse + public function show(Budget $budget, BudgetLimit $budgetLimit): JsonResponse { if ($budget->id !== $budgetLimit->budget_id) { throw new FireflyException('20028: The budget limit does not belong to the budget.'); diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php b/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php index ae8e202aa3..131648c400 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php @@ -69,12 +69,9 @@ class ShowController extends Controller * * Display a listing of the resource. * - * @param Request $request - * * @return JsonResponse - * @throws FireflyException */ - public function index(Request $request): JsonResponse + public function index(): JsonResponse { $manager = $this->getManager(); diff --git a/app/Api/V1/Controllers/System/CronController.php b/app/Api/V1/Controllers/System/CronController.php index cd269957c2..eec18ecf8c 100644 --- a/app/Api/V1/Controllers/System/CronController.php +++ b/app/Api/V1/Controllers/System/CronController.php @@ -42,13 +42,12 @@ class CronController extends Controller * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/about/getCron * * @param CronRequest $request - * @param string $token * * @return JsonResponse * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function cron(CronRequest $request, string $token): JsonResponse + public function cron(CronRequest $request): JsonResponse { $config = $request->getAll(); diff --git a/app/Api/V2/Controllers/Autocomplete/AccountController.php b/app/Api/V2/Controllers/Autocomplete/AccountController.php index e7346a67b4..5d5f0efcd1 100644 --- a/app/Api/V2/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V2/Controllers/Autocomplete/AccountController.php @@ -123,12 +123,12 @@ class AccountController extends Controller usort( $allItems, - static function (array $a, array $b): int { + static function (array $left, array $right): int { $order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE]; - $pos_a = (int)array_search($a['type'], $order, true); - $pos_b = (int)array_search($b['type'], $order, true); + $posLeft = (int)array_search($left['type'], $order, true); + $posRight = (int)array_search($right['type'], $order, true); - return $pos_a - $pos_b; + return $posLeft - $posRight; } ); return response()->json($allItems); diff --git a/app/Api/V2/Controllers/Chart/AccountController.php b/app/Api/V2/Controllers/Chart/AccountController.php index 29c0cf1523..6f99f697a2 100644 --- a/app/Api/V2/Controllers/Chart/AccountController.php +++ b/app/Api/V2/Controllers/Chart/AccountController.php @@ -84,6 +84,7 @@ class AccountController extends Controller * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface * @throws FireflyException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function dashboard(DateRequest $request): JsonResponse { diff --git a/app/Support/Binder/CLIToken.php b/app/Support/Binder/CLIToken.php index 6863b1e362..fcb1889880 100644 --- a/app/Support/Binder/CLIToken.php +++ b/app/Support/Binder/CLIToken.php @@ -54,7 +54,7 @@ class CLIToken implements BinderInterface foreach ($users as $user) { $accessToken = app('preferences')->getForUser($user, 'access_token'); if (null !== $accessToken && $accessToken->data === $value) { - app('log')->info(sprintf('Recognized user #%d (%s) from his acccess token.', $user->id, $user->email)); + app('log')->info(sprintf('Recognized user #%d (%s) from his access token.', $user->id, $user->email)); return $value; } diff --git a/app/User.php b/app/User.php index 9a3098d003..a616af33c6 100644 --- a/app/User.php +++ b/app/User.php @@ -520,7 +520,8 @@ class User extends Authenticatable */ public function routeNotificationFor($driver, $notification = null) { - if (method_exists($this, $method = 'routeNotificationFor' . Str::studly($driver))) { + $method = 'routeNotificationFor' . Str::studly($driver); + if (method_exists($this, $method)) { return $this->{$method}($notification); // @phpstan-ignore-line } $email = $this->email;