diff --git a/app/Api/V1/Controllers/AccountController.php b/app/Api/V1/Controllers/AccountController.php index 1a962df72f..dae6bec18b 100644 --- a/app/Api/V1/Controllers/AccountController.php +++ b/app/Api/V1/Controllers/AccountController.php @@ -104,7 +104,7 @@ class AccountController extends Controller // types to get, page size: $types = $this->mapAccountTypes($this->parameters->get('type')); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of accounts. Count it and split it. $collection = $this->repository->getAccountsByType($types); @@ -142,7 +142,7 @@ class AccountController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getPiggyBanks($account); @@ -218,7 +218,7 @@ class AccountController extends Controller */ public function transactions(Request $request, Account $account): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/AttachmentController.php b/app/Api/V1/Controllers/AttachmentController.php index 737f5fa1fa..a2895d4847 100644 --- a/app/Api/V1/Controllers/AttachmentController.php +++ b/app/Api/V1/Controllers/AttachmentController.php @@ -92,8 +92,8 @@ class AttachmentController extends Controller * @param Attachment $attachment * * @codeCoverageIgnore - * @return LaravelResponse * @throws FireflyException + * @return LaravelResponse */ public function download(Attachment $attachment): LaravelResponse { @@ -108,7 +108,7 @@ class AttachmentController extends Controller if ('' === $content) { throw new FireflyException('200002: File is empty (zero bytes).'); } - $quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\')); + $quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\')); /** @var LaravelResponse $response */ $response = response($content); @@ -139,7 +139,7 @@ class AttachmentController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of accounts. Count it and split it. $collection = $this->repository->get(); @@ -184,8 +184,8 @@ class AttachmentController extends Controller * * @param AttachmentStoreRequest $request * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function store(AttachmentStoreRequest $request): JsonResponse { diff --git a/app/Api/V1/Controllers/AvailableBudgetController.php b/app/Api/V1/Controllers/AvailableBudgetController.php index 29b5a761d1..d937bc1043 100644 --- a/app/Api/V1/Controllers/AvailableBudgetController.php +++ b/app/Api/V1/Controllers/AvailableBudgetController.php @@ -92,7 +92,7 @@ class AvailableBudgetController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $start = $this->parameters->get('start'); $end = $this->parameters->get('end'); diff --git a/app/Api/V1/Controllers/BillController.php b/app/Api/V1/Controllers/BillController.php index 6c0b3e28a3..009685d3ec 100644 --- a/app/Api/V1/Controllers/BillController.php +++ b/app/Api/V1/Controllers/BillController.php @@ -85,7 +85,7 @@ class BillController extends Controller public function attachments(Bill $bill): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAttachments($bill); $count = $collection->count(); @@ -130,7 +130,7 @@ class BillController extends Controller { $bills = $this->repository->getBills(); $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $count = $bills->count(); $bills = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); $paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page')); @@ -158,7 +158,7 @@ class BillController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getRulesForBill($bill); @@ -206,8 +206,8 @@ class BillController extends Controller * * @param BillRequest $request * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function store(BillRequest $request): JsonResponse { @@ -235,7 +235,7 @@ class BillController extends Controller */ public function transactions(Request $request, Bill $bill): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/BudgetController.php b/app/Api/V1/Controllers/BudgetController.php index 22f6efc5b3..ee94b68f31 100644 --- a/app/Api/V1/Controllers/BudgetController.php +++ b/app/Api/V1/Controllers/BudgetController.php @@ -90,7 +90,7 @@ class BudgetController extends Controller public function budgetLimits(Budget $budget): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $this->parameters->set('budget_id', $budget->id); $collection = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end')); $count = $collection->count(); @@ -135,7 +135,7 @@ class BudgetController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getBudgets(); @@ -182,9 +182,9 @@ class BudgetController extends Controller * * @param BudgetStoreRequest $request * - * @return JsonResponse * @throws FireflyException * + * @return JsonResponse */ public function store(BudgetStoreRequest $request): JsonResponse { @@ -206,8 +206,8 @@ class BudgetController extends Controller * @param BudgetLimitRequest $request * @param Budget $budget * - * @return JsonResponse * @throws Exception + * @return JsonResponse */ public function storeBudgetLimit(BudgetLimitRequest $request, Budget $budget): JsonResponse { @@ -237,7 +237,7 @@ class BudgetController extends Controller */ public function transactions(Request $request, Budget $budget): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // user can overrule page size with limit parameter. $limit = $this->parameters->get('limit'); @@ -293,7 +293,7 @@ class BudgetController extends Controller * Update a budget. * * @param BudgetUpdateRequest $request - * @param Budget $budget + * @param Budget $budget * * @return JsonResponse */ diff --git a/app/Api/V1/Controllers/BudgetLimitController.php b/app/Api/V1/Controllers/BudgetLimitController.php index 14e23e4374..6fd81263ca 100644 --- a/app/Api/V1/Controllers/BudgetLimitController.php +++ b/app/Api/V1/Controllers/BudgetLimitController.php @@ -102,9 +102,9 @@ class BudgetLimitController extends Controller public function index(Request $request): JsonResponse { $manager = $this->getManager(); - $budgetId = (int)($request->get('budget_id') ?? 0); + $budgetId = (int) ($request->get('budget_id') ?? 0); $budget = $this->repository->findNull($budgetId); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $this->parameters->set('budget_id', $budgetId); $collection = new Collection; @@ -156,9 +156,9 @@ class BudgetLimitController extends Controller * * @param BudgetLimitRequest $request * - * @return JsonResponse * @throws FireflyException * + * @return JsonResponse */ public function store(BudgetLimitRequest $request): JsonResponse { @@ -191,7 +191,7 @@ class BudgetLimitController extends Controller */ public function transactions(Request $request, BudgetLimit $budgetLimit): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/CategoryController.php b/app/Api/V1/Controllers/CategoryController.php index 984f1c0826..a228b6f49a 100644 --- a/app/Api/V1/Controllers/CategoryController.php +++ b/app/Api/V1/Controllers/CategoryController.php @@ -97,7 +97,7 @@ class CategoryController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getCategories(); @@ -146,13 +146,13 @@ class CategoryController extends Controller * * @param CategoryRequest $request * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function store(CategoryRequest $request): JsonResponse { $category = $this->repository->store($request->getAll()); - $manager = $this->getManager(); + $manager = $this->getManager(); /** @var CategoryTransformer $transformer */ $transformer = app(CategoryTransformer::class); @@ -175,7 +175,7 @@ class CategoryController extends Controller */ public function transactions(Request $request, Category $category): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Chart/AccountController.php b/app/Api/V1/Controllers/Chart/AccountController.php index 840efd31f3..c01606a6b0 100644 --- a/app/Api/V1/Controllers/Chart/AccountController.php +++ b/app/Api/V1/Controllers/Chart/AccountController.php @@ -99,10 +99,10 @@ class AccountController extends Controller // loop the end balances. This is an array for each account ($expenses) foreach ($endBalances as $accountId => $expenses) { - $accountId = (int)$accountId; + $accountId = (int) $accountId; // loop each expense entry (each entry can be a different currency). foreach ($expenses as $currencyId => $endAmount) { - $currencyId = (int)$currencyId; + $currencyId = (int) $currencyId; // see if there is an accompanying start amount. // grab the difference and find the currency. @@ -114,7 +114,7 @@ class AccountController extends Controller $tempData[] = [ 'name' => $accountNames[$accountId], 'difference' => $diff, - 'diff_float' => (float)$diff, + 'diff_float' => (float) $diff, 'currency_id' => $currencyId, ]; } @@ -247,10 +247,10 @@ class AccountController extends Controller // loop the end balances. This is an array for each account ($expenses) foreach ($endBalances as $accountId => $expenses) { - $accountId = (int)$accountId; + $accountId = (int) $accountId; // loop each expense entry (each entry can be a different currency). foreach ($expenses as $currencyId => $endAmount) { - $currencyId = (int)$currencyId; + $currencyId = (int) $currencyId; // see if there is an accompanying start amount. // grab the difference and find the currency. @@ -263,7 +263,7 @@ class AccountController extends Controller 'name' => $accountNames[$accountId], 'difference' => bcmul($diff, '-1'), // For some reason this line is never covered in code coverage: - 'diff_float' => ((float)$diff) * -1, // @codeCoverageIgnore + 'diff_float' => ((float) $diff) * -1, // @codeCoverageIgnore 'currency_id' => $currencyId, ]; } diff --git a/app/Api/V1/Controllers/Chart/AvailableBudgetController.php b/app/Api/V1/Controllers/Chart/AvailableBudgetController.php index 62b39fe4ac..aa83e7bf4c 100644 --- a/app/Api/V1/Controllers/Chart/AvailableBudgetController.php +++ b/app/Api/V1/Controllers/Chart/AvailableBudgetController.php @@ -83,7 +83,7 @@ class AvailableBudgetController extends Controller $spent = $spentInfo['amount']; } } - $left = bcadd($availableBudget->amount, (string)$spent); + $left = bcadd($availableBudget->amount, (string) $spent); // left less than zero? Set to zero. if (-1 === bccomp($left, '0')) { $left = '0'; diff --git a/app/Api/V1/Controllers/Chart/CategoryController.php b/app/Api/V1/Controllers/Chart/CategoryController.php index faf4055fe8..9975a0b044 100644 --- a/app/Api/V1/Controllers/Chart/CategoryController.php +++ b/app/Api/V1/Controllers/Chart/CategoryController.php @@ -104,7 +104,7 @@ class CategoryController extends Controller // make data arrays if not yet present. $tempData[$inKey] = $tempData[$inKey] ?? [ 'currency_id' => $currency['currency_id'], - 'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]), + 'label' => (string) trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]), 'currency_code' => $currency['currency_code'], 'currency_symbol' => $currency['currency_symbol'], 'currency_decimal_places' => $currency['currency_decimal_places'], @@ -117,7 +117,7 @@ class CategoryController extends Controller ]; $tempData[$outKey] = $tempData[$outKey] ?? [ 'currency_id' => $currency['currency_id'], - 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]), + 'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]), 'currency_code' => $currency['currency_code'], 'currency_symbol' => $currency['currency_symbol'], 'currency_decimal_places' => $currency['currency_decimal_places'], @@ -141,48 +141,48 @@ class CategoryController extends Controller } } -// foreach ([] as $set) { -// foreach ($set as $currency) { -// $inKey = sprintf('%d-i', $currency['currency_id']); -// $outKey = sprintf('%d-e', $currency['currency_id']); -// $categories[] = (string)trans('firefly.no_category'); -// // make data arrays if not yet present. -// $tempData[$inKey] = $tempData[$inKey] ?? [ -// 'currency_id' => $currency['currency_id'], -// 'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]), -// 'currency_code' => $currency['currency_code'], -// 'currency_symbol' => $currency['currency_symbol'], -// 'currency_decimal_places' => $currency['currency_decimal_places'], -// 'type' => 'bar', // line, area or bar -// 'yAxisID' => 0, // 0, 1, 2 -// 'entries' => [ -// // per category: -// // "category" => 5, -// ], -// ]; -// $tempData[$outKey] = $tempData[$outKey] ?? [ -// 'currency_id' => $currency['currency_id'], -// 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]), -// 'currency_code' => $currency['currency_code'], -// 'currency_symbol' => $currency['currency_symbol'], -// 'currency_decimal_places' => $currency['currency_decimal_places'], -// 'type' => 'bar', // line, area or bar -// 'yAxisID' => 0, // 0, 1, 2 -// 'entries' => [ -// // per category: -// // "category" => 5, -// ], -// ]; -// foreach ($currency['transaction_journals'] as $journal) { -// // is it expense or income? -// $letter = -1 === bccomp($journal['amount'], '0') ? 'e' : 'i'; -// $currentKey = sprintf('%d-%s', $currency['currency_id'], $letter); -// $name = (string)trans('firefly.no_category'); -// $tempData[$currentKey]['entries'][$name] = $tempData[$currentKey]['entries'][$name] ?? '0'; -// $tempData[$currentKey]['entries'][$name] = bcadd($tempData[$currentKey]['entries'][$name], $journal['amount']); -// } -// } -// } + // foreach ([] as $set) { + // foreach ($set as $currency) { + // $inKey = sprintf('%d-i', $currency['currency_id']); + // $outKey = sprintf('%d-e', $currency['currency_id']); + // $categories[] = (string)trans('firefly.no_category'); + // // make data arrays if not yet present. + // $tempData[$inKey] = $tempData[$inKey] ?? [ + // 'currency_id' => $currency['currency_id'], + // 'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]), + // 'currency_code' => $currency['currency_code'], + // 'currency_symbol' => $currency['currency_symbol'], + // 'currency_decimal_places' => $currency['currency_decimal_places'], + // 'type' => 'bar', // line, area or bar + // 'yAxisID' => 0, // 0, 1, 2 + // 'entries' => [ + // // per category: + // // "category" => 5, + // ], + // ]; + // $tempData[$outKey] = $tempData[$outKey] ?? [ + // 'currency_id' => $currency['currency_id'], + // 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]), + // 'currency_code' => $currency['currency_code'], + // 'currency_symbol' => $currency['currency_symbol'], + // 'currency_decimal_places' => $currency['currency_decimal_places'], + // 'type' => 'bar', // line, area or bar + // 'yAxisID' => 0, // 0, 1, 2 + // 'entries' => [ + // // per category: + // // "category" => 5, + // ], + // ]; + // foreach ($currency['transaction_journals'] as $journal) { + // // is it expense or income? + // $letter = -1 === bccomp($journal['amount'], '0') ? 'e' : 'i'; + // $currentKey = sprintf('%d-%s', $currency['currency_id'], $letter); + // $name = (string)trans('firefly.no_category'); + // $tempData[$currentKey]['entries'][$name] = $tempData[$currentKey]['entries'][$name] ?? '0'; + // $tempData[$currentKey]['entries'][$name] = bcadd($tempData[$currentKey]['entries'][$name], $journal['amount']); + // } + // } + // } // re-sort every spent array and add 0 for missing entries. foreach ($tempData as $index => $set) { diff --git a/app/Api/V1/Controllers/ConfigurationController.php b/app/Api/V1/Controllers/ConfigurationController.php index cf7423a30c..bd81857431 100644 --- a/app/Api/V1/Controllers/ConfigurationController.php +++ b/app/Api/V1/Controllers/ConfigurationController.php @@ -111,8 +111,8 @@ class ConfigurationController extends Controller return [ 'is_demo_site' => null === $isDemoSite ? null : $isDemoSite->data, - 'permission_update_check' => null === $updateCheck ? null : (int)$updateCheck->data, - 'last_update_check' => null === $lastCheck ? null : (int)$lastCheck->data, + 'permission_update_check' => null === $updateCheck ? null : (int) $updateCheck->data, + 'last_update_check' => null === $lastCheck ? null : (int) $lastCheck->data, 'single_user_mode' => null === $singleUser ? null : $singleUser->data, ]; } diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php index 806b3f0743..018afbd46e 100644 --- a/app/Api/V1/Controllers/Controller.php +++ b/app/Api/V1/Controllers/Controller.php @@ -104,7 +104,7 @@ class Controller extends BaseController private function getParameters(): ParameterBag { $bag = new ParameterBag; - $page = (int)request()->get('page'); + $page = (int) request()->get('page'); if (0 === $page) { $page = 1; } @@ -131,7 +131,7 @@ class Controller extends BaseController foreach ($integers as $integer) { $value = request()->query->get($integer); if (null !== $value) { - $bag->set($integer, (int)$value); + $bag->set($integer, (int) $value); } } diff --git a/app/Api/V1/Controllers/CurrencyController.php b/app/Api/V1/Controllers/CurrencyController.php index 3a41ac79a4..835092e466 100644 --- a/app/Api/V1/Controllers/CurrencyController.php +++ b/app/Api/V1/Controllers/CurrencyController.php @@ -116,7 +116,7 @@ class CurrencyController extends Controller // types to get, page size: $types = $this->mapAccountTypes($this->parameters->get('type')); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of accounts. Count it and split it. /** @var AccountRepositoryInterface $accountRepository */ @@ -126,7 +126,7 @@ class CurrencyController extends Controller // filter list on currency preference: $collection = $unfiltered->filter( static function (Account $account) use ($currency, $accountRepository) { - $currencyId = (int)$accountRepository->getMetaValue($account, 'currency_id'); + $currencyId = (int) $accountRepository->getMetaValue($account, 'currency_id'); return $currencyId === $currency->id; } @@ -165,7 +165,7 @@ class CurrencyController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of available budgets. Count it and split it. @@ -209,7 +209,7 @@ class CurrencyController extends Controller /** @var BillRepositoryInterface $repository */ $repository = app(BillRepositoryInterface::class); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $unfiltered = $repository->getBills(); // filter and paginate list: @@ -249,7 +249,7 @@ class CurrencyController extends Controller $blRepository = app(BudgetLimitRepositoryInterface::class); $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $blRepository->getAllBudgetLimitsByCurrency($currency, $this->parameters->get('start'), $this->parameters->get('end')); $count = $collection->count(); $budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); @@ -278,7 +278,7 @@ class CurrencyController extends Controller { // create some objects: $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getExchangeRates($currency); @@ -302,9 +302,9 @@ class CurrencyController extends Controller * * @param TransactionCurrency $currency * - * @return JsonResponse * @throws FireflyException * @codeCoverageIgnore + * @return JsonResponse */ public function delete(TransactionCurrency $currency): JsonResponse { @@ -391,7 +391,7 @@ class CurrencyController extends Controller */ public function index(): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAll(); $count = $collection->count(); // slice them: @@ -455,7 +455,7 @@ class CurrencyController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. /** @var RecurringRepositoryInterface $repository */ @@ -506,7 +506,7 @@ class CurrencyController extends Controller public function rules(TransactionCurrency $currency): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. /** @var RuleRepositoryInterface $repository */ @@ -572,8 +572,8 @@ class CurrencyController extends Controller * * @param CurrencyRequest $request * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function store(CurrencyRequest $request): JsonResponse { @@ -607,7 +607,7 @@ class CurrencyController extends Controller */ public function transactions(Request $request, TransactionCurrency $currency): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/CurrencyExchangeRateController.php b/app/Api/V1/Controllers/CurrencyExchangeRateController.php index fa7b69417f..2cdb40ae6a 100644 --- a/app/Api/V1/Controllers/CurrencyExchangeRateController.php +++ b/app/Api/V1/Controllers/CurrencyExchangeRateController.php @@ -69,8 +69,8 @@ class CurrencyExchangeRateController extends Controller * * @param Request $request * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function index(Request $request): JsonResponse { diff --git a/app/Api/V1/Controllers/ImportController.php b/app/Api/V1/Controllers/ImportController.php index 1e2e84e7b6..52065ac4db 100644 --- a/app/Api/V1/Controllers/ImportController.php +++ b/app/Api/V1/Controllers/ImportController.php @@ -40,6 +40,7 @@ use League\Fractal\Resource\Item; /** * Class ImportController + * * @deprecated * @codeCoverageIgnore */ @@ -77,7 +78,7 @@ class ImportController extends Controller { // create some objects: $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of accounts. Count it and split it. $collection = $this->repository->get(); @@ -127,7 +128,7 @@ class ImportController extends Controller */ public function transactions(Request $request, ImportJob $importJob): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/LinkTypeController.php b/app/Api/V1/Controllers/LinkTypeController.php index 3436ab701e..ff23e1b463 100644 --- a/app/Api/V1/Controllers/LinkTypeController.php +++ b/app/Api/V1/Controllers/LinkTypeController.php @@ -79,9 +79,9 @@ class LinkTypeController extends Controller * * @param LinkType $linkType * - * @return JsonResponse * @throws FireflyException * @codeCoverageIgnore + * @return JsonResponse */ public function delete(LinkType $linkType): JsonResponse { @@ -103,7 +103,7 @@ class LinkTypeController extends Controller { // create some objects: $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of accounts. Count it and split it. $collection = $this->repository->get(); @@ -151,8 +151,8 @@ class LinkTypeController extends Controller * * @param LinkTypeRequest $request * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function store(LinkTypeRequest $request): JsonResponse { @@ -187,7 +187,7 @@ class LinkTypeController extends Controller */ public function transactions(Request $request, LinkType $linkType): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); @@ -241,8 +241,8 @@ class LinkTypeController extends Controller * @param LinkTypeRequest $request * @param LinkType $linkType * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function update(LinkTypeRequest $request, LinkType $linkType): JsonResponse { diff --git a/app/Api/V1/Controllers/PiggyBankController.php b/app/Api/V1/Controllers/PiggyBankController.php index 82997c3e3d..a9a153315e 100644 --- a/app/Api/V1/Controllers/PiggyBankController.php +++ b/app/Api/V1/Controllers/PiggyBankController.php @@ -93,7 +93,7 @@ class PiggyBankController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getPiggyBanks(); @@ -126,7 +126,7 @@ class PiggyBankController extends Controller public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse { // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $manager = $this->getManager(); $collection = $this->repository->getEvents($piggyBank); @@ -175,13 +175,13 @@ class PiggyBankController extends Controller * * @param PiggyBankRequest $request * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function store(PiggyBankRequest $request): JsonResponse { $piggyBank = $this->repository->store($request->getAll()); - $manager = $this->getManager(); + $manager = $this->getManager(); /** @var PiggyBankTransformer $transformer */ $transformer = app(PiggyBankTransformer::class); diff --git a/app/Api/V1/Controllers/PreferenceController.php b/app/Api/V1/Controllers/PreferenceController.php index 9f3a77b717..2210e5810f 100644 --- a/app/Api/V1/Controllers/PreferenceController.php +++ b/app/Api/V1/Controllers/PreferenceController.php @@ -147,10 +147,10 @@ class PreferenceController extends Controller $newValue = explode(',', $data['data']); break; case 'listPageSize': - $newValue = (int)$data['data']; + $newValue = (int) $data['data']; break; case 'customFiscalYear': - $newValue = 1 === (int)$data['data']; + $newValue = 1 === (int) $data['data']; break; } $result = app('preferences')->set($preference->name, $newValue); diff --git a/app/Api/V1/Controllers/RecurrenceController.php b/app/Api/V1/Controllers/RecurrenceController.php index fe117ec662..f2a0f1fbf9 100644 --- a/app/Api/V1/Controllers/RecurrenceController.php +++ b/app/Api/V1/Controllers/RecurrenceController.php @@ -99,7 +99,7 @@ class RecurrenceController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getAll(); @@ -149,8 +149,8 @@ class RecurrenceController extends Controller * * @param RecurrenceStoreRequest $request * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function store(RecurrenceStoreRequest $request): JsonResponse { @@ -178,7 +178,7 @@ class RecurrenceController extends Controller */ public function transactions(Request $request, Recurrence $recurrence): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); @@ -224,9 +224,9 @@ class RecurrenceController extends Controller } /** - * @return JsonResponse * @throws FireflyException * @codeCoverageIgnore + * @return JsonResponse */ public function trigger(): JsonResponse { diff --git a/app/Api/V1/Controllers/RuleController.php b/app/Api/V1/Controllers/RuleController.php index 5dce97e5e4..e1ef261a33 100644 --- a/app/Api/V1/Controllers/RuleController.php +++ b/app/Api/V1/Controllers/RuleController.php @@ -105,7 +105,7 @@ class RuleController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->ruleRepository->getAll(); @@ -214,12 +214,12 @@ class RuleController extends Controller * @param RuleTestRequest $request * @param Rule $rule * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function testRule(RuleTestRequest $request, Rule $rule): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $parameters = $request->getTestParameters(); /** @var Rule $rule */ Log::debug(sprintf('Now testing rule #%d, "%s"', $rule->id, $rule->title)); diff --git a/app/Api/V1/Controllers/RuleGroupController.php b/app/Api/V1/Controllers/RuleGroupController.php index a8801f1814..8e8212fde5 100644 --- a/app/Api/V1/Controllers/RuleGroupController.php +++ b/app/Api/V1/Controllers/RuleGroupController.php @@ -106,7 +106,7 @@ class RuleGroupController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of rule groups. Count it and split it. $collection = $this->ruleGroupRepository->get(); @@ -177,7 +177,7 @@ class RuleGroupController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->ruleGroupRepository->getRules($group); @@ -246,13 +246,13 @@ class RuleGroupController extends Controller * @param RuleGroupTestRequest $request * @param RuleGroup $group * - * @return JsonResponse * @throws FireflyException * + * @return JsonResponse */ public function testGroup(RuleGroupTestRequest $request, RuleGroup $group): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; Log::debug('Now in testGroup()'); /** @var Collection $rules */ $rules = $this->ruleGroupRepository->getActiveRules($group); @@ -305,8 +305,8 @@ class RuleGroupController extends Controller * @param RuleGroupTriggerRequest $request * @param RuleGroup $group * - * @return JsonResponse * @throws Exception + * @return JsonResponse */ public function triggerGroup(RuleGroupTriggerRequest $request, RuleGroup $group): JsonResponse { diff --git a/app/Api/V1/Controllers/Search/TransferController.php b/app/Api/V1/Controllers/Search/TransferController.php index 1fac6ba6f6..38d29e0a0f 100644 --- a/app/Api/V1/Controllers/Search/TransferController.php +++ b/app/Api/V1/Controllers/Search/TransferController.php @@ -79,7 +79,7 @@ class TransferController extends Controller } // collector to return results. - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $manager = $this->getManager(); /** @var User $admin */ $admin = auth()->user(); diff --git a/app/Api/V1/Controllers/SummaryController.php b/app/Api/V1/Controllers/SummaryController.php index ca148ffab4..a401ef1fe1 100644 --- a/app/Api/V1/Controllers/SummaryController.php +++ b/app/Api/V1/Controllers/SummaryController.php @@ -96,8 +96,8 @@ class SummaryController extends Controller /** * @param DateRequest $request * - * @return JsonResponse * @throws Exception + * @return JsonResponse */ public function basic(DateRequest $request): JsonResponse { @@ -176,7 +176,7 @@ class SummaryController extends Controller $set = $collector->getExtractedJournals(); /** @var array $transactionJournal */ foreach ($set as $transactionJournal) { - $currencyId = (int)$transactionJournal['currency_id']; + $currencyId = (int) $transactionJournal['currency_id']; $incomes[$currencyId] = $incomes[$currencyId] ?? '0'; $incomes[$currencyId] = bcadd($incomes[$currencyId], bcmul($transactionJournal['amount'], '-1')); $sums[$currencyId] = $sums[$currencyId] ?? '0'; @@ -198,7 +198,7 @@ class SummaryController extends Controller /** @var array $transactionJournal */ foreach ($set as $transactionJournal) { - $currencyId = (int)$transactionJournal['currency_id']; + $currencyId = (int) $transactionJournal['currency_id']; $expenses[$currencyId] = $expenses[$currencyId] ?? '0'; $expenses[$currencyId] = bcadd($expenses[$currencyId], $transactionJournal['amount']); $sums[$currencyId] = $sums[$currencyId] ?? '0'; @@ -272,7 +272,7 @@ class SummaryController extends Controller $return = []; foreach ($paidAmount as $currencyId => $amount) { $amount = bcmul($amount, '-1'); - $currency = $this->currencyRepos->findNull((int)$currencyId); + $currency = $this->currencyRepos->findNull((int) $currencyId); if (null === $currency) { continue; } @@ -292,7 +292,7 @@ class SummaryController extends Controller foreach ($unpaidAmount as $currencyId => $amount) { $amount = bcmul($amount, '-1'); - $currency = $this->currencyRepos->findNull((int)$currencyId); + $currency = $this->currencyRepos->findNull((int) $currencyId); if (null === $currency) { continue; } @@ -317,8 +317,8 @@ class SummaryController extends Controller * @param Carbon $start * @param Carbon $end * - * @return array * @throws Exception + * @return array */ private function getLeftToSpendInfo(Carbon $start, Carbon $end): array { @@ -337,7 +337,7 @@ class SummaryController extends Controller $days = $today->diffInDays($end) + 1; $perDay = '0'; if (0 !== $days && bccomp($leftToSpend, '0') > -1) { - $perDay = bcdiv($leftToSpend, (string)$days); + $perDay = bcdiv($leftToSpend, (string) $days); } $return[] = [ @@ -350,7 +350,7 @@ class SummaryController extends Controller 'currency_decimal_places' => $row['currency_decimal_places'], 'value_parsed' => app('amount')->formatFlat($row['currency_symbol'], $row['currency_decimal_places'], $leftToSpend, false), 'local_icon' => 'money', - 'sub_title' => (string)trans( + 'sub_title' => (string) trans( 'firefly.box_spend_per_day', ['amount' => app('amount')->formatFlat( $row['currency_symbol'], @@ -361,6 +361,7 @@ class SummaryController extends Controller ), ]; } + return $return; } diff --git a/app/Api/V1/Controllers/TagController.php b/app/Api/V1/Controllers/TagController.php index 339c3ea9f9..eb60351a51 100644 --- a/app/Api/V1/Controllers/TagController.php +++ b/app/Api/V1/Controllers/TagController.php @@ -25,8 +25,8 @@ namespace FireflyIII\Api\V1\Controllers; use Carbon\Carbon; use FireflyIII\Api\V1\Requests\DateRequest; -use FireflyIII\Api\V1\Requests\TagUpdateRequest; use FireflyIII\Api\V1\Requests\TagStoreRequest; +use FireflyIII\Api\V1\Requests\TagUpdateRequest; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Tag; use FireflyIII\Repositories\Tag\TagRepositoryInterface; @@ -117,7 +117,7 @@ class TagController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->get(); @@ -190,7 +190,7 @@ class TagController extends Controller */ public function transactions(Request $request, Tag $tag): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); @@ -236,7 +236,7 @@ class TagController extends Controller * Update a rule. * * @param TagUpdateRequest $request - * @param Tag $tag + * @param Tag $tag * * @return JsonResponse */ @@ -288,8 +288,8 @@ class TagController extends Controller ]; /** @var Tag $tag */ foreach ($tags as $tag) { - $earned = (float)$this->repository->earnedInPeriod($tag, $start, $end); - $spent = (float)$this->repository->spentInPeriod($tag, $start, $end); + $earned = (float) $this->repository->earnedInPeriod($tag, $start, $end); + $spent = (float) $this->repository->spentInPeriod($tag, $start, $end); $size = ($spent * -1) + $earned; $min = $min ?? $size; if ($size > 0) { diff --git a/app/Api/V1/Controllers/TransactionController.php b/app/Api/V1/Controllers/TransactionController.php index 1cb04d03bf..717598f32f 100644 --- a/app/Api/V1/Controllers/TransactionController.php +++ b/app/Api/V1/Controllers/TransactionController.php @@ -152,7 +152,7 @@ class TransactionController extends Controller */ public function index(Request $request): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); @@ -302,7 +302,7 @@ class TransactionController extends Controller $response = [ 'message' => 'The given data was invalid.', 'errors' => [ - 'transactions.0.description' => [sprintf('Internal exception: %s', $e->getMessage())] + 'transactions.0.description' => [sprintf('Internal exception: %s', $e->getMessage())], ], ]; diff --git a/app/Api/V1/Controllers/TransactionLinkController.php b/app/Api/V1/Controllers/TransactionLinkController.php index 347e518172..d5079548b1 100644 --- a/app/Api/V1/Controllers/TransactionLinkController.php +++ b/app/Api/V1/Controllers/TransactionLinkController.php @@ -105,7 +105,7 @@ class TransactionLinkController extends Controller $name = $request->get('name'); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $linkType = $this->repository->findByName($name); // get list of transaction links. Count it and split it. @@ -155,8 +155,8 @@ class TransactionLinkController extends Controller * * @param TransactionLinkRequest $request * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function store(TransactionLinkRequest $request): JsonResponse { @@ -186,8 +186,8 @@ class TransactionLinkController extends Controller * @param TransactionLinkRequest $request * @param TransactionJournalLink $journalLink * - * @return JsonResponse * @throws FireflyException + * @return JsonResponse */ public function update(TransactionLinkRequest $request, TransactionJournalLink $journalLink): JsonResponse { diff --git a/app/Api/V1/Controllers/UserController.php b/app/Api/V1/Controllers/UserController.php index b9908cba11..5fc610c7f3 100644 --- a/app/Api/V1/Controllers/UserController.php +++ b/app/Api/V1/Controllers/UserController.php @@ -70,9 +70,9 @@ class UserController extends Controller * * @param User $user * - * @return JsonResponse * @throws FireflyException * @codeCoverageIgnore + * @return JsonResponse */ public function delete(User $user): JsonResponse { @@ -95,7 +95,7 @@ class UserController extends Controller public function index(): JsonResponse { // user preferences - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $manager = $this->getManager(); // build collection diff --git a/app/Api/V1/Requests/AccountStoreRequest.php b/app/Api/V1/Requests/AccountStoreRequest.php index a2f1c843fd..e8fb256056 100644 --- a/app/Api/V1/Requests/AccountStoreRequest.php +++ b/app/Api/V1/Requests/AccountStoreRequest.php @@ -126,7 +126,7 @@ class AccountStoreRequest extends Request 'interest_period' => 'required_if:type,liability|in:daily,monthly,yearly', 'notes' => 'min:0|max:65536', ]; - $rules = Location::requestRules($rules); + $rules = Location::requestRules($rules); return $rules; } diff --git a/app/Api/V1/Requests/AccountUpdateRequest.php b/app/Api/V1/Requests/AccountUpdateRequest.php index bb4b453da3..182ddf9753 100644 --- a/app/Api/V1/Requests/AccountUpdateRequest.php +++ b/app/Api/V1/Requests/AccountUpdateRequest.php @@ -105,7 +105,7 @@ class AccountUpdateRequest extends Request $types = implode(',', array_keys(config('firefly.subTitlesByIdentifier'))); $ccPaymentTypes = implode(',', array_keys(config('firefly.ccTypes'))); - $rules = [ + $rules = [ 'name' => sprintf('min:1|uniqueAccountForUser:%d', $account->id), 'type' => sprintf('in:%s', $types), 'iban' => 'iban|nullable', diff --git a/app/Api/V1/Requests/BillRequest.php b/app/Api/V1/Requests/BillRequest.php index 16bdefd292..ca0ee49a2a 100644 --- a/app/Api/V1/Requests/BillRequest.php +++ b/app/Api/V1/Requests/BillRequest.php @@ -119,10 +119,10 @@ class BillRequest extends Request $validator->after( static function (Validator $validator) { $data = $validator->getData(); - $min = (float)($data['amount_min'] ?? 0); - $max = (float)($data['amount_max'] ?? 0); + $min = (float) ($data['amount_min'] ?? 0); + $max = (float) ($data['amount_max'] ?? 0); if ($min > $max) { - $validator->errors()->add('amount_min', (string)trans('validation.amount_min_over_max')); + $validator->errors()->add('amount_min', (string) trans('validation.amount_min_over_max')); } } ); diff --git a/app/Api/V1/Requests/RecurrenceStoreRequest.php b/app/Api/V1/Requests/RecurrenceStoreRequest.php index f5a399f76f..8b946fbb61 100644 --- a/app/Api/V1/Requests/RecurrenceStoreRequest.php +++ b/app/Api/V1/Requests/RecurrenceStoreRequest.php @@ -167,8 +167,8 @@ class RecurrenceStoreRequest extends Request $return[] = [ 'type' => $repetition['type'], 'moment' => $repetition['moment'], - 'skip' => (int)$repetition['skip'], - 'weekend' => (int)$repetition['weekend'], + 'skip' => (int) $repetition['skip'], + 'weekend' => (int) $repetition['weekend'], ]; } @@ -194,25 +194,25 @@ class RecurrenceStoreRequest extends Request foreach ($transactions as $transaction) { $return[] = [ 'amount' => $transaction['amount'], - 'currency_id' => isset($transaction['currency_id']) ? (int)$transaction['currency_id'] : null, + 'currency_id' => isset($transaction['currency_id']) ? (int) $transaction['currency_id'] : null, 'currency_code' => $transaction['currency_code'] ?? null, 'foreign_amount' => $transaction['foreign_amount'] ?? null, - 'foreign_currency_id' => isset($transaction['foreign_currency_id']) ? (int)$transaction['foreign_currency_id'] : null, + 'foreign_currency_id' => isset($transaction['foreign_currency_id']) ? (int) $transaction['foreign_currency_id'] : null, 'foreign_currency_code' => $transaction['foreign_currency_code'] ?? null, - 'source_id' => isset($transaction['source_id']) ? (int)$transaction['source_id'] : null, - 'source_name' => isset($transaction['source_name']) ? (string)$transaction['source_name'] : null, - 'destination_id' => isset($transaction['destination_id']) ? (int)$transaction['destination_id'] : null, - 'destination_name' => isset($transaction['destination_name']) ? (string)$transaction['destination_name'] : null, + 'source_id' => isset($transaction['source_id']) ? (int) $transaction['source_id'] : null, + 'source_name' => isset($transaction['source_name']) ? (string) $transaction['source_name'] : null, + 'destination_id' => isset($transaction['destination_id']) ? (int) $transaction['destination_id'] : null, + 'destination_name' => isset($transaction['destination_name']) ? (string) $transaction['destination_name'] : null, 'description' => $transaction['description'], 'type' => $this->string('type'), // new and updated fields: - 'piggy_bank_id' => isset($transaction['piggy_bank_id']) ? (int)$transaction['piggy_bank_id'] : null, + 'piggy_bank_id' => isset($transaction['piggy_bank_id']) ? (int) $transaction['piggy_bank_id'] : null, 'piggy_bank_name' => $transaction['piggy_bank_name'] ?? null, 'tags' => $transaction['tags'] ?? [], - 'budget_id' => isset($transaction['budget_id']) ? (int)$transaction['budget_id'] : null, + 'budget_id' => isset($transaction['budget_id']) ? (int) $transaction['budget_id'] : null, 'budget_name' => $transaction['budget_name'] ?? null, - 'category_id' => isset($transaction['category_id']) ? (int)$transaction['category_id'] : null, + 'category_id' => isset($transaction['category_id']) ? (int) $transaction['category_id'] : null, 'category_name' => $transaction['category_name'] ?? null, ]; } diff --git a/app/Api/V1/Requests/RecurrenceUpdateRequest.php b/app/Api/V1/Requests/RecurrenceUpdateRequest.php index 0b15f6884d..72b169f18b 100644 --- a/app/Api/V1/Requests/RecurrenceUpdateRequest.php +++ b/app/Api/V1/Requests/RecurrenceUpdateRequest.php @@ -169,8 +169,8 @@ class RecurrenceUpdateRequest extends Request $return[] = [ 'type' => $repetition['type'], 'moment' => $repetition['moment'], - 'skip' => (int)$repetition['skip'], - 'weekend' => (int)$repetition['weekend'], + 'skip' => (int) $repetition['skip'], + 'weekend' => (int) $repetition['weekend'], ]; } @@ -186,25 +186,25 @@ class RecurrenceUpdateRequest extends Request { return [ 'amount' => $transaction['amount'], - 'currency_id' => isset($transaction['currency_id']) ? (int)$transaction['currency_id'] : null, + 'currency_id' => isset($transaction['currency_id']) ? (int) $transaction['currency_id'] : null, 'currency_code' => $transaction['currency_code'] ?? null, 'foreign_amount' => $transaction['foreign_amount'] ?? null, - 'foreign_currency_id' => isset($transaction['foreign_currency_id']) ? (int)$transaction['foreign_currency_id'] : null, + 'foreign_currency_id' => isset($transaction['foreign_currency_id']) ? (int) $transaction['foreign_currency_id'] : null, 'foreign_currency_code' => $transaction['foreign_currency_code'] ?? null, - 'source_id' => isset($transaction['source_id']) ? (int)$transaction['source_id'] : null, - 'source_name' => isset($transaction['source_name']) ? (string)$transaction['source_name'] : null, - 'destination_id' => isset($transaction['destination_id']) ? (int)$transaction['destination_id'] : null, - 'destination_name' => isset($transaction['destination_name']) ? (string)$transaction['destination_name'] : null, + 'source_id' => isset($transaction['source_id']) ? (int) $transaction['source_id'] : null, + 'source_name' => isset($transaction['source_name']) ? (string) $transaction['source_name'] : null, + 'destination_id' => isset($transaction['destination_id']) ? (int) $transaction['destination_id'] : null, + 'destination_name' => isset($transaction['destination_name']) ? (string) $transaction['destination_name'] : null, 'description' => $transaction['description'], 'type' => $this->string('type'), // new and updated fields: - 'piggy_bank_id' => isset($transaction['piggy_bank_id']) ? (int)$transaction['piggy_bank_id'] : null, + 'piggy_bank_id' => isset($transaction['piggy_bank_id']) ? (int) $transaction['piggy_bank_id'] : null, 'piggy_bank_name' => $transaction['piggy_bank_name'] ?? null, 'tags' => $transaction['tags'] ?? [], - 'budget_id' => isset($transaction['budget_id']) ? (int)$transaction['budget_id'] : null, + 'budget_id' => isset($transaction['budget_id']) ? (int) $transaction['budget_id'] : null, 'budget_name' => $transaction['budget_name'] ?? null, - 'category_id' => isset($transaction['category_id']) ? (int)$transaction['category_id'] : null, + 'category_id' => isset($transaction['category_id']) ? (int) $transaction['category_id'] : null, 'category_name' => $transaction['category_name'] ?? null, ]; } diff --git a/app/Api/V1/Requests/RuleGroupTestRequest.php b/app/Api/V1/Requests/RuleGroupTestRequest.php index 34f975217b..bdd01747c4 100644 --- a/app/Api/V1/Requests/RuleGroupTestRequest.php +++ b/app/Api/V1/Requests/RuleGroupTestRequest.php @@ -77,7 +77,7 @@ class RuleGroupTestRequest extends Request */ private function getAccounts(): Collection { - $accountList = '' === (string)$this->query('accounts') ? [] : explode(',', $this->query('accounts')); + $accountList = '' === (string) $this->query('accounts') ? [] : explode(',', $this->query('accounts')); $accounts = new Collection; /** @var AccountRepositoryInterface $accountRepository */ @@ -85,7 +85,7 @@ class RuleGroupTestRequest extends Request foreach ($accountList as $accountId) { Log::debug(sprintf('Searching for asset account with id "%s"', $accountId)); - $account = $accountRepository->findNull((int)$accountId); + $account = $accountRepository->findNull((int) $accountId); if ($this->validAccount($account)) { /** @noinspection NullPointerExceptionInspection */ Log::debug(sprintf('Found account #%d ("%s") and its an asset account', $account->id, $account->name)); @@ -114,7 +114,7 @@ class RuleGroupTestRequest extends Request */ private function getPage(): int { - return 0 === (int)$this->query('page') ? 1 : (int)$this->query('page'); + return 0 === (int) $this->query('page') ? 1 : (int) $this->query('page'); } @@ -123,7 +123,7 @@ class RuleGroupTestRequest extends Request */ private function getSearchLimit(): int { - return 0 === (int)$this->query('search_limit') ? (int)config('firefly.test-triggers.limit') : (int)$this->query('search_limit'); + return 0 === (int) $this->query('search_limit') ? (int) config('firefly.test-triggers.limit') : (int) $this->query('search_limit'); } /** @@ -131,7 +131,7 @@ class RuleGroupTestRequest extends Request */ private function getTriggerLimit(): int { - return 0 === (int)$this->query('triggered_limit') ? (int)config('firefly.test-triggers.range') : (int)$this->query('triggered_limit'); + return 0 === (int) $this->query('triggered_limit') ? (int) config('firefly.test-triggers.range') : (int) $this->query('triggered_limit'); } /** diff --git a/app/Api/V1/Requests/RuleGroupTriggerRequest.php b/app/Api/V1/Requests/RuleGroupTriggerRequest.php index 059eede3be..6672fcc35e 100644 --- a/app/Api/V1/Requests/RuleGroupTriggerRequest.php +++ b/app/Api/V1/Requests/RuleGroupTriggerRequest.php @@ -77,7 +77,7 @@ class RuleGroupTriggerRequest extends Request */ private function getAccounts(): Collection { - $accountList = '' === (string)$this->query('accounts') ? [] : explode(',', $this->query('accounts')); + $accountList = '' === (string) $this->query('accounts') ? [] : explode(',', $this->query('accounts')); $accounts = new Collection; /** @var AccountRepositoryInterface $accountRepository */ @@ -85,7 +85,7 @@ class RuleGroupTriggerRequest extends Request foreach ($accountList as $accountId) { Log::debug(sprintf('Searching for asset account with id "%s"', $accountId)); - $account = $accountRepository->findNull((int)$accountId); + $account = $accountRepository->findNull((int) $accountId); if ($this->validAccount($account)) { /** @noinspection NullPointerExceptionInspection */ Log::debug(sprintf('Found account #%d ("%s") and its an asset account', $account->id, $account->name)); diff --git a/app/Api/V1/Requests/RuleStoreRequest.php b/app/Api/V1/Requests/RuleStoreRequest.php index 5c275c60d7..bdbac61824 100644 --- a/app/Api/V1/Requests/RuleStoreRequest.php +++ b/app/Api/V1/Requests/RuleStoreRequest.php @@ -141,7 +141,7 @@ class RuleStoreRequest extends Request $actions = $data['actions'] ?? []; // need at least one trigger if (0 === count($actions)) { - $validator->errors()->add('title', (string)trans('validation.at_least_one_action')); + $validator->errors()->add('title', (string) trans('validation.at_least_one_action')); } } @@ -156,7 +156,7 @@ class RuleStoreRequest extends Request $triggers = $data['triggers'] ?? []; // need at least one trigger if (0 === count($triggers)) { - $validator->errors()->add('title', (string)trans('validation.at_least_one_trigger')); + $validator->errors()->add('title', (string) trans('validation.at_least_one_trigger')); } } @@ -172,8 +172,8 @@ class RuleStoreRequest extends Request $return[] = [ 'type' => $action['type'], 'value' => $action['value'], - 'active' => $this->convertBoolean((string)($action['active'] ?? 'false')), - 'stop_processing' => $this->convertBoolean((string)($action['stop_processing'] ?? 'false')), + 'active' => $this->convertBoolean((string) ($action['active'] ?? 'false')), + 'stop_processing' => $this->convertBoolean((string) ($action['stop_processing'] ?? 'false')), ]; } } @@ -193,8 +193,8 @@ class RuleStoreRequest extends Request $return[] = [ 'type' => $trigger['type'], 'value' => $trigger['value'], - 'active' => $this->convertBoolean((string)($trigger['active'] ?? 'false')), - 'stop_processing' => $this->convertBoolean((string)($trigger['stop_processing'] ?? 'false')), + 'active' => $this->convertBoolean((string) ($trigger['active'] ?? 'false')), + 'stop_processing' => $this->convertBoolean((string) ($trigger['stop_processing'] ?? 'false')), ]; } } diff --git a/app/Api/V1/Requests/RuleTestRequest.php b/app/Api/V1/Requests/RuleTestRequest.php index ff481c33d0..e506ce9d81 100644 --- a/app/Api/V1/Requests/RuleTestRequest.php +++ b/app/Api/V1/Requests/RuleTestRequest.php @@ -77,7 +77,7 @@ class RuleTestRequest extends Request */ private function getAccounts(): Collection { - $accountList = '' === (string)$this->query('accounts') ? [] : explode(',', $this->query('accounts')); + $accountList = '' === (string) $this->query('accounts') ? [] : explode(',', $this->query('accounts')); $accounts = new Collection; /** @var AccountRepositoryInterface $accountRepository */ @@ -85,7 +85,7 @@ class RuleTestRequest extends Request foreach ($accountList as $accountId) { Log::debug(sprintf('Searching for asset account with id "%s"', $accountId)); - $account = $accountRepository->findNull((int)$accountId); + $account = $accountRepository->findNull((int) $accountId); if ($this->validAccount($account)) { /** @noinspection NullPointerExceptionInspection */ Log::debug(sprintf('Found account #%d ("%s") and its an asset account', $account->id, $account->name)); @@ -114,7 +114,7 @@ class RuleTestRequest extends Request */ private function getPage(): int { - return 0 === (int)$this->query('page') ? 1 : (int)$this->query('page'); + return 0 === (int) $this->query('page') ? 1 : (int) $this->query('page'); } @@ -123,7 +123,7 @@ class RuleTestRequest extends Request */ private function getSearchLimit(): int { - return 0 === (int)$this->query('search_limit') ? (int)config('firefly.test-triggers.limit') : (int)$this->query('search_limit'); + return 0 === (int) $this->query('search_limit') ? (int) config('firefly.test-triggers.limit') : (int) $this->query('search_limit'); } /** @@ -131,7 +131,7 @@ class RuleTestRequest extends Request */ private function getTriggerLimit(): int { - return 0 === (int)$this->query('triggered_limit') ? (int)config('firefly.test-triggers.range') : (int)$this->query('triggered_limit'); + return 0 === (int) $this->query('triggered_limit') ? (int) config('firefly.test-triggers.range') : (int) $this->query('triggered_limit'); } /** diff --git a/app/Api/V1/Requests/RuleTriggerRequest.php b/app/Api/V1/Requests/RuleTriggerRequest.php index 28a2cd9c04..d05f4f7dfe 100644 --- a/app/Api/V1/Requests/RuleTriggerRequest.php +++ b/app/Api/V1/Requests/RuleTriggerRequest.php @@ -76,7 +76,7 @@ class RuleTriggerRequest extends Request */ private function getAccounts(): Collection { - $accountList = '' === (string)$this->query('accounts') ? [] : explode(',', $this->query('accounts')); + $accountList = '' === (string) $this->query('accounts') ? [] : explode(',', $this->query('accounts')); $accounts = new Collection; /** @var AccountRepositoryInterface $accountRepository */ @@ -84,7 +84,7 @@ class RuleTriggerRequest extends Request foreach ($accountList as $accountId) { Log::debug(sprintf('Searching for asset account with id "%s"', $accountId)); - $account = $accountRepository->findNull((int)$accountId); + $account = $accountRepository->findNull((int) $accountId); if ($this->validAccount($account)) { /** @noinspection NullPointerExceptionInspection */ Log::debug(sprintf('Found account #%d ("%s") and its an asset account', $account->id, $account->name)); diff --git a/app/Api/V1/Requests/RuleUpdateRequest.php b/app/Api/V1/Requests/RuleUpdateRequest.php index d8c73d915d..e1f8186883 100644 --- a/app/Api/V1/Requests/RuleUpdateRequest.php +++ b/app/Api/V1/Requests/RuleUpdateRequest.php @@ -142,7 +142,7 @@ class RuleUpdateRequest extends Request $actions = $data['actions'] ?? null; // need at least one action if (is_array($actions) && 0 === count($actions)) { - $validator->errors()->add('title', (string)trans('validation.at_least_one_action')); + $validator->errors()->add('title', (string) trans('validation.at_least_one_action')); } } @@ -157,7 +157,7 @@ class RuleUpdateRequest extends Request $triggers = $data['triggers'] ?? null; // need at least one trigger if (is_array($triggers) && 0 === count($triggers)) { - $validator->errors()->add('title', (string)trans('validation.at_least_one_trigger')); + $validator->errors()->add('title', (string) trans('validation.at_least_one_trigger')); } } @@ -176,8 +176,8 @@ class RuleUpdateRequest extends Request $return[] = [ 'type' => $action['type'], 'value' => $action['value'], - 'active' => $this->convertBoolean((string)($action['active'] ?? 'false')), - 'stop_processing' => $this->convertBoolean((string)($action['stop_processing'] ?? 'false')), + 'active' => $this->convertBoolean((string) ($action['active'] ?? 'false')), + 'stop_processing' => $this->convertBoolean((string) ($action['stop_processing'] ?? 'false')), ]; } } @@ -200,8 +200,8 @@ class RuleUpdateRequest extends Request $return[] = [ 'type' => $trigger['type'], 'value' => $trigger['value'], - 'active' => $this->convertBoolean((string)($trigger['active'] ?? 'false')), - 'stop_processing' => $this->convertBoolean((string)($trigger['stop_processing'] ?? 'false')), + 'active' => $this->convertBoolean((string) ($trigger['active'] ?? 'false')), + 'stop_processing' => $this->convertBoolean((string) ($trigger['stop_processing'] ?? 'false')), ]; } } diff --git a/app/Api/V1/Requests/TransactionLinkRequest.php b/app/Api/V1/Requests/TransactionLinkRequest.php index 8cf4094318..9086c2cdd5 100644 --- a/app/Api/V1/Requests/TransactionLinkRequest.php +++ b/app/Api/V1/Requests/TransactionLinkRequest.php @@ -110,8 +110,8 @@ class TransactionLinkRequest extends Request $journalRepos->setUser($user); $data = $validator->getData(); - $inwardId = (int)($data['inward_id'] ?? 0); - $outwardId = (int)($data['outward_id'] ?? 0); + $inwardId = (int) ($data['inward_id'] ?? 0); + $outwardId = (int) ($data['outward_id'] ?? 0); $inward = $journalRepos->findNull($inwardId); $outward = $journalRepos->findNull($outwardId); diff --git a/app/Api/V1/Requests/TransactionStoreRequest.php b/app/Api/V1/Requests/TransactionStoreRequest.php index 9d34e8ac0c..5315c3c22a 100644 --- a/app/Api/V1/Requests/TransactionStoreRequest.php +++ b/app/Api/V1/Requests/TransactionStoreRequest.php @@ -212,63 +212,63 @@ class TransactionStoreRequest extends Request $return[] = [ 'type' => $this->stringFromValue($object['type']), 'date' => $this->dateFromValue($object['date']), - 'order' => $this->integerFromValue((string)$object['order']), + 'order' => $this->integerFromValue((string) $object['order']), - 'currency_id' => $this->integerFromValue((string)$object['currency_id']), + 'currency_id' => $this->integerFromValue((string) $object['currency_id']), 'currency_code' => $this->stringFromValue($object['currency_code']), // foreign currency info: - 'foreign_currency_id' => $this->integerFromValue((string)$object['foreign_currency_id']), + 'foreign_currency_id' => $this->integerFromValue((string) $object['foreign_currency_id']), 'foreign_currency_code' => $this->stringFromValue($object['foreign_currency_code']), // amount and foreign amount. Cannot be 0. - 'amount' => $this->stringFromValue((string)$object['amount']), - 'foreign_amount' => $this->stringFromValue((string)$object['foreign_amount']), + 'amount' => $this->stringFromValue((string) $object['amount']), + 'foreign_amount' => $this->stringFromValue((string) $object['foreign_amount']), // description. 'description' => $this->stringFromValue($object['description']), // source of transaction. If everything is null, assume cash account. - 'source_id' => $this->integerFromValue((string)$object['source_id']), + 'source_id' => $this->integerFromValue((string) $object['source_id']), 'source_name' => $this->stringFromValue($object['source_name']), 'source_iban' => $this->stringFromValue($object['source_iban']), 'source_number' => $this->stringFromValue($object['source_number']), 'source_bic' => $this->stringFromValue($object['source_bic']), // destination of transaction. If everything is null, assume cash account. - 'destination_id' => $this->integerFromValue((string)$object['destination_id']), + 'destination_id' => $this->integerFromValue((string) $object['destination_id']), 'destination_name' => $this->stringFromValue($object['destination_name']), 'destination_iban' => $this->stringFromValue($object['destination_iban']), 'destination_number' => $this->stringFromValue($object['destination_number']), 'destination_bic' => $this->stringFromValue($object['destination_bic']), // budget info - 'budget_id' => $this->integerFromValue((string)$object['budget_id']), + 'budget_id' => $this->integerFromValue((string) $object['budget_id']), 'budget_name' => $this->stringFromValue($object['budget_name']), // category info - 'category_id' => $this->integerFromValue((string)$object['category_id']), + 'category_id' => $this->integerFromValue((string) $object['category_id']), 'category_name' => $this->stringFromValue($object['category_name']), // journal bill reference. Optional. Will only work for withdrawals - 'bill_id' => $this->integerFromValue((string)$object['bill_id']), + 'bill_id' => $this->integerFromValue((string) $object['bill_id']), 'bill_name' => $this->stringFromValue($object['bill_name']), // piggy bank reference. Optional. Will only work for transfers - 'piggy_bank_id' => $this->integerFromValue((string)$object['piggy_bank_id']), + 'piggy_bank_id' => $this->integerFromValue((string) $object['piggy_bank_id']), 'piggy_bank_name' => $this->stringFromValue($object['piggy_bank_name']), // some other interesting properties - 'reconciled' => $this->convertBoolean((string)$object['reconciled']), + 'reconciled' => $this->convertBoolean((string) $object['reconciled']), 'notes' => $this->nlStringFromValue($object['notes']), 'tags' => $this->arrayFromValue($object['tags']), // all custom fields: - 'internal_reference' => $this->stringFromValue((string)$object['internal_reference']), - 'external_id' => $this->stringFromValue((string)$object['external_id']), + 'internal_reference' => $this->stringFromValue((string) $object['internal_reference']), + 'external_id' => $this->stringFromValue((string) $object['external_id']), 'original_source' => sprintf('ff3-v%s|api-v%s', config('firefly.version'), config('firefly.api_version')), 'recurrence_id' => $this->integerFromValue($object['recurrence_id']), - 'bunq_payment_id' => $this->stringFromValue((string)$object['bunq_payment_id']), + 'bunq_payment_id' => $this->stringFromValue((string) $object['bunq_payment_id']), 'sepa_cc' => $this->stringFromValue($object['sepa_cc']), 'sepa_ct_op' => $this->stringFromValue($object['sepa_ct_op']), diff --git a/app/Api/V1/Requests/TransactionUpdateRequest.php b/app/Api/V1/Requests/TransactionUpdateRequest.php index 11ccc8598a..045ff11a3e 100644 --- a/app/Api/V1/Requests/TransactionUpdateRequest.php +++ b/app/Api/V1/Requests/TransactionUpdateRequest.php @@ -297,33 +297,33 @@ class TransactionUpdateRequest extends Request // for each field, add it to the array if a reference is present in the request: foreach ($this->integerFields as $fieldName) { if (array_key_exists($fieldName, $transaction)) { - $current[$fieldName] = $this->integerFromValue((string)$transaction[$fieldName]); + $current[$fieldName] = $this->integerFromValue((string) $transaction[$fieldName]); } } foreach ($this->stringFields as $fieldName) { if (array_key_exists($fieldName, $transaction)) { - $current[$fieldName] = $this->stringFromValue((string)$transaction[$fieldName]); + $current[$fieldName] = $this->stringFromValue((string) $transaction[$fieldName]); } } foreach ($this->textareaFields as $fieldName) { if (array_key_exists($fieldName, $transaction)) { - $current[$fieldName] = $this->nlStringFromValue((string)$transaction[$fieldName]); + $current[$fieldName] = $this->nlStringFromValue((string) $transaction[$fieldName]); } } foreach ($this->dateFields as $fieldName) { Log::debug(sprintf('Now at date field %s', $fieldName)); if (array_key_exists($fieldName, $transaction)) { - $current[$fieldName] = $this->dateFromValue((string)$transaction[$fieldName]); - Log::debug(sprintf('New value: "%s"', (string)$transaction[$fieldName])); + $current[$fieldName] = $this->dateFromValue((string) $transaction[$fieldName]); + Log::debug(sprintf('New value: "%s"', (string) $transaction[$fieldName])); } } foreach ($this->booleanFields as $fieldName) { if (array_key_exists($fieldName, $transaction)) { - $current[$fieldName] = $this->convertBoolean((string)$transaction[$fieldName]); + $current[$fieldName] = $this->convertBoolean((string) $transaction[$fieldName]); } } diff --git a/app/Api/V1/Requests/UserUpdateRequest.php b/app/Api/V1/Requests/UserUpdateRequest.php index ce85ead64f..7dc41b7806 100644 --- a/app/Api/V1/Requests/UserUpdateRequest.php +++ b/app/Api/V1/Requests/UserUpdateRequest.php @@ -85,7 +85,7 @@ class UserUpdateRequest extends Request */ public function rules(): array { - $user = $this->route()->parameter('user'); + $user = $this->route()->parameter('user'); return [ 'email' => sprintf('email|unique:users,email,%d', $user->id),