Specify return types.

This commit is contained in:
James Cole 2018-07-08 12:28:42 +02:00
parent b315882f58
commit d05a1e0260
70 changed files with 254 additions and 229 deletions

View File

@ -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));

View File

@ -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();

View File

@ -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()
{

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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');

View File

@ -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();

View File

@ -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');

View File

@ -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);

View File

@ -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');

View File

@ -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');

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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());
}

View File

@ -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.');

View File

@ -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') ?? [];

View File

@ -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);

View File

@ -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'));

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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 = [];

View File

@ -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;

View File

@ -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'));

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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'));

View File

@ -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'));

View File

@ -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;

View File

@ -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]);

View File

@ -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);

View File

@ -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'));

View File

@ -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')) {

View File

@ -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');

View File

@ -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 [

View File

@ -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'),

View File

@ -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 */

View File

@ -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 [

View File

@ -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

View File

@ -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);

View File

@ -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 = [

View File

@ -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 = [

View File

@ -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 [

View File

@ -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 [

View File

@ -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');

View File

@ -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 = [

View File

@ -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 = [];

View File

@ -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';

View File

@ -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 [

View File

@ -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

View File

@ -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 [

View File

@ -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')) {

View File

@ -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 [

View File

@ -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',

View File

@ -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();

View File

@ -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;
}

View File

@ -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 */

View File

@ -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');

View File

@ -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();

View File

@ -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'));

View File

@ -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 [

View File

@ -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',

View File

@ -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 [