From d05a1e0260659469bea70e3e0e2e13739f38c634 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 8 Jul 2018 12:28:42 +0200 Subject: [PATCH] Specify return types. --- .../Account/ReconcileController.php | 5 +-- .../Admin/ConfigurationController.php | 4 +-- .../Auth/ForgotPasswordController.php | 3 +- .../Controllers/Auth/RegisterController.php | 14 ++++----- app/Http/Controllers/BillController.php | 13 ++++---- app/Http/Controllers/BudgetController.php | 14 +++++---- app/Http/Controllers/Chart/BillController.php | 9 +++--- .../Controllers/Chart/BudgetController.php | 31 ++++++++++--------- .../Chart/BudgetReportController.php | 13 ++++---- .../Controllers/Chart/CategoryController.php | 23 +++++++------- .../Chart/CategoryReportController.php | 21 +++++++------ .../Chart/ExpenseReportController.php | 5 +-- .../Controllers/Chart/PiggyBankController.php | 5 +-- .../Controllers/Chart/ReportController.php | 4 +-- .../Controllers/Chart/TagReportController.php | 29 ++++++++--------- app/Http/Controllers/Controller.php | 2 +- app/Http/Controllers/DebugController.php | 2 +- app/Http/Controllers/ExportController.php | 7 +++-- app/Http/Controllers/HelpController.php | 5 +-- app/Http/Controllers/HomeController.php | 5 +-- app/Http/Controllers/JavascriptController.php | 4 +-- .../Json/AutoCompleteController.php | 18 +++++------ app/Http/Controllers/Json/BoxController.php | 17 +++++----- .../Controllers/Json/ExchangeController.php | 5 +-- .../Controllers/Json/FrontpageController.php | 5 +-- app/Http/Controllers/Json/IntroController.php | 13 ++++---- app/Http/Controllers/JsonController.php | 9 +++--- app/Http/Controllers/PiggyBankController.php | 13 ++++---- .../Controllers/Popup/ReportController.php | 5 +-- .../Controllers/Report/CategoryController.php | 2 +- .../Controllers/Report/ExpenseController.php | 6 ++-- .../Report/OperationsController.php | 2 +- app/Http/Controllers/ReportController.php | 12 +++---- app/Http/Controllers/RuleController.php | 7 +++-- app/Http/Controllers/RuleGroupController.php | 5 +-- app/Http/Controllers/SearchController.php | 3 +- .../Controllers/System/InstallController.php | 2 +- app/Http/Controllers/TagController.php | 13 ++++---- .../Controllers/TransactionController.php | 2 +- app/Http/Middleware/Range.php | 8 ++--- app/Http/Middleware/StartFireflySession.php | 2 +- app/Http/Requests/AttachmentFormRequest.php | 4 +-- app/Http/Requests/BillFormRequest.php | 4 +-- app/Http/Requests/BudgetFormRequest.php | 4 +-- app/Http/Requests/BudgetIncomeRequest.php | 4 +-- app/Http/Requests/BulkEditJournalRequest.php | 4 +-- app/Http/Requests/CategoryFormRequest.php | 4 +-- app/Http/Requests/ConfigurationRequest.php | 4 +-- app/Http/Requests/CurrencyFormRequest.php | 6 ++-- .../Requests/DeleteAccountFormRequest.php | 4 +-- app/Http/Requests/EmailFormRequest.php | 4 +-- app/Http/Requests/ExportFormRequest.php | 4 +-- app/Http/Requests/JournalFormRequest.php | 6 ++-- app/Http/Requests/JournalLinkRequest.php | 4 +-- app/Http/Requests/LinkTypeFormRequest.php | 4 +-- .../Requests/MassDeleteJournalRequest.php | 4 +-- app/Http/Requests/MassEditJournalRequest.php | 4 +-- app/Http/Requests/NewUserFormRequest.php | 4 +-- app/Http/Requests/PiggyBankFormRequest.php | 4 +-- app/Http/Requests/ProfileFormRequest.php | 4 +-- .../Requests/ReconciliationUpdateRequest.php | 6 ++-- app/Http/Requests/ReportFormRequest.php | 2 +- app/Http/Requests/Request.php | 2 +- app/Http/Requests/RuleGroupFormRequest.php | 4 +-- .../Requests/SelectTransactionsRequest.php | 4 +-- app/Http/Requests/TagFormRequest.php | 2 +- app/Http/Requests/TestRuleFormRequest.php | 4 +-- app/Http/Requests/TokenFormRequest.php | 4 +-- app/Http/Requests/UserFormRequest.php | 4 +-- app/Http/Requests/UserRegistrationRequest.php | 4 +-- 70 files changed, 254 insertions(+), 229 deletions(-) diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php index fc0f55d0d1..1eea4ae38a 100644 --- a/app/Http/Controllers/Account/ReconcileController.php +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -38,6 +38,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Services\Internal\Update\CurrencyUpdateService; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Collection; use Log; @@ -119,12 +120,12 @@ class ReconcileController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse * * @throws FireflyException * @throws \Throwable */ - public function overview(Request $request, Account $account, Carbon $start, Carbon $end) + public function overview(Request $request, Account $account, Carbon $start, Carbon $end): JsonResponse { if (AccountType::ASSET !== $account->accountType->type) { throw new FireflyException(sprintf('Account %s is not an asset account.', $account->name)); diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php index c7c9375e74..ac2062c221 100644 --- a/app/Http/Controllers/Admin/ConfigurationController.php +++ b/app/Http/Controllers/Admin/ConfigurationController.php @@ -77,9 +77,9 @@ class ConfigurationController extends Controller /** * @param ConfigurationRequest $request * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function postIndex(ConfigurationRequest $request) + public function postIndex(ConfigurationRequest $request): RedirectResponse { // get config values: $data = $request->getConfigurationData(); diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index c9c4d945e0..95a99b6b0e 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -94,9 +94,8 @@ class ForgotPasswordController extends Controller /** * @codeCoverageIgnore - * Display the form to request a password reset link. * - * @return \Illuminate\Http\Response + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function showLinkRequestForm() { diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index a7faadb46d..9b274dfe7f 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -30,7 +30,7 @@ use Illuminate\Auth\Events\Registered; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; - +use Illuminate\Contracts\Validation\Validator as ValidatorContract; /** * @codeCoverageIgnore * Class RegisterController @@ -62,9 +62,9 @@ class RegisterController extends Controller /** * Handle a registration request for the application. * - * @param \Illuminate\Http\Request $request + * @param Request $request * - * @return \Illuminate\Http\Response + * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View */ public function register(Request $request) { @@ -94,7 +94,7 @@ class RegisterController extends Controller * * @param Request $request * - * @return \Illuminate\Http\Response + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function showRegistrationForm(Request $request) { @@ -122,7 +122,7 @@ class RegisterController extends Controller * * @return \FireflyIII\User */ - protected function create(array $data) + protected function create(array $data): User { return User::create( [ @@ -137,9 +137,9 @@ class RegisterController extends Controller * * @param array $data * - * @return \Illuminate\Contracts\Validation\Validator + * @return ValidatorContract */ - protected function validator(array $data) + protected function validator(array $data): ValidatorContract { return Validator::make( $data, diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index 142979daa9..06fc5c802b 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -30,6 +30,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use FireflyIII\TransactionRules\TransactionMatcher; use FireflyIII\Transformers\BillTransformer; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Collection; use League\Fractal\Manager; @@ -120,7 +121,7 @@ class BillController extends Controller * @param Request $request * @param Bill $bill * - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * @return RedirectResponse|\Illuminate\Routing\Redirector */ public function destroy(Request $request, Bill $bill) { @@ -220,7 +221,7 @@ class BillController extends Controller * @param Request $request * @param Bill $bill * - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * @return RedirectResponse|\Illuminate\Routing\Redirector * @throws \FireflyIII\Exceptions\FireflyException */ public function rescan(Request $request, Bill $bill) @@ -296,9 +297,9 @@ class BillController extends Controller /** * @param BillFormRequest $request * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function store(BillFormRequest $request) + public function store(BillFormRequest $request): RedirectResponse { $billData = $request->getBillData(); $bill = $this->billRepository->store($billData); @@ -348,9 +349,9 @@ class BillController extends Controller * @param BillFormRequest $request * @param Bill $bill * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function update(BillFormRequest $request, Bill $bill) + public function update(BillFormRequest $request, Bill $bill): RedirectResponse { $billData = $request->getBillData(); $bill = $this->billRepository->update($bill, $billData); diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index 9528910896..8cfa44a2a6 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -34,6 +34,8 @@ use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; @@ -75,9 +77,9 @@ class BudgetController extends Controller * @param BudgetRepositoryInterface $repository * @param Budget $budget * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function amount(Request $request, BudgetRepositoryInterface $repository, Budget $budget) + public function amount(Request $request, BudgetRepositoryInterface $repository, Budget $budget): JsonResponse { $amount = (string)$request->get('amount'); $start = Carbon::createFromFormat('Y-m-d', $request->get('start')); @@ -474,9 +476,9 @@ class BudgetController extends Controller /** * @param BudgetIncomeRequest $request * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function postUpdateIncome(BudgetIncomeRequest $request) + public function postUpdateIncome(BudgetIncomeRequest $request): RedirectResponse { $start = Carbon::createFromFormat('Y-m-d', $request->string('start')); $end = Carbon::createFromFormat('Y-m-d', $request->string('end')); @@ -562,7 +564,7 @@ class BudgetController extends Controller * * @return \Illuminate\Http\RedirectResponse */ - public function store(BudgetFormRequest $request) + public function store(BudgetFormRequest $request): RedirectResponse { $data = $request->getBudgetData(); $budget = $this->repository->store($data); @@ -590,7 +592,7 @@ class BudgetController extends Controller * * @return \Illuminate\Http\RedirectResponse */ - public function update(BudgetFormRequest $request, Budget $budget) + public function update(BudgetFormRequest $request, Budget $budget): RedirectResponse { $data = $request->getBudgetData(); $this->repository->update($budget, $data); diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index ef4f696550..4a9a3bf3b1 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -30,6 +30,7 @@ use FireflyIII\Models\Bill; use FireflyIII\Models\Transaction; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; /** @@ -55,9 +56,9 @@ class BillController extends Controller * * @param BillRepositoryInterface $repository * - * @return \Symfony\Component\HttpFoundation\Response + * @return JsonResponse */ - public function frontpage(BillRepositoryInterface $repository) + public function frontpage(BillRepositoryInterface $repository): JsonResponse { $start = session('start', Carbon::now()->startOfMonth()); $end = session('end', Carbon::now()->endOfMonth()); @@ -87,9 +88,9 @@ class BillController extends Controller * @param JournalCollectorInterface $collector * @param Bill $bill * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function single(JournalCollectorInterface $collector, Bill $bill) + public function single(JournalCollectorInterface $collector, Bill $bill): JsonResponse { $cache = new CacheProperties; $cache->addProperty('chart.bill.single'); diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 0e2079c960..0ada5c8a2c 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -36,6 +36,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; use Steam; @@ -72,9 +73,9 @@ class BudgetController extends Controller /** * @param Budget $budget * - * @return \Symfony\Component\HttpFoundation\Response + * @return JsonResponse */ - public function budget(Budget $budget) + public function budget(Budget $budget): JsonResponse { $start = $this->repository->firstUseDate($budget); $end = session('end', new Carbon); @@ -132,11 +133,11 @@ class BudgetController extends Controller * @param Budget $budget * @param BudgetLimit $budgetLimit * - * @return \Symfony\Component\HttpFoundation\Response + * @return JsonResponse * * @throws FireflyException */ - public function budgetLimit(Budget $budget, BudgetLimit $budgetLimit) + public function budgetLimit(Budget $budget, BudgetLimit $budgetLimit): JsonResponse { if ($budgetLimit->budget->id !== $budget->id) { throw new FireflyException('This budget limit is not part of this budget.'); @@ -177,9 +178,9 @@ class BudgetController extends Controller * @param Budget $budget * @param BudgetLimit|null $budgetLimit * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function expenseAsset(Budget $budget, ?BudgetLimit $budgetLimit) + public function expenseAsset(Budget $budget, ?BudgetLimit $budgetLimit): JsonResponse { $cache = new CacheProperties; $cache->addProperty($budget->id); @@ -222,9 +223,9 @@ class BudgetController extends Controller * @param Budget $budget * @param BudgetLimit|null $budgetLimit * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit) + public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit): JsonResponse { $cache = new CacheProperties; $cache->addProperty($budget->id); @@ -269,9 +270,9 @@ class BudgetController extends Controller * @param Budget $budget * @param BudgetLimit|null $budgetLimit * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit) + public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit): JsonResponse { $cache = new CacheProperties; $cache->addProperty($budget->id); @@ -316,7 +317,7 @@ class BudgetController extends Controller * * @return \Symfony\Component\HttpFoundation\Response */ - public function frontpage() + public function frontpage(): \Symfony\Component\HttpFoundation\Response { $start = session('start', Carbon::now()->startOfMonth()); $end = session('end', Carbon::now()->endOfMonth()); @@ -370,9 +371,9 @@ class BudgetController extends Controller * @param Carbon $end * @param Collection $accounts * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function period(Budget $budget, Collection $accounts, Carbon $start, Carbon $end) + public function period(Budget $budget, Collection $accounts, Carbon $start, Carbon $end): JsonResponse { // chart properties for cache: $cache = new CacheProperties(); @@ -413,9 +414,9 @@ class BudgetController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function periodNoBudget(Collection $accounts, Carbon $start, Carbon $end) + public function periodNoBudget(Collection $accounts, Carbon $start, Carbon $end): JsonResponse { // chart properties for cache: $cache = new CacheProperties(); diff --git a/app/Http/Controllers/Chart/BudgetReportController.php b/app/Http/Controllers/Chart/BudgetReportController.php index d769bb5c4a..15c9d5276f 100644 --- a/app/Http/Controllers/Chart/BudgetReportController.php +++ b/app/Http/Controllers/Chart/BudgetReportController.php @@ -36,6 +36,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; /** @@ -74,9 +75,9 @@ class BudgetReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function accountExpense(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end, string $others) + public function accountExpense(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -99,9 +100,9 @@ class BudgetReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function budgetExpense(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end, string $others) + public function budgetExpense(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -123,9 +124,9 @@ class BudgetReportController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function mainChart(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end) + public function mainChart(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): JsonResponse { $cache = new CacheProperties; $cache->addProperty('chart.budget.report.main'); diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index d7f5cfb2c9..3d016639c1 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -30,6 +30,7 @@ use FireflyIII\Models\Category; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; use Preferences; @@ -59,9 +60,9 @@ class CategoryController extends Controller * @param AccountRepositoryInterface $accountRepository * @param Category $category * - * @return \Symfony\Component\HttpFoundation\Response + * @return JsonResponse */ - public function all(CategoryRepositoryInterface $repository, AccountRepositoryInterface $accountRepository, Category $category) + public function all(CategoryRepositoryInterface $repository, AccountRepositoryInterface $accountRepository, Category $category): JsonResponse { $cache = new CacheProperties; $cache->addProperty('chart.category.all'); @@ -122,9 +123,9 @@ class CategoryController extends Controller * @param CategoryRepositoryInterface $repository * @param AccountRepositoryInterface $accountRepository * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function frontpage(CategoryRepositoryInterface $repository, AccountRepositoryInterface $accountRepository) + public function frontpage(CategoryRepositoryInterface $repository, AccountRepositoryInterface $accountRepository): JsonResponse { $start = session('start', Carbon::now()->startOfMonth()); $end = session('end', Carbon::now()->endOfMonth()); @@ -166,9 +167,9 @@ class CategoryController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse|mixed + * @return JsonResponse */ - public function reportPeriod(Category $category, Collection $accounts, Carbon $start, Carbon $end) + public function reportPeriod(Category $category, Collection $accounts, Carbon $start, Carbon $end): JsonResponse { $cache = new CacheProperties; $cache->addProperty($start); @@ -224,9 +225,9 @@ class CategoryController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse|mixed + * @return JsonResponse */ - public function reportPeriodNoCategory(Collection $accounts, Carbon $start, Carbon $end) + public function reportPeriodNoCategory(Collection $accounts, Carbon $start, Carbon $end): JsonResponse { $cache = new CacheProperties; $cache->addProperty($start); @@ -278,9 +279,9 @@ class CategoryController extends Controller * @param Category $category * @param $date * - * @return \Symfony\Component\HttpFoundation\Response + * @return JsonResponse */ - public function specificPeriod(Category $category, Carbon $date) + public function specificPeriod(Category $category, Carbon $date): JsonResponse { $range = Preferences::get('viewRange', '1M')->data; $start = app('navigation')->startOfPeriod($date, $range); @@ -298,7 +299,7 @@ class CategoryController extends Controller * * @return array */ - private function makePeriodChart(Category $category, Carbon $start, Carbon $end) + private function makePeriodChart(Category $category, Carbon $start, Carbon $end): array { $cache = new CacheProperties; $cache->addProperty($start); diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php index 03b4180ad9..7225aca42c 100644 --- a/app/Http/Controllers/Chart/CategoryReportController.php +++ b/app/Http/Controllers/Chart/CategoryReportController.php @@ -35,6 +35,7 @@ use FireflyIII\Models\Category; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionType; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; /** @@ -70,9 +71,9 @@ class CategoryReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function accountExpense(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others) + public function accountExpense(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -92,9 +93,9 @@ class CategoryReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function accountIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others) + public function accountIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -117,9 +118,9 @@ class CategoryReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function categoryExpense(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others) + public function categoryExpense(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -142,9 +143,9 @@ class CategoryReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function categoryIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others) + public function categoryIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -167,9 +168,9 @@ class CategoryReportController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function mainChart(Collection $accounts, Collection $categories, Carbon $start, Carbon $end) + public function mainChart(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): JsonResponse { $cache = new CacheProperties; $cache->addProperty('chart.category.report.main'); diff --git a/app/Http/Controllers/Chart/ExpenseReportController.php b/app/Http/Controllers/Chart/ExpenseReportController.php index 7b44de228c..04baacfe3d 100644 --- a/app/Http/Controllers/Chart/ExpenseReportController.php +++ b/app/Http/Controllers/Chart/ExpenseReportController.php @@ -33,6 +33,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; /** @@ -69,9 +70,9 @@ class ExpenseReportController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function mainChart(Collection $accounts, Collection $expense, Carbon $start, Carbon $end) + public function mainChart(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): JsonResponse { $cache = new CacheProperties; $cache->addProperty('chart.expense.report.main'); diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php index 1060f64f63..c023656ed6 100644 --- a/app/Http/Controllers/Chart/PiggyBankController.php +++ b/app/Http/Controllers/Chart/PiggyBankController.php @@ -29,6 +29,7 @@ use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBankEvent; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; /** @@ -55,9 +56,9 @@ class PiggyBankController extends Controller * @param PiggyBankRepositoryInterface $repository * @param PiggyBank $piggyBank * - * @return \Symfony\Component\HttpFoundation\Response + * @return JsonResponse */ - public function history(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank) + public function history(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank): JsonResponse { // chart properties for cache: $cache = new CacheProperties; diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php index dfc8f77e1d..b8ad5dfa18 100644 --- a/app/Http/Controllers/Chart/ReportController.php +++ b/app/Http/Controllers/Chart/ReportController.php @@ -96,7 +96,7 @@ class ReportController extends Controller * * @return \Illuminate\Http\JsonResponse */ - public function operations(Collection $accounts, Carbon $start, Carbon $end) + public function operations(Collection $accounts, Carbon $start, Carbon $end): JsonResponse { // chart properties for cache: $cache = new CacheProperties; @@ -153,7 +153,7 @@ class ReportController extends Controller * * @return \Illuminate\Http\JsonResponse */ - public function sum(Collection $accounts, Carbon $start, Carbon $end) + public function sum(Collection $accounts, Carbon $start, Carbon $end): JsonResponse { // chart properties for cache: $cache = new CacheProperties; diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.php index 9fc5406a03..5f56e4b9b1 100644 --- a/app/Http/Controllers/Chart/TagReportController.php +++ b/app/Http/Controllers/Chart/TagReportController.php @@ -36,6 +36,7 @@ use FireflyIII\Models\Tag; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionType; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; /** @@ -63,9 +64,9 @@ class TagReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function accountExpense(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others) + public function accountExpense(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -87,9 +88,9 @@ class TagReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function accountIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others) + public function accountIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -110,9 +111,9 @@ class TagReportController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function budgetExpense(Collection $accounts, Collection $tags, Carbon $start, Carbon $end) + public function budgetExpense(Collection $accounts, Collection $tags, Carbon $start, Carbon $end): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -133,9 +134,9 @@ class TagReportController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function categoryExpense(Collection $accounts, Collection $tags, Carbon $start, Carbon $end) + public function categoryExpense(Collection $accounts, Collection $tags, Carbon $start, Carbon $end): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -156,9 +157,9 @@ class TagReportController extends Controller * @param Carbon $start * @param Carbon $end * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function mainChart(Collection $accounts, Collection $tags, Carbon $start, Carbon $end) + public function mainChart(Collection $accounts, Collection $tags, Carbon $start, Carbon $end): JsonResponse { $cache = new CacheProperties; $cache->addProperty('chart.category.report.main'); @@ -262,9 +263,9 @@ class TagReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function tagExpense(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others) + public function tagExpense(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); @@ -286,9 +287,9 @@ class TagReportController extends Controller * @param Carbon $end * @param string $others * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function tagIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others) + public function tagIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others): JsonResponse { /** @var MetaPieChartInterface $helper */ $helper = app(MetaPieChartInterface::class); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 3a9eaf8d48..4cfd23cd0f 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -172,7 +172,7 @@ class Controller extends BaseController /** * @param string $identifier */ - protected function rememberPreviousUri(string $identifier) + protected function rememberPreviousUri(string $identifier): void { session()->put($identifier, URL::previous()); } diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index 9aca4ef65e..dbdad0512d 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -52,7 +52,7 @@ class DebugController extends Controller /** * @throws FireflyException */ - public function displayError() + public function displayError(): void { Log::debug('This is a test message at the DEBUG level.'); Log::info('This is a test message at the INFO level.'); diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index 27c3e655a7..34102365bb 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -30,6 +30,7 @@ use FireflyIII\Http\Requests\ExportFormRequest; use FireflyIII\Models\ExportJob; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Response as LaravelResponse; use Preferences; @@ -98,7 +99,7 @@ class ExportController extends Controller * * @return \Illuminate\Http\JsonResponse */ - public function getStatus(ExportJob $job) + public function getStatus(ExportJob $job): JsonResponse { return response()->json(['status' => trans('firefly.' . $job->status)]); } @@ -129,9 +130,9 @@ class ExportController extends Controller * @param AccountRepositoryInterface $repository * @param ExportJobRepositoryInterface $jobs * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function postIndex(ExportFormRequest $request, AccountRepositoryInterface $repository, ExportJobRepositoryInterface $jobs) + public function postIndex(ExportFormRequest $request, AccountRepositoryInterface $repository, ExportJobRepositoryInterface $jobs): JsonResponse { $job = $jobs->findByKey($request->get('job')); $accounts = $request->get('accounts') ?? []; diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.php index bb5ec06a04..b472f8ea9d 100644 --- a/app/Http/Controllers/HelpController.php +++ b/app/Http/Controllers/HelpController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; use FireflyIII\Helpers\Help\HelpInterface; +use Illuminate\Http\JsonResponse; use Log; use Preferences; @@ -53,9 +54,9 @@ class HelpController extends Controller /** * @param $route * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function show(string $route) + public function show(string $route): JsonResponse { $language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data; $html = $this->getHelpText($route, $language); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 6dc45a198d..e75cde15f6 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -31,6 +31,7 @@ use FireflyIII\Http\Middleware\IsSandStormUser; use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Collection; use Log; @@ -59,9 +60,9 @@ class HomeController extends Controller /** * @param Request $request * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function dateRange(Request $request) + public function dateRange(Request $request): JsonResponse { $start = new Carbon($request->get('start')); $end = new Carbon($request->get('end')); diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php index 0ebb2d5192..cb0c1e1759 100644 --- a/app/Http/Controllers/JavascriptController.php +++ b/app/Http/Controllers/JavascriptController.php @@ -44,7 +44,7 @@ class JavascriptController extends Controller * * @return \Illuminate\Http\Response */ - public function accounts(AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository) + public function accounts(AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository): Response { $accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); $preference = Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR')); @@ -94,7 +94,7 @@ class JavascriptController extends Controller * * @return \Illuminate\Http\Response */ - public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository) + public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository): Response { $account = $repository->findNull((int)$request->get('account')); $currencyId = 0; diff --git a/app/Http/Controllers/Json/AutoCompleteController.php b/app/Http/Controllers/Json/AutoCompleteController.php index caad1fdf63..9472195946 100644 --- a/app/Http/Controllers/Json/AutoCompleteController.php +++ b/app/Http/Controllers/Json/AutoCompleteController.php @@ -50,7 +50,7 @@ class AutoCompleteController extends Controller * * @return JsonResponse */ - public function allAccounts(AccountRepositoryInterface $repository) + public function allAccounts(AccountRepositoryInterface $repository): JsonResponse { $return = array_unique( $repository->getAccountsByType( @@ -98,7 +98,7 @@ class AutoCompleteController extends Controller * * @return JsonResponse */ - public function budgets(BudgetRepositoryInterface $repository) + public function budgets(BudgetRepositoryInterface $repository): JsonResponse { $return = array_unique($repository->getBudgets()->pluck('name')->toArray()); sort($return); @@ -113,7 +113,7 @@ class AutoCompleteController extends Controller * * @return JsonResponse */ - public function categories(CategoryRepositoryInterface $repository) + public function categories(CategoryRepositoryInterface $repository): JsonResponse { $return = array_unique($repository->getCategories()->pluck('name')->toArray()); sort($return); @@ -126,7 +126,7 @@ class AutoCompleteController extends Controller * * @return JsonResponse */ - public function currencyNames(CurrencyRepositoryInterface $repository) + public function currencyNames(CurrencyRepositoryInterface $repository): JsonResponse { $return = $repository->get()->pluck('name')->toArray(); sort($return); @@ -141,7 +141,7 @@ class AutoCompleteController extends Controller * * @return JsonResponse */ - public function expenseAccounts(AccountRepositoryInterface $repository) + public function expenseAccounts(AccountRepositoryInterface $repository): JsonResponse { $set = $repository->getAccountsByType([AccountType::EXPENSE, AccountType::BENEFICIARY]); $filtered = $set->filter( @@ -199,7 +199,7 @@ class AutoCompleteController extends Controller * * @return JsonResponse */ - public function revenueAccounts(AccountRepositoryInterface $repository) + public function revenueAccounts(AccountRepositoryInterface $repository): JsonResponse { $set = $repository->getAccountsByType([AccountType::REVENUE]); $filtered = $set->filter( @@ -224,7 +224,7 @@ class AutoCompleteController extends Controller * * @return JsonResponse */ - public function tags(TagRepositoryInterface $tagRepository) + public function tags(TagRepositoryInterface $tagRepository): JsonResponse { $return = array_unique($tagRepository->get()->pluck('tag')->toArray()); sort($return); @@ -238,7 +238,7 @@ class AutoCompleteController extends Controller * * @return JsonResponse */ - public function transactionJournals(JournalCollectorInterface $collector, string $what) + public function transactionJournals(JournalCollectorInterface $collector, string $what): JsonResponse { $type = config('firefly.transactionTypesByWhat.' . $what); $types = [$type]; @@ -255,7 +255,7 @@ class AutoCompleteController extends Controller * * @return JsonResponse */ - public function transactionTypes(JournalRepositoryInterface $repository) + public function transactionTypes(JournalRepositoryInterface $repository): JsonResponse { $return = array_unique($repository->getTransactionTypes()->pluck('type')->toArray()); sort($return); diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php index 0fd31941a4..50302790a9 100644 --- a/app/Http/Controllers/Json/BoxController.php +++ b/app/Http/Controllers/Json/BoxController.php @@ -35,6 +35,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\JsonResponse; /** * Class BoxController. @@ -45,9 +46,9 @@ class BoxController extends Controller /** * @param BudgetRepositoryInterface $repository * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function available(BudgetRepositoryInterface $repository) + public function available(BudgetRepositoryInterface $repository): JsonResponse { $start = session('start', Carbon::now()->startOfMonth()); $end = session('end', Carbon::now()->endOfMonth()); @@ -97,9 +98,9 @@ class BoxController extends Controller /** * @param CurrencyRepositoryInterface $repository * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function balance(CurrencyRepositoryInterface $repository) + public function balance(CurrencyRepositoryInterface $repository): JsonResponse { // Cache result, return cache if present. $start = session('start', Carbon::now()->startOfMonth()); @@ -179,9 +180,9 @@ class BoxController extends Controller /** * @param BillRepositoryInterface $repository * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function bills(BillRepositoryInterface $repository) + public function bills(BillRepositoryInterface $repository): JsonResponse { $start = session('start', Carbon::now()->startOfMonth()); $end = session('end', Carbon::now()->endOfMonth()); @@ -217,9 +218,9 @@ class BoxController extends Controller * * @param CurrencyRepositoryInterface $currencyRepos * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function netWorth(AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepos) + public function netWorth(AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepos): JsonResponse { $date = new Carbon(date('Y-m-d')); // needed so its per day. /** @var Carbon $start */ diff --git a/app/Http/Controllers/Json/ExchangeController.php b/app/Http/Controllers/Json/ExchangeController.php index 8e3eb16ac9..6a3f6ce2ca 100644 --- a/app/Http/Controllers/Json/ExchangeController.php +++ b/app/Http/Controllers/Json/ExchangeController.php @@ -27,6 +27,7 @@ use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Services\Currency\ExchangeRateInterface; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Log; @@ -42,9 +43,9 @@ class ExchangeController extends Controller * @param TransactionCurrency $toCurrency * @param Carbon $date * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function getRate(Request $request, TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date) + public function getRate(Request $request, TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): JsonResponse { /** @var CurrencyRepositoryInterface $repository */ $repository = app(CurrencyRepositoryInterface::class); diff --git a/app/Http/Controllers/Json/FrontpageController.php b/app/Http/Controllers/Json/FrontpageController.php index 422d2b4e75..c7bf29ec73 100644 --- a/app/Http/Controllers/Json/FrontpageController.php +++ b/app/Http/Controllers/Json/FrontpageController.php @@ -25,6 +25,7 @@ namespace FireflyIII\Http\Controllers\Json; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\PiggyBank; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; +use Illuminate\Http\JsonResponse; /** * Class FrontpageController. @@ -34,10 +35,10 @@ class FrontpageController extends Controller /** * @param PiggyBankRepositoryInterface $repository * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse * @throws \Throwable */ - public function piggyBanks(PiggyBankRepositoryInterface $repository) + public function piggyBanks(PiggyBankRepositoryInterface $repository): JsonResponse { $set = $repository->getPiggyBanks(); $info = []; diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.php index 96a7a14aa7..31ab70d523 100644 --- a/app/Http/Controllers/Json/IntroController.php +++ b/app/Http/Controllers/Json/IntroController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Json; use FireflyIII\Support\Facades\Preferences; +use Illuminate\Http\JsonResponse; use Log; /** @@ -34,9 +35,9 @@ class IntroController * @param string $route * @param string|null $specificPage * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function getIntroSteps(string $route, string $specificPage = null) + public function getIntroSteps(string $route, string $specificPage = null): JsonResponse { Log::debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage)); $specificPage = $specificPage ?? ''; @@ -92,9 +93,9 @@ class IntroController * @param string $route * @param string|null $specialPage * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function postEnable(string $route, string $specialPage = null) + public function postEnable(string $route, string $specialPage = null): JsonResponse { $specialPage = $specialPage ?? ''; $route = str_replace('.', '_', $route); @@ -112,9 +113,9 @@ class IntroController * @param string $route * @param string|null $specialPage * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ - public function postFinished(string $route, string $specialPage = null) + public function postFinished(string $route, string $specialPage = null): JsonResponse { $specialPage = $specialPage ?? ''; $key = 'shown_demo_' . $route; diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php index 2e5988d2c6..86340617f1 100644 --- a/app/Http/Controllers/JsonController.php +++ b/app/Http/Controllers/JsonController.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; /** @@ -32,10 +33,10 @@ class JsonController extends Controller /** * @param Request $request * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse * @throws \Throwable */ - public function action(Request $request) + public function action(Request $request): JsonResponse { $count = (int)$request->get('count') > 0 ? (int)$request->get('count') : 1; $keys = array_keys(config('firefly.rule-actions')); @@ -51,10 +52,10 @@ class JsonController extends Controller /** * @param Request $request * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse * @throws \Throwable */ - public function trigger(Request $request) + public function trigger(Request $request): JsonResponse { $count = (int)$request->get('count') > 0 ? (int)$request->get('count') : 1; $keys = array_keys(config('firefly.rule-triggers')); diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php index 2bfb9230d6..75365e9108 100644 --- a/app/Http/Controllers/PiggyBankController.php +++ b/app/Http/Controllers/PiggyBankController.php @@ -31,6 +31,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Transformers\AccountTransformer; use FireflyIII\Transformers\PiggyBankTransformer; use Illuminate\Http\JsonResponse; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; @@ -159,9 +160,9 @@ class PiggyBankController extends Controller /** * @param PiggyBank $piggyBank * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function destroy(PiggyBank $piggyBank) + public function destroy(PiggyBank $piggyBank): RedirectResponse { session()->flash('success', (string)trans('firefly.deleted_piggy_bank', ['name' => $piggyBank->name])); app('preferences')->mark(); @@ -266,9 +267,9 @@ class PiggyBankController extends Controller * @param Request $request * @param PiggyBank $piggyBank * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function postAdd(Request $request, PiggyBank $piggyBank) + public function postAdd(Request $request, PiggyBank $piggyBank): RedirectResponse { $amount = $request->get('amount') ?? '0'; $currency = app('amount')->getDefaultCurrency(); @@ -306,9 +307,9 @@ class PiggyBankController extends Controller * @param Request $request * @param PiggyBank $piggyBank * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function postRemove(Request $request, PiggyBank $piggyBank) + public function postRemove(Request $request, PiggyBank $piggyBank): RedirectResponse { $amount = $request->get('amount') ?? '0'; $currency = app('amount')->getDefaultCurrency(); diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.php index f69116d77c..3806ba4414 100644 --- a/app/Http/Controllers/Popup/ReportController.php +++ b/app/Http/Controllers/Popup/ReportController.php @@ -31,6 +31,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Support\Binder\AccountList; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Routing\Route; use InvalidArgumentException; @@ -78,12 +79,12 @@ class ReportController extends Controller /** * @param Request $request * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse * * @throws FireflyException * @throws \Throwable */ - public function general(Request $request) + public function general(Request $request): JsonResponse { $attributes = $request->get('attributes') ?? []; $attributes = $this->parseAttributes($attributes); diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php index 6df7eec8e3..a37336b0fc 100644 --- a/app/Http/Controllers/Report/CategoryController.php +++ b/app/Http/Controllers/Report/CategoryController.php @@ -77,7 +77,7 @@ class CategoryController extends Controller * @return string * @throws \Throwable */ - public function income(Collection $accounts, Carbon $start, Carbon $end) + public function income(Collection $accounts, Carbon $start, Carbon $end): string { $cache = new CacheProperties; $cache->addProperty($start); diff --git a/app/Http/Controllers/Report/ExpenseController.php b/app/Http/Controllers/Report/ExpenseController.php index 2a23efb99a..9d5b7276ae 100644 --- a/app/Http/Controllers/Report/ExpenseController.php +++ b/app/Http/Controllers/Report/ExpenseController.php @@ -71,7 +71,7 @@ class ExpenseController extends Controller * @return string * @throws \Throwable */ - public function budget(Collection $accounts, Collection $expense, Carbon $start, Carbon $end) + public function budget(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): string { // Properties for cache: $cache = new CacheProperties; @@ -118,7 +118,7 @@ class ExpenseController extends Controller * @return string * @throws \Throwable */ - public function category(Collection $accounts, Collection $expense, Carbon $start, Carbon $end) + public function category(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): string { // Properties for cache: $cache = new CacheProperties; @@ -220,7 +220,7 @@ class ExpenseController extends Controller * @return string * @throws \Throwable */ - public function topExpense(Collection $accounts, Collection $expense, Carbon $start, Carbon $end) + public function topExpense(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): string { // Properties for cache: $cache = new CacheProperties; diff --git a/app/Http/Controllers/Report/OperationsController.php b/app/Http/Controllers/Report/OperationsController.php index fc0777852e..a13eaa8593 100644 --- a/app/Http/Controllers/Report/OperationsController.php +++ b/app/Http/Controllers/Report/OperationsController.php @@ -90,7 +90,7 @@ class OperationsController extends Controller * @return string * @throws \Throwable */ - public function income(Collection $accounts, Carbon $start, Carbon $end) + public function income(Collection $accounts, Carbon $start, Carbon $end): string { // chart properties for cache: $cache = new CacheProperties; diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 0b88b9599c..ef392cff7d 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -81,7 +81,7 @@ class ReportController extends Controller * * @throws \FireflyIII\Exceptions\FireflyException */ - public function accountReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end) + public function accountReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): string { if ($end < $start) { return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore @@ -115,7 +115,7 @@ class ReportController extends Controller * * @throws \FireflyIII\Exceptions\FireflyException */ - public function auditReport(Collection $accounts, Carbon $start, Carbon $end) + public function auditReport(Collection $accounts, Carbon $start, Carbon $end): string { if ($end < $start) { return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore @@ -152,7 +152,7 @@ class ReportController extends Controller * * @throws \FireflyIII\Exceptions\FireflyException */ - public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end) + public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): string { if ($end < $start) { return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore @@ -190,7 +190,7 @@ class ReportController extends Controller * * @throws \FireflyIII\Exceptions\FireflyException */ - public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end) + public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): string { if ($end < $start) { return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore @@ -227,7 +227,7 @@ class ReportController extends Controller * * @throws \FireflyIII\Exceptions\FireflyException */ - public function defaultReport(Collection $accounts, Carbon $start, Carbon $end) + public function defaultReport(Collection $accounts, Carbon $start, Carbon $end): string { if ($end < $start) { return view('error')->with('message', trans('firefly.end_after_start_date')); @@ -386,7 +386,7 @@ class ReportController extends Controller * * @throws \FireflyIII\Exceptions\FireflyException */ - public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end) + public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end): string { if ($end < $start) { return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index 67050297c9..2131227708 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -39,6 +39,7 @@ use FireflyIII\Repositories\Rule\RuleRepositoryInterface; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use FireflyIII\TransactionRules\TransactionMatcher; use Illuminate\Http\JsonResponse; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Collection; use Log; @@ -174,7 +175,7 @@ class RuleController extends Controller * * @return \Illuminate\Http\RedirectResponse */ - public function destroy(Rule $rule) + public function destroy(Rule $rule): \Illuminate\Http\RedirectResponse { $title = $rule->title; $this->ruleRepos->destroy($rule); @@ -254,11 +255,11 @@ class RuleController extends Controller * @param SelectTransactionsRequest $request * @param Rule $rule * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse * * @internal param RuleGroup $ruleGroup */ - public function execute(SelectTransactionsRequest $request, Rule $rule) + public function execute(SelectTransactionsRequest $request, Rule $rule): RedirectResponse { // Get parameters specified by the user $accounts = $this->accountRepos->getAccountsById($request->get('accounts')); diff --git a/app/Http/Controllers/RuleGroupController.php b/app/Http/Controllers/RuleGroupController.php index a0c20b3d37..f0fceaa363 100644 --- a/app/Http/Controllers/RuleGroupController.php +++ b/app/Http/Controllers/RuleGroupController.php @@ -29,6 +29,7 @@ use FireflyIII\Jobs\ExecuteRuleGroupOnExistingTransactions; use FireflyIII\Models\RuleGroup; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; /** @@ -151,9 +152,9 @@ class RuleGroupController extends Controller * @param AccountRepositoryInterface $repository * @param RuleGroup $ruleGroup * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function execute(SelectTransactionsRequest $request, AccountRepositoryInterface $repository, RuleGroup $ruleGroup) + public function execute(SelectTransactionsRequest $request, AccountRepositoryInterface $repository, RuleGroup $ruleGroup): RedirectResponse { // Get parameters specified by the user $accounts = $repository->getAccountsById($request->get('accounts')); diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index cdea90db85..9e97fae2a2 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -24,6 +24,7 @@ namespace FireflyIII\Http\Controllers; use FireflyIII\Support\CacheProperties; use FireflyIII\Support\Search\SearchInterface; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Collection; @@ -74,7 +75,7 @@ class SearchController extends Controller * @return \Illuminate\Http\JsonResponse * @throws \Throwable */ - public function search(Request $request, SearchInterface $searcher) + public function search(Request $request, SearchInterface $searcher): JsonResponse { $fullQuery = (string)$request->get('query'); $transactions = new Collection; diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php index 9945f9d4d9..8e345e7084 100644 --- a/app/Http/Controllers/System/InstallController.php +++ b/app/Http/Controllers/System/InstallController.php @@ -145,7 +145,7 @@ class InstallController extends Controller /** * @return \Illuminate\Http\JsonResponse */ - public function verify() + public function verify(): JsonResponse { if ($this->hasForbiddenFunctions()) { return response()->json(['error' => true, 'message' => self::FORBIDDEN_ERROR]); diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index c67193287e..60075db3f8 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -30,6 +30,7 @@ use FireflyIII\Http\Requests\TagFormRequest; use FireflyIII\Models\Tag; use FireflyIII\Repositories\Tag\TagRepositoryInterface; use FireflyIII\Support\CacheProperties; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Collection; use View; @@ -99,9 +100,9 @@ class TagController extends Controller /** * @param Tag $tag * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function destroy(Tag $tag) + public function destroy(Tag $tag): RedirectResponse { $tagName = $tag->tag; $this->repository->destroy($tag); @@ -231,9 +232,9 @@ class TagController extends Controller /** * @param TagFormRequest $request * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function store(TagFormRequest $request) + public function store(TagFormRequest $request): RedirectResponse { $data = $request->collectTagData(); $this->repository->store($data); @@ -258,9 +259,9 @@ class TagController extends Controller * @param TagFormRequest $request * @param Tag $tag * - * @return \Illuminate\Http\RedirectResponse + * @return RedirectResponse */ - public function update(TagFormRequest $request, Tag $tag) + public function update(TagFormRequest $request, Tag $tag): RedirectResponse { $data = $request->collectTagData(); $this->repository->update($tag, $data); diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 471eac4562..c5d00da0af 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -175,7 +175,7 @@ class TransactionController extends Controller * * @return \Illuminate\Http\JsonResponse */ - public function reorder(Request $request) + public function reorder(Request $request): JsonResponse { $ids = $request->get('items'); $date = new Carbon($request->get('date')); diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php index 2a25ad578c..64ab26fcfe 100644 --- a/app/Http/Middleware/Range.php +++ b/app/Http/Middleware/Range.php @@ -66,7 +66,7 @@ class Range /** * */ - private function configureList() + private function configureList(): void { $pref = Preferences::get('list-length', config('firefly.list_length', 10))->data; View::share('listLength', $pref); @@ -75,7 +75,7 @@ class Range /** * */ - private function configureView() + private function configureView(): void { $pref = Preferences::get('language', config('firefly.default_language', 'en_US')); $lang = $pref->data; @@ -105,7 +105,7 @@ class Range /** * @param Request $request */ - private function loseItAll(Request $request) + private function loseItAll(Request $request): void { if ('sqlite' === getenv('DB_CONNECTION') && true === getenv('IS_DOCKER')) { $request->session()->flash( @@ -117,7 +117,7 @@ class Range /** * */ - private function setRange() + private function setRange(): void { // ignore preference. set the range to be the current month: if (!Session::has('start') && !Session::has('end')) { diff --git a/app/Http/Middleware/StartFireflySession.php b/app/Http/Middleware/StartFireflySession.php index 77e90c55f6..4197d6d285 100644 --- a/app/Http/Middleware/StartFireflySession.php +++ b/app/Http/Middleware/StartFireflySession.php @@ -37,7 +37,7 @@ class StartFireflySession extends StartSession * @param \Illuminate\Http\Request $request * @param \Illuminate\Contracts\Session\Session $session */ - protected function storeCurrentUrl(Request $request, $session) + protected function storeCurrentUrl(Request $request, $session): void { $uri = $request->fullUrl(); $strpos = strpos($uri, 'jscript'); diff --git a/app/Http/Requests/AttachmentFormRequest.php b/app/Http/Requests/AttachmentFormRequest.php index 58b70356a4..96086b0433 100644 --- a/app/Http/Requests/AttachmentFormRequest.php +++ b/app/Http/Requests/AttachmentFormRequest.php @@ -31,7 +31,7 @@ class AttachmentFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -51,7 +51,7 @@ class AttachmentFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed return [ diff --git a/app/Http/Requests/BillFormRequest.php b/app/Http/Requests/BillFormRequest.php index dc2d35cf94..e053e4c09c 100644 --- a/app/Http/Requests/BillFormRequest.php +++ b/app/Http/Requests/BillFormRequest.php @@ -30,7 +30,7 @@ class BillFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -39,7 +39,7 @@ class BillFormRequest extends Request /** * @return array */ - public function getBillData() + public function getBillData(): array { return [ 'name' => $this->string('name'), diff --git a/app/Http/Requests/BudgetFormRequest.php b/app/Http/Requests/BudgetFormRequest.php index 90cd932635..94e870e9dd 100644 --- a/app/Http/Requests/BudgetFormRequest.php +++ b/app/Http/Requests/BudgetFormRequest.php @@ -33,7 +33,7 @@ class BudgetFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { return auth()->check(); } @@ -52,7 +52,7 @@ class BudgetFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed /** @var BudgetRepositoryInterface $repository */ diff --git a/app/Http/Requests/BudgetIncomeRequest.php b/app/Http/Requests/BudgetIncomeRequest.php index 8fbb7a5ed2..859b758f6d 100644 --- a/app/Http/Requests/BudgetIncomeRequest.php +++ b/app/Http/Requests/BudgetIncomeRequest.php @@ -31,7 +31,7 @@ class BudgetIncomeRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -40,7 +40,7 @@ class BudgetIncomeRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed return [ diff --git a/app/Http/Requests/BulkEditJournalRequest.php b/app/Http/Requests/BulkEditJournalRequest.php index 4aefd85029..84d037aab5 100644 --- a/app/Http/Requests/BulkEditJournalRequest.php +++ b/app/Http/Requests/BulkEditJournalRequest.php @@ -30,7 +30,7 @@ class BulkEditJournalRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -39,7 +39,7 @@ class BulkEditJournalRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed diff --git a/app/Http/Requests/CategoryFormRequest.php b/app/Http/Requests/CategoryFormRequest.php index 38b2b872e6..e51aa818db 100644 --- a/app/Http/Requests/CategoryFormRequest.php +++ b/app/Http/Requests/CategoryFormRequest.php @@ -32,7 +32,7 @@ class CategoryFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -51,7 +51,7 @@ class CategoryFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { /** @var CategoryRepositoryInterface $repository */ $repository = app(CategoryRepositoryInterface::class); diff --git a/app/Http/Requests/ConfigurationRequest.php b/app/Http/Requests/ConfigurationRequest.php index d6dbe9a490..b5ff29aa74 100644 --- a/app/Http/Requests/ConfigurationRequest.php +++ b/app/Http/Requests/ConfigurationRequest.php @@ -31,7 +31,7 @@ class ConfigurationRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users and admins return auth()->check() && auth()->user()->hasRole('owner'); @@ -51,7 +51,7 @@ class ConfigurationRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed $rules = [ diff --git a/app/Http/Requests/CurrencyFormRequest.php b/app/Http/Requests/CurrencyFormRequest.php index 5e1249bddf..9e0b143e92 100644 --- a/app/Http/Requests/CurrencyFormRequest.php +++ b/app/Http/Requests/CurrencyFormRequest.php @@ -30,7 +30,7 @@ class CurrencyFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -39,7 +39,7 @@ class CurrencyFormRequest extends Request /** * @return array */ - public function getCurrencyData() + public function getCurrencyData(): array { return [ 'name' => $this->string('name'), @@ -52,7 +52,7 @@ class CurrencyFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed $rules = [ diff --git a/app/Http/Requests/DeleteAccountFormRequest.php b/app/Http/Requests/DeleteAccountFormRequest.php index 34e7494289..d4109b0063 100644 --- a/app/Http/Requests/DeleteAccountFormRequest.php +++ b/app/Http/Requests/DeleteAccountFormRequest.php @@ -31,7 +31,7 @@ class DeleteAccountFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -40,7 +40,7 @@ class DeleteAccountFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed return [ diff --git a/app/Http/Requests/EmailFormRequest.php b/app/Http/Requests/EmailFormRequest.php index 6ad6d66fa0..a64b72e8e9 100644 --- a/app/Http/Requests/EmailFormRequest.php +++ b/app/Http/Requests/EmailFormRequest.php @@ -31,7 +31,7 @@ class EmailFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -40,7 +40,7 @@ class EmailFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed return [ diff --git a/app/Http/Requests/ExportFormRequest.php b/app/Http/Requests/ExportFormRequest.php index d57207f05c..4897c6dbaa 100644 --- a/app/Http/Requests/ExportFormRequest.php +++ b/app/Http/Requests/ExportFormRequest.php @@ -32,7 +32,7 @@ class ExportFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -41,7 +41,7 @@ class ExportFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { $sessionFirst = clone session('first'); $first = $sessionFirst->subDay()->format('Y-m-d'); diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php index c09499450b..ac2068bbea 100644 --- a/app/Http/Requests/JournalFormRequest.php +++ b/app/Http/Requests/JournalFormRequest.php @@ -35,7 +35,7 @@ class JournalFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -46,7 +46,7 @@ class JournalFormRequest extends Request * * @return array */ - public function getJournalData() + public function getJournalData(): array { $currencyId = $this->integer('amount_currency_id_amount'); $data = [ @@ -142,7 +142,7 @@ class JournalFormRequest extends Request * * @throws FireflyException */ - public function rules() + public function rules(): array { $what = $this->get('what'); $rules = [ diff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.php index 391e0641f8..6cebe3a4de 100644 --- a/app/Http/Requests/JournalLinkRequest.php +++ b/app/Http/Requests/JournalLinkRequest.php @@ -33,7 +33,7 @@ class JournalLinkRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -61,7 +61,7 @@ class JournalLinkRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // all possible combinations of link types and inward / outward: $combinations = []; diff --git a/app/Http/Requests/LinkTypeFormRequest.php b/app/Http/Requests/LinkTypeFormRequest.php index 82fa430801..86a696d47d 100644 --- a/app/Http/Requests/LinkTypeFormRequest.php +++ b/app/Http/Requests/LinkTypeFormRequest.php @@ -30,7 +30,7 @@ class LinkTypeFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged and admins return auth()->check() && auth()->user()->hasRole('owner'); @@ -39,7 +39,7 @@ class LinkTypeFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed $nameRule = 'required|min:1|unique:link_types,name'; diff --git a/app/Http/Requests/MassDeleteJournalRequest.php b/app/Http/Requests/MassDeleteJournalRequest.php index 3a52580288..5e7a423dec 100644 --- a/app/Http/Requests/MassDeleteJournalRequest.php +++ b/app/Http/Requests/MassDeleteJournalRequest.php @@ -31,7 +31,7 @@ class MassDeleteJournalRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -40,7 +40,7 @@ class MassDeleteJournalRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed return [ diff --git a/app/Http/Requests/MassEditJournalRequest.php b/app/Http/Requests/MassEditJournalRequest.php index cd82765c6e..91bc871e33 100644 --- a/app/Http/Requests/MassEditJournalRequest.php +++ b/app/Http/Requests/MassEditJournalRequest.php @@ -31,7 +31,7 @@ class MassEditJournalRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -40,7 +40,7 @@ class MassEditJournalRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed diff --git a/app/Http/Requests/NewUserFormRequest.php b/app/Http/Requests/NewUserFormRequest.php index 30289dd69c..27c7042a2f 100644 --- a/app/Http/Requests/NewUserFormRequest.php +++ b/app/Http/Requests/NewUserFormRequest.php @@ -31,7 +31,7 @@ class NewUserFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -40,7 +40,7 @@ class NewUserFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed return [ diff --git a/app/Http/Requests/PiggyBankFormRequest.php b/app/Http/Requests/PiggyBankFormRequest.php index bd6488edd5..fadcaad5c7 100644 --- a/app/Http/Requests/PiggyBankFormRequest.php +++ b/app/Http/Requests/PiggyBankFormRequest.php @@ -30,7 +30,7 @@ class PiggyBankFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -54,7 +54,7 @@ class PiggyBankFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { $nameRule = 'required|between:1,255|uniquePiggyBankForUser'; if ($this->integer('id')) { diff --git a/app/Http/Requests/ProfileFormRequest.php b/app/Http/Requests/ProfileFormRequest.php index cfa825f247..c03c865ed9 100644 --- a/app/Http/Requests/ProfileFormRequest.php +++ b/app/Http/Requests/ProfileFormRequest.php @@ -31,7 +31,7 @@ class ProfileFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -40,7 +40,7 @@ class ProfileFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed return [ diff --git a/app/Http/Requests/ReconciliationUpdateRequest.php b/app/Http/Requests/ReconciliationUpdateRequest.php index 7e98b79186..e100866214 100644 --- a/app/Http/Requests/ReconciliationUpdateRequest.php +++ b/app/Http/Requests/ReconciliationUpdateRequest.php @@ -30,7 +30,7 @@ class ReconciliationUpdateRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -41,7 +41,7 @@ class ReconciliationUpdateRequest extends Request * * @return array */ - public function getJournalData() + public function getJournalData(): array { $data = [ 'tags' => explode(',', $this->string('tags')), @@ -55,7 +55,7 @@ class ReconciliationUpdateRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { $rules = [ 'amount' => 'numeric|required', diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php index 933aad993f..f07049ebc1 100644 --- a/app/Http/Requests/ReportFormRequest.php +++ b/app/Http/Requests/ReportFormRequest.php @@ -40,7 +40,7 @@ class ReportFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.php index 26952ac3f2..50a8b5f8fe 100644 --- a/app/Http/Requests/Request.php +++ b/app/Http/Requests/Request.php @@ -133,7 +133,7 @@ class Request extends FormRequest * * @return Carbon|null */ - protected function date(string $field) + protected function date(string $field): ?Carbon { return $this->get($field) ? new Carbon($this->get($field)) : null; } diff --git a/app/Http/Requests/RuleGroupFormRequest.php b/app/Http/Requests/RuleGroupFormRequest.php index dc2dc06ffd..dfe36c4514 100644 --- a/app/Http/Requests/RuleGroupFormRequest.php +++ b/app/Http/Requests/RuleGroupFormRequest.php @@ -32,7 +32,7 @@ class RuleGroupFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -52,7 +52,7 @@ class RuleGroupFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed /** @var RuleGroupRepositoryInterface $repository */ diff --git a/app/Http/Requests/SelectTransactionsRequest.php b/app/Http/Requests/SelectTransactionsRequest.php index 249613892a..8473d0d465 100644 --- a/app/Http/Requests/SelectTransactionsRequest.php +++ b/app/Http/Requests/SelectTransactionsRequest.php @@ -33,7 +33,7 @@ class SelectTransactionsRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -42,7 +42,7 @@ class SelectTransactionsRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed $sessionFirst = clone session('first'); diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php index 7dab913f9a..7254280d65 100644 --- a/app/Http/Requests/TagFormRequest.php +++ b/app/Http/Requests/TagFormRequest.php @@ -32,7 +32,7 @@ class TagFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); diff --git a/app/Http/Requests/TestRuleFormRequest.php b/app/Http/Requests/TestRuleFormRequest.php index c0f90fcd98..e8dadd3e00 100644 --- a/app/Http/Requests/TestRuleFormRequest.php +++ b/app/Http/Requests/TestRuleFormRequest.php @@ -31,7 +31,7 @@ class TestRuleFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -40,7 +40,7 @@ class TestRuleFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed $validTriggers = array_keys(config('firefly.rule-triggers')); diff --git a/app/Http/Requests/TokenFormRequest.php b/app/Http/Requests/TokenFormRequest.php index fd247f593e..25909b3e7b 100644 --- a/app/Http/Requests/TokenFormRequest.php +++ b/app/Http/Requests/TokenFormRequest.php @@ -31,7 +31,7 @@ class TokenFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -40,7 +40,7 @@ class TokenFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed return [ diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.php index a8aea7bc69..c5827f6db3 100644 --- a/app/Http/Requests/UserFormRequest.php +++ b/app/Http/Requests/UserFormRequest.php @@ -31,7 +31,7 @@ class UserFormRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only allow logged in users return auth()->check(); @@ -53,7 +53,7 @@ class UserFormRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { return [ 'id' => 'required|exists:users,id', diff --git a/app/Http/Requests/UserRegistrationRequest.php b/app/Http/Requests/UserRegistrationRequest.php index c02a04f481..1095c434b2 100644 --- a/app/Http/Requests/UserRegistrationRequest.php +++ b/app/Http/Requests/UserRegistrationRequest.php @@ -31,7 +31,7 @@ class UserRegistrationRequest extends Request /** * @return bool */ - public function authorize() + public function authorize(): bool { // Only everybody return true; @@ -40,7 +40,7 @@ class UserRegistrationRequest extends Request /** * @return array */ - public function rules() + public function rules(): array { // fixed return [