From 7b41c5b30102ed20d50c3a226e9c5b7985855688 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 15 Jul 2018 09:38:49 +0200 Subject: [PATCH] Cast all translations to strings. --- app/Api/V1/Requests/BillRequest.php | 2 +- app/Api/V1/Requests/RuleRequest.php | 4 +- .../Controllers/Account/CreateController.php | 4 +- .../Controllers/Account/DeleteController.php | 4 +- .../Controllers/Account/EditController.php | 4 +- .../Controllers/Account/IndexController.php | 4 +- .../Account/ReconcileController.php | 14 +++--- .../Controllers/Account/ShowController.php | 6 +-- app/Http/Controllers/Admin/LinkController.php | 12 ++--- .../Controllers/Admin/UpdateController.php | 8 ++-- app/Http/Controllers/Admin/UserController.php | 2 +- app/Http/Controllers/AttachmentController.php | 6 +-- .../Auth/ForgotPasswordController.php | 2 +- app/Http/Controllers/BillController.php | 10 ++-- .../Controllers/Budget/AmountController.php | 2 +- .../Controllers/Budget/CreateController.php | 2 +- .../Controllers/Budget/DeleteController.php | 4 +- .../Controllers/Budget/EditController.php | 4 +- .../Controllers/Budget/IndexController.php | 2 +- .../Controllers/Budget/ShowController.php | 6 +-- .../Category/NoCategoryController.php | 4 +- .../Controllers/Category/ShowController.php | 4 +- app/Http/Controllers/CategoryController.php | 8 ++-- .../Controllers/Chart/AccountController.php | 4 +- app/Http/Controllers/Chart/BillController.php | 6 +-- .../Controllers/Chart/BudgetController.php | 2 +- .../Controllers/Chart/ReportController.php | 6 +-- app/Http/Controllers/CurrencyController.php | 34 +++++++------- app/Http/Controllers/DebugController.php | 2 +- app/Http/Controllers/ExportController.php | 4 +- app/Http/Controllers/HomeController.php | 2 +- .../Controllers/Import/IndexController.php | 6 +-- .../Import/JobConfigurationController.php | 8 ++-- .../Import/JobStatusController.php | 12 ++--- .../Import/PrerequisitesController.php | 8 ++-- app/Http/Controllers/Json/IntroController.php | 6 +-- .../Controllers/Json/ReconcileController.php | 2 +- app/Http/Controllers/JsonController.php | 4 +- app/Http/Controllers/NewUserController.php | 2 +- app/Http/Controllers/PiggyBankController.php | 8 ++-- .../Controllers/PreferencesController.php | 2 +- app/Http/Controllers/ProfileController.php | 2 +- .../Recurring/CreateController.php | 18 ++++---- .../Recurring/DeleteController.php | 4 +- .../Controllers/Recurring/EditController.php | 18 ++++---- .../Controllers/Recurring/IndexController.php | 14 +++--- app/Http/Controllers/ReportController.php | 24 +++++----- app/Http/Controllers/RuleController.php | 46 +++++++++---------- app/Http/Controllers/RuleGroupController.php | 8 ++-- app/Http/Controllers/SearchController.php | 4 +- app/Http/Controllers/TagController.php | 8 ++-- .../Transaction/BulkController.php | 6 +-- .../Transaction/ConvertController.php | 14 +++--- .../Transaction/LinkController.php | 14 +++--- .../Transaction/MassController.php | 10 ++-- .../Transaction/SingleController.php | 8 ++-- .../Transaction/SplitController.php | 4 +- .../Controllers/TransactionController.php | 8 ++-- app/Http/Middleware/Range.php | 2 +- app/Http/Requests/JournalFormRequest.php | 10 ++-- app/Http/Requests/SplitJournalFormRequest.php | 4 +- .../JobConfiguration/FakeJobConfiguration.php | 4 +- app/Import/Mapper/AssetAccountIbans.php | 2 +- app/Import/Mapper/AssetAccounts.php | 2 +- app/Import/Mapper/Bills.php | 2 +- app/Import/Mapper/Budgets.php | 2 +- app/Import/Mapper/Categories.php | 2 +- app/Import/Mapper/OpposingAccountIbans.php | 2 +- app/Import/Mapper/OpposingAccounts.php | 2 +- app/Import/Mapper/Tags.php | 2 +- app/Import/Mapper/TransactionCurrencies.php | 2 +- app/Import/Specifics/AbnAmroDescription.php | 2 +- app/Import/Storage/ImportArrayStorage.php | 2 +- app/Jobs/CreateRecurringTransactions.php | 2 +- .../Journal/JournalRepository.php | 16 +++---- .../Recurring/RecurringRepository.php | 10 ++-- app/Rules/BelongsUser.php | 2 +- app/Rules/IsValidAttachmentModel.php | 2 +- app/Rules/UniqueIban.php | 2 +- app/Rules/ValidRecurrenceRepetitionType.php | 2 +- app/Rules/ValidRecurrenceRepetitionValue.php | 2 +- app/Rules/ValidTransactions.php | 2 +- app/Services/Spectre/Object/Transaction.php | 2 +- app/Support/Amount.php | 2 +- app/Support/Binder/SimpleJournalList.php | 8 ++-- app/Support/ExpandedForm.php | 6 +-- .../Import/Information/BunqInformation.php | 1 - .../Bunq/ChooseAccountsHandler.php | 2 +- .../File/ConfigureRolesHandler.php | 2 +- .../File/ConfigureUploadHandler.php | 8 ++-- .../File/NewFileJobHandler.php | 4 +- .../Spectre/ChooseAccountsHandler.php | 2 +- .../Import/Placeholder/ImportTransaction.php | 2 +- app/Support/Navigation.php | 26 +++++------ app/Support/Twig/Extension/Transaction.php | 14 +++--- app/Support/Twig/Rule.php | 8 ++-- app/User.php | 4 +- app/Validation/RecurrenceValidation.php | 22 ++++----- app/Validation/TransactionValidation.php | 30 ++++++------ 99 files changed, 335 insertions(+), 336 deletions(-) diff --git a/app/Api/V1/Requests/BillRequest.php b/app/Api/V1/Requests/BillRequest.php index cdb6801365..79775b0c0a 100644 --- a/app/Api/V1/Requests/BillRequest.php +++ b/app/Api/V1/Requests/BillRequest.php @@ -115,7 +115,7 @@ class BillRequest extends Request $min = (float)($data['amount_min'] ?? 0); $max = (float)($data['amount_max'] ?? 0); if ($min > $max) { - $validator->errors()->add('amount_min', trans('validation.amount_min_over_max')); + $validator->errors()->add('amount_min', (string)trans('validation.amount_min_over_max')); } } ); diff --git a/app/Api/V1/Requests/RuleRequest.php b/app/Api/V1/Requests/RuleRequest.php index 7bc6b2b1be..fb32c34c97 100644 --- a/app/Api/V1/Requests/RuleRequest.php +++ b/app/Api/V1/Requests/RuleRequest.php @@ -141,7 +141,7 @@ class RuleRequest extends Request $repetitions = $data['rule-actions'] ?? []; // need at least one transaction if (0 === \count($repetitions)) { - $validator->errors()->add('title', trans('validation.at_least_one_action')); + $validator->errors()->add('title', (string)trans('validation.at_least_one_action')); } } @@ -156,7 +156,7 @@ class RuleRequest extends Request $repetitions = $data['rule-triggers'] ?? []; // need at least one transaction if (0 === \count($repetitions)) { - $validator->errors()->add('title', trans('validation.at_least_one_trigger')); + $validator->errors()->add('title', (string)trans('validation.at_least_one_trigger')); } } } \ No newline at end of file diff --git a/app/Http/Controllers/Account/CreateController.php b/app/Http/Controllers/Account/CreateController.php index 3d2be2799b..df4af66bb9 100644 --- a/app/Http/Controllers/Account/CreateController.php +++ b/app/Http/Controllers/Account/CreateController.php @@ -50,7 +50,7 @@ class CreateController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-credit-card'); - app('view')->share('title', trans('firefly.accounts')); + app('view')->share('title', (string)trans('firefly.accounts')); $this->repository = app(AccountRepositoryInterface::class); @@ -70,7 +70,7 @@ class CreateController extends Controller $what = $what ?? 'asset'; $defaultCurrency = app('amount')->getDefaultCurrency(); $subTitleIcon = config('firefly.subIconsByIdentifier.' . $what); - $subTitle = trans('firefly.make_new_' . $what . '_account'); + $subTitle = (string)trans('firefly.make_new_' . $what . '_account'); $roles = []; foreach (config('firefly.accountRoles') as $role) { $roles[$role] = (string)trans('firefly.account_role_' . $role); diff --git a/app/Http/Controllers/Account/DeleteController.php b/app/Http/Controllers/Account/DeleteController.php index cdae3afeee..0aa7532b17 100644 --- a/app/Http/Controllers/Account/DeleteController.php +++ b/app/Http/Controllers/Account/DeleteController.php @@ -50,7 +50,7 @@ class DeleteController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-credit-card'); - app('view')->share('title', trans('firefly.accounts')); + app('view')->share('title', (string)trans('firefly.accounts')); $this->repository = app(AccountRepositoryInterface::class); @@ -67,7 +67,7 @@ class DeleteController extends Controller public function delete(Account $account) { $typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type); - $subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]); + $subTitle = (string)trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]); $accountList = ExpandedForm::makeSelectListWithEmpty($this->repository->getAccountsByType([$account->accountType->type])); unset($accountList[$account->id]); diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.php index d55afb0d69..570113b762 100644 --- a/app/Http/Controllers/Account/EditController.php +++ b/app/Http/Controllers/Account/EditController.php @@ -53,7 +53,7 @@ class EditController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-credit-card'); - app('view')->share('title', trans('firefly.accounts')); + app('view')->share('title', (string)trans('firefly.accounts')); $this->repository = app(AccountRepositoryInterface::class); $this->currencyRepos = app(CurrencyRepositoryInterface::class); @@ -76,7 +76,7 @@ class EditController extends Controller public function edit(Request $request, Account $account, AccountRepositoryInterface $repository) { $what = config('firefly.shortNamesByFullName')[$account->accountType->type]; - $subTitle = trans('firefly.edit_' . $what . '_account', ['name' => $account->name]); + $subTitle = (string)trans('firefly.edit_' . $what . '_account', ['name' => $account->name]); $subTitleIcon = config('firefly.subIconsByIdentifier.' . $what); $roles = []; foreach (config('firefly.accountRoles') as $role) { diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.php index 07ac0643e1..2eaa3f49d6 100644 --- a/app/Http/Controllers/Account/IndexController.php +++ b/app/Http/Controllers/Account/IndexController.php @@ -50,7 +50,7 @@ class IndexController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-credit-card'); - app('view')->share('title', trans('firefly.accounts')); + app('view')->share('title', (string)trans('firefly.accounts')); $this->repository = app(AccountRepositoryInterface::class); @@ -68,7 +68,7 @@ class IndexController extends Controller public function index(Request $request, string $what) { $what = $what ?? 'asset'; - $subTitle = trans('firefly.' . $what . '_accounts'); + $subTitle = (string)trans('firefly.' . $what . '_accounts'); $subTitleIcon = config('firefly.subIconsByIdentifier.' . $what); $types = config('firefly.accountTypesByIdentifier.' . $what); $collection = $this->repository->getAccountsByType($types); diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php index f0596f4b05..62c670e23f 100644 --- a/app/Http/Controllers/Account/ReconcileController.php +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -64,7 +64,7 @@ class ReconcileController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-credit-card'); - app('view')->share('title', trans('firefly.accounts')); + app('view')->share('title', (string)trans('firefly.accounts')); $this->repository = app(JournalRepositoryInterface::class); $this->accountRepos = app(AccountRepositoryInterface::class); $this->currencyRepos = app(CurrencyRepositoryInterface::class); @@ -85,7 +85,7 @@ class ReconcileController extends Controller return redirect(route('transactions.edit', [$journal->id])); } // view related code - $subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); + $subTitle = (string)trans('breadcrumbs.edit_journal', ['description' => $journal->description]); // journal related code $pTransaction = $this->repository->getFirstPosTransaction($journal); @@ -126,7 +126,7 @@ class ReconcileController extends Controller return $this->redirectToOriginalAccount($account); } if (AccountType::ASSET !== $account->accountType->type) { - session()->flash('error', trans('firefly.must_be_asset_account')); + session()->flash('error', (string)trans('firefly.must_be_asset_account')); return redirect(route('accounts.index', [config('firefly.shortNamesByFullName.' . $account->accountType->type)])); } @@ -153,7 +153,7 @@ class ReconcileController extends Controller $startBalance = round(app('steam')->balance($account, $startDate), $currency->decimal_places); $endBalance = round(app('steam')->balance($account, $end), $currency->decimal_places); $subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type); - $subTitle = trans('firefly.reconcile_account', ['account' => $account->name]); + $subTitle = (string)trans('firefly.reconcile_account', ['account' => $account->name]); // various links $transactionsUri = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']); @@ -180,7 +180,7 @@ class ReconcileController extends Controller if (TransactionType::RECONCILIATION !== $journal->transactionType->type) { return redirect(route('transactions.show', [$journal->id])); } - $subTitle = trans('firefly.reconciliation') . ' "' . $journal->description . '"'; + $subTitle = (string)trans('firefly.reconciliation') . ' "' . $journal->description . '"'; // get main transaction: $transaction = $this->repository->getAssetTransaction($journal); @@ -272,7 +272,7 @@ class ReconcileController extends Controller } Log::debug('End of routine.'); app('preferences')->mark(); - session()->flash('success', trans('firefly.reconciliation_stored')); + session()->flash('success', (string)trans('firefly.reconciliation_stored')); return redirect(route('accounts.show', [$account->id])); } @@ -293,7 +293,7 @@ class ReconcileController extends Controller return redirect(route('transactions.show', [$journal->id])); } if (0 === bccomp('0', $request->get('amount'))) { - session()->flash('error', trans('firefly.amount_cannot_be_zero')); + session()->flash('error', (string)trans('firefly.amount_cannot_be_zero')); return redirect(route('accounts.reconcile.edit', [$journal->id]))->withInput(); } diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php index ba1d440ed4..e174fea0b9 100644 --- a/app/Http/Controllers/Account/ShowController.php +++ b/app/Http/Controllers/Account/ShowController.php @@ -61,7 +61,7 @@ class ShowController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-credit-card'); - app('view')->share('title', trans('firefly.accounts')); + app('view')->share('title', (string)trans('firefly.accounts')); $this->repository = app(AccountRepositoryInterface::class); $this->currencyRepos = app(CurrencyRepositoryInterface::class); @@ -107,7 +107,7 @@ class ShowController extends Controller } $fStart = $start->formatLocalized($this->monthAndDayFormat); $fEnd = $end->formatLocalized($this->monthAndDayFormat); - $subTitle = trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]); + $subTitle = (string)trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]); $chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); $periods = $this->getPeriodOverview($account, $end); /** @var JournalCollectorInterface $collector */ @@ -151,7 +151,7 @@ class ShowController extends Controller if (0 === $currencyId) { $currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore } - $subTitle = trans('firefly.all_journals_for_account', ['name' => $account->name]); + $subTitle = (string)trans('firefly.all_journals_for_account', ['name' => $account->name]); $periods = new Collection; /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.php index 1515260fd4..d0ab421605 100644 --- a/app/Http/Controllers/Admin/LinkController.php +++ b/app/Http/Controllers/Admin/LinkController.php @@ -58,7 +58,7 @@ class LinkController extends Controller */ public function create() { - $subTitle = trans('firefly.create_new_link_type'); + $subTitle = (string)trans('firefly.create_new_link_type'); $subTitleIcon = 'fa-link'; // put previous url in session if not redirect from store (not "create another"). @@ -84,11 +84,11 @@ class LinkController extends Controller return redirect(route('admin.links.index')); } - $subTitle = trans('firefly.delete_link_type', ['name' => $linkType->name]); + $subTitle = (string)trans('firefly.delete_link_type', ['name' => $linkType->name]); $otherTypes = $repository->get(); $count = $repository->countJournals($linkType); $moveTo = []; - $moveTo[0] = trans('firefly.do_not_save_connection'); + $moveTo[0] = (string)trans('firefly.do_not_save_connection'); /** @var LinkType $otherType */ foreach ($otherTypes as $otherType) { if ($otherType->id !== $linkType->id) { @@ -133,7 +133,7 @@ class LinkController extends Controller return redirect(route('admin.links.index')); } - $subTitle = trans('firefly.edit_link_type', ['name' => $linkType->name]); + $subTitle = (string)trans('firefly.edit_link_type', ['name' => $linkType->name]); $subTitleIcon = 'fa-link'; // put previous url in session if not redirect from store (not "return_to_edit"). @@ -152,7 +152,7 @@ class LinkController extends Controller */ public function index(LinkTypeRepositoryInterface $repository) { - $subTitle = trans('firefly.journal_link_configuration'); + $subTitle = (string)trans('firefly.journal_link_configuration'); $subTitleIcon = 'fa-link'; $linkTypes = $repository->get(); $linkTypes->each( @@ -171,7 +171,7 @@ class LinkController extends Controller */ public function show(LinkType $linkType) { - $subTitle = trans('firefly.overview_for_link', ['name' => $linkType->name]); + $subTitle = (string)trans('firefly.overview_for_link', ['name' => $linkType->name]); $subTitleIcon = 'fa-link'; $links = $linkType->transactionJournalLinks()->get(); diff --git a/app/Http/Controllers/Admin/UpdateController.php b/app/Http/Controllers/Admin/UpdateController.php index 9c4adfa4f7..5c8c7f54c9 100644 --- a/app/Http/Controllers/Admin/UpdateController.php +++ b/app/Http/Controllers/Admin/UpdateController.php @@ -62,14 +62,14 @@ class UpdateController extends Controller */ public function index() { - $subTitle = trans('firefly.update_check_title'); + $subTitle = (string)trans('firefly.update_check_title'); $subTitleIcon = 'fa-star'; $permission = app('fireflyconfig')->get('permission_update_check', -1); $selected = $permission->data; $options = [ - -1 => trans('firefly.updates_ask_me_later'), - 0 => trans('firefly.updates_do_not_check'), - 1 => trans('firefly.updates_enable_check'), + -1 => (string)trans('firefly.updates_ask_me_later'), + 0 => (string)trans('firefly.updates_do_not_check'), + 1 => (string)trans('firefly.updates_enable_check'), ]; return view('admin.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options')); diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index ba8b994ad9..b5772a8def 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -61,7 +61,7 @@ class UserController extends Controller */ public function delete(User $user) { - $subTitle = trans('firefly.delete_user', ['email' => $user->email]); + $subTitle = (string)trans('firefly.delete_user', ['email' => $user->email]); return view('admin.users.delete', compact('user', 'subTitle')); } diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 0e9fc5f01c..aa6f1bd32b 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -50,7 +50,7 @@ class AttachmentController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-paperclip'); - app('view')->share('title', trans('firefly.attachments')); + app('view')->share('title', (string)trans('firefly.attachments')); $this->repository = app(AttachmentRepositoryInterface::class); return $next($request); @@ -65,7 +65,7 @@ class AttachmentController extends Controller */ public function delete(Attachment $attachment) { - $subTitle = trans('firefly.delete_attachment', ['name' => $attachment->filename]); + $subTitle = (string)trans('firefly.delete_attachment', ['name' => $attachment->filename]); // put previous url in session $this->rememberPreviousUri('attachments.delete.uri'); @@ -131,7 +131,7 @@ class AttachmentController extends Controller public function edit(Request $request, Attachment $attachment) { $subTitleIcon = 'fa-pencil'; - $subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]); + $subTitle = (string)trans('firefly.edit_attachment', ['name' => $attachment->filename]); // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('attachments.edit.fromUpdate')) { diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index d5b28d405f..26b56d0928 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -75,7 +75,7 @@ class ForgotPasswordController extends Controller $user = User::where('email', $request->get('email'))->first(); if (null !== $user && $repository->hasRole($user, 'demo')) { - return back()->withErrors(['email' => trans('firefly.cannot_reset_demo_user')]); + return back()->withErrors(['email' => (string)trans('firefly.cannot_reset_demo_user')]); } // We will send the password reset link to this user. Once we have attempted diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index 9c29c05fe0..f190177da3 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -67,7 +67,7 @@ class BillController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.bills')); + app('view')->share('title', (string)trans('firefly.bills')); app('view')->share('mainTitleIcon', 'fa-calendar-o'); $this->attachments = app(AttachmentHelperInterface::class); $this->billRepository = app(BillRepositoryInterface::class); @@ -91,7 +91,7 @@ class BillController extends Controller foreach ($billPeriods as $current) { $periods[$current] = strtolower((string)trans('firefly.repeat_freq_' . $current)); } - $subTitle = trans('firefly.create_new_bill'); + $subTitle = (string)trans('firefly.create_new_bill'); $defaultCurrency = app('amount')->getDefaultCurrency(); // put previous url in session if not redirect from store (not "create another"). @@ -112,7 +112,7 @@ class BillController extends Controller { // put previous url in session $this->rememberPreviousUri('bills.delete.uri'); - $subTitle = trans('firefly.delete_bill', ['name' => $bill->name]); + $subTitle = (string)trans('firefly.delete_bill', ['name' => $bill->name]); return view('bills.delete', compact('bill', 'subTitle')); } @@ -147,10 +147,10 @@ class BillController extends Controller $billPeriods = config('firefly.bill_periods'); foreach ($billPeriods as $current) { - $periods[$current] = trans('firefly.' . $current); + $periods[$current] = (string)trans('firefly.' . $current); } - $subTitle = trans('firefly.edit_bill', ['name' => $bill->name]); + $subTitle = (string)trans('firefly.edit_bill', ['name' => $bill->name]); // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('bills.edit.fromUpdate')) { diff --git a/app/Http/Controllers/Budget/AmountController.php b/app/Http/Controllers/Budget/AmountController.php index 0696a387d6..4dc5fad5dd 100644 --- a/app/Http/Controllers/Budget/AmountController.php +++ b/app/Http/Controllers/Budget/AmountController.php @@ -58,7 +58,7 @@ class AmountController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.budgets')); + app('view')->share('title', (string)trans('firefly.budgets')); app('view')->share('mainTitleIcon', 'fa-tasks'); $this->repository = app(BudgetRepositoryInterface::class); diff --git a/app/Http/Controllers/Budget/CreateController.php b/app/Http/Controllers/Budget/CreateController.php index cbcc7c4d8b..3b671f255e 100644 --- a/app/Http/Controllers/Budget/CreateController.php +++ b/app/Http/Controllers/Budget/CreateController.php @@ -49,7 +49,7 @@ class CreateController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.budgets')); + app('view')->share('title', (string)trans('firefly.budgets')); app('view')->share('mainTitleIcon', 'fa-tasks'); $this->repository = app(BudgetRepositoryInterface::class); diff --git a/app/Http/Controllers/Budget/DeleteController.php b/app/Http/Controllers/Budget/DeleteController.php index d1c0e9ab25..bbe5d688eb 100644 --- a/app/Http/Controllers/Budget/DeleteController.php +++ b/app/Http/Controllers/Budget/DeleteController.php @@ -49,7 +49,7 @@ class DeleteController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.budgets')); + app('view')->share('title', (string)trans('firefly.budgets')); app('view')->share('mainTitleIcon', 'fa-tasks'); $this->repository = app(BudgetRepositoryInterface::class); @@ -66,7 +66,7 @@ class DeleteController extends Controller */ public function delete(Budget $budget) { - $subTitle = trans('firefly.delete_budget', ['name' => $budget->name]); + $subTitle = (string)trans('firefly.delete_budget', ['name' => $budget->name]); // put previous url in session $this->rememberPreviousUri('budgets.delete.uri'); diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.php index 8ccb72f71b..c621b47478 100644 --- a/app/Http/Controllers/Budget/EditController.php +++ b/app/Http/Controllers/Budget/EditController.php @@ -51,7 +51,7 @@ class EditController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.budgets')); + app('view')->share('title', (string)trans('firefly.budgets')); app('view')->share('mainTitleIcon', 'fa-tasks'); $this->repository = app(BudgetRepositoryInterface::class); @@ -68,7 +68,7 @@ class EditController extends Controller */ public function edit(Request $request, Budget $budget) { - $subTitle = trans('firefly.edit_budget', ['name' => $budget->name]); + $subTitle = (string)trans('firefly.edit_budget', ['name' => $budget->name]); // code to handle active-checkboxes $hasOldInput = null !== $request->old('_token'); diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php index 602d665f58..f3a7b43188 100644 --- a/app/Http/Controllers/Budget/IndexController.php +++ b/app/Http/Controllers/Budget/IndexController.php @@ -55,7 +55,7 @@ class IndexController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.budgets')); + app('view')->share('title', (string)trans('firefly.budgets')); app('view')->share('mainTitleIcon', 'fa-tasks'); $this->repository = app(BudgetRepositoryInterface::class); diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php index 1d815d8f5f..7d666382fb 100644 --- a/app/Http/Controllers/Budget/ShowController.php +++ b/app/Http/Controllers/Budget/ShowController.php @@ -58,7 +58,7 @@ class ShowController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.budgets')); + app('view')->share('title', (string)trans('firefly.budgets')); app('view')->share('mainTitleIcon', 'fa-tasks'); $this->repository = app(BudgetRepositoryInterface::class); @@ -106,7 +106,7 @@ class ShowController extends Controller */ public function noBudgetAll(Request $request, JournalRepositoryInterface $repository) { - $subTitle = trans('firefly.all_journals_without_budget'); + $subTitle = (string)trans('firefly.all_journals_without_budget'); $first = $repository->firstNull(); $start = null === $first ? new Carbon : $first->date; $end = new Carbon; @@ -148,7 +148,7 @@ class ShowController extends Controller $transactions = $collector->getPaginatedJournals(); $transactions->setPath(route('budgets.show', [$budget->id])); - $subTitle = trans('firefly.all_journals_for_budget', ['name' => $budget->name]); + $subTitle = (string)trans('firefly.all_journals_for_budget', ['name' => $budget->name]); return view('budgets.show', compact('limits', 'budget', 'repetition', 'transactions', 'subTitle')); } diff --git a/app/Http/Controllers/Category/NoCategoryController.php b/app/Http/Controllers/Category/NoCategoryController.php index a02b20dc95..9e4a098619 100644 --- a/app/Http/Controllers/Category/NoCategoryController.php +++ b/app/Http/Controllers/Category/NoCategoryController.php @@ -57,7 +57,7 @@ class NoCategoryController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.categories')); + app('view')->share('title', (string)trans('firefly.categories')); app('view')->share('mainTitleIcon', 'fa-bar-chart'); $this->journalRepos = app(JournalRepositoryInterface::class); $this->repository = app(CategoryRepositoryInterface::class); @@ -120,7 +120,7 @@ class NoCategoryController extends Controller $page = (int)$request->get('page'); $pageSize = (int)app('preferences')->get('listPageSize', 50)->data; Log::debug('Start of noCategory()'); - $subTitle = trans('firefly.all_journals_without_category'); + $subTitle = (string)trans('firefly.all_journals_without_category'); $first = $this->journalRepos->firstNull(); $start = null === $first ? new Carbon : $first->date; $end = new Carbon; diff --git a/app/Http/Controllers/Category/ShowController.php b/app/Http/Controllers/Category/ShowController.php index 824600dc2e..b7712d54de 100644 --- a/app/Http/Controllers/Category/ShowController.php +++ b/app/Http/Controllers/Category/ShowController.php @@ -63,7 +63,7 @@ class ShowController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.categories')); + app('view')->share('title', (string)trans('firefly.categories')); app('view')->share('mainTitleIcon', 'fa-bar-chart'); $this->journalRepos = app(JournalRepositoryInterface::class); $this->repository = app(CategoryRepositoryInterface::class); @@ -130,7 +130,7 @@ class ShowController extends Controller $periods = new Collection; $moment = 'all'; - $subTitle = trans('firefly.all_journals_for_category', ['name' => $category->name]); + $subTitle = (string)trans('firefly.all_journals_for_category', ['name' => $category->name]); $first = $this->repository->firstUseDate($category); /** @var Carbon $start */ $start = $first ?? new Carbon; diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 233cc93f34..1940a8b439 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -46,7 +46,7 @@ class CategoryController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.categories')); + app('view')->share('title', (string)trans('firefly.categories')); app('view')->share('mainTitleIcon', 'fa-bar-chart'); $this->repository = app(CategoryRepositoryInterface::class); @@ -66,7 +66,7 @@ class CategoryController extends Controller $this->rememberPreviousUri('categories.create.uri'); } $request->session()->forget('categories.create.fromStore'); - $subTitle = trans('firefly.create_new_category'); + $subTitle =(string)trans('firefly.create_new_category'); return view('categories.create', compact('subTitle')); } @@ -78,7 +78,7 @@ class CategoryController extends Controller */ public function delete(Category $category) { - $subTitle = trans('firefly.delete_category', ['name' => $category->name]); + $subTitle = (string)trans('firefly.delete_category', ['name' => $category->name]); // put previous url in session $this->rememberPreviousUri('categories.delete.uri'); @@ -111,7 +111,7 @@ class CategoryController extends Controller */ public function edit(Request $request, Category $category) { - $subTitle = trans('firefly.edit_category', ['name' => $category->name]); + $subTitle = (string)trans('firefly.edit_category', ['name' => $category->name]); // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('categories.edit.fromUpdate')) { diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index d5aa05d78f..433a773d0b 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -500,7 +500,7 @@ class AccountController extends Controller $return[$budgetId] = $grouped[$budgetId][0]['name']; } } - $return[0] = trans('firefly.no_budget'); + $return[0] = (string)trans('firefly.no_budget'); return $return; } @@ -524,7 +524,7 @@ class AccountController extends Controller $return[$categoryId] = $grouped[$categoryId][0]['name']; } } - $return[0] = trans('firefly.noCategory'); + $return[0] = (string)trans('firefly.noCategory'); return $return; } diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index 4a9a3bf3b1..2fb9bb408e 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -106,9 +106,9 @@ class BillController extends Controller } ); $chartData = [ - ['type' => 'bar', 'label' => trans('firefly.min-amount'), 'entries' => []], - ['type' => 'bar', 'label' => trans('firefly.max-amount'), 'entries' => []], - ['type' => 'line', 'label' => trans('firefly.journal-amount'), 'entries' => []], + ['type' => 'bar', 'label' => (string)trans('firefly.min-amount'), 'entries' => []], + ['type' => 'bar', 'label' => (string)trans('firefly.max-amount'), 'entries' => []], + ['type' => 'line', 'label' => (string)trans('firefly.journal-amount'), 'entries' => []], ]; /** @var Transaction $entry */ diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 6d2cfa8088..1b8dba0c61 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -510,7 +510,7 @@ class BudgetController extends Controller $return[$categoryId] = $grouped[$categoryId][0]['name']; } } - $return[0] = trans('firefly.noCategory'); + $return[0] = (string)trans('firefly.noCategory'); return $return; } diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php index 600fc46020..53aaefee34 100644 --- a/app/Http/Controllers/Chart/ReportController.php +++ b/app/Http/Controllers/Chart/ReportController.php @@ -111,13 +111,13 @@ class ReportController extends Controller $source = $this->getChartData($accounts, $start, $end); $chartData = [ [ - 'label' => trans('firefly.income'), + 'label' => (string)trans('firefly.income'), 'type' => 'bar', 'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green 'entries' => [], ], [ - 'label' => trans('firefly.expenses'), + 'label' => (string)trans('firefly.expenses'), 'type' => 'bar', 'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red 'entries' => [], @@ -199,7 +199,7 @@ class ReportController extends Controller ], ], [ - 'label' => trans('firefly.expenses'), + 'label' => (string)trans('firefly.expenses'), 'type' => 'bar', 'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red 'entries' => [ diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index 59051c9226..a655adfdf6 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -53,7 +53,7 @@ class CurrencyController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.currencies')); + app('view')->share('title', (string)trans('firefly.currencies')); app('view')->share('mainTitleIcon', 'fa-usd'); $this->repository = app(CurrencyRepositoryInterface::class); $this->userRepository = app(UserRepositoryInterface::class); @@ -74,13 +74,13 @@ class CurrencyController extends Controller /** @var User $user */ $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { - $request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); + $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); return redirect(route('currencies.index')); } $subTitleIcon = 'fa-plus'; - $subTitle = trans('firefly.create_currency'); + $subTitle = (string)trans('firefly.create_currency'); // put previous url in session if not redirect from store (not "create another"). if (true !== session('currencies.create.fromStore')) { @@ -102,7 +102,7 @@ class CurrencyController extends Controller app('preferences')->set('currencyPreference', $currency->code); app('preferences')->mark(); - $request->session()->flash('success', trans('firefly.new_default_currency', ['name' => $currency->name])); + $request->session()->flash('success', (string)trans('firefly.new_default_currency', ['name' => $currency->name])); Cache::forget('FFCURRENCYSYMBOL'); Cache::forget('FFCURRENCYCODE'); @@ -122,21 +122,21 @@ class CurrencyController extends Controller $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { // @codeCoverageIgnoreStart - $request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); + $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); return redirect(route('currencies.index')); // @codeCoverageIgnoreEnd } if (!$this->repository->canDeleteCurrency($currency)) { - $request->session()->flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name])); + $request->session()->flash('error', (string)trans('firefly.cannot_delete_currency', ['name' => $currency->name])); return redirect(route('currencies.index')); } // put previous url in session $this->rememberPreviousUri('currencies.delete.uri'); - $subTitle = trans('form.delete_currency', ['name' => $currency->name]); + $subTitle = (string)trans('form.delete_currency', ['name' => $currency->name]); return view('currencies.delete', compact('currency', 'subTitle')); } @@ -154,20 +154,20 @@ class CurrencyController extends Controller $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { // @codeCoverageIgnoreStart - $request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); + $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); return redirect(route('currencies.index')); // @codeCoverageIgnoreEnd } if (!$this->repository->canDeleteCurrency($currency)) { - $request->session()->flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name])); + $request->session()->flash('error', (string)trans('firefly.cannot_delete_currency', ['name' => $currency->name])); return redirect(route('currencies.index')); } $this->repository->destroy($currency); - $request->session()->flash('success', trans('firefly.deleted_currency', ['name' => $currency->name])); + $request->session()->flash('success', (string)trans('firefly.deleted_currency', ['name' => $currency->name])); return redirect($this->getPreviousUri('currencies.delete.uri')); } @@ -185,14 +185,14 @@ class CurrencyController extends Controller $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { // @codeCoverageIgnoreStart - $request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); + $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); return redirect(route('currencies.index')); // @codeCoverageIgnoreEnd } $subTitleIcon = 'fa-pencil'; - $subTitle = trans('breadcrumbs.edit_currency', ['name' => $currency->name]); + $subTitle = (string)trans('breadcrumbs.edit_currency', ['name' => $currency->name]); $currency->symbol = htmlentities($currency->symbol); // put previous url in session if not redirect from store (not "return_to_edit"). @@ -229,7 +229,7 @@ class CurrencyController extends Controller $defaultCurrency = $this->repository->getCurrencyByPreference(app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR'))); $isOwner = true; if (!$this->userRepository->hasRole($user, 'owner')) { - $request->session()->flash('info', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); + $request->session()->flash('info', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $isOwner = false; } @@ -258,7 +258,7 @@ class CurrencyController extends Controller $currency = $this->repository->store($data); $redirect = redirect($this->getPreviousUri('currencies.create.uri')); if (null !== $currency) { - $request->session()->flash('success', trans('firefly.created_currency', ['name' => $currency->name])); + $request->session()->flash('success', (string)trans('firefly.created_currency', ['name' => $currency->name])); if (1 === (int)$request->get('create_another')) { // @codeCoverageIgnoreStart @@ -269,7 +269,7 @@ class CurrencyController extends Controller } } if (null === $currency) { - $request->session()->flash('error', trans('firefly.could_not_store_currency')); + $request->session()->flash('error', (string)trans('firefly.could_not_store_currency')); } @@ -289,7 +289,7 @@ class CurrencyController extends Controller $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { // @codeCoverageIgnoreStart - $request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); + $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); return redirect(route('currencies.index')); // @codeCoverageIgnoreEnd @@ -297,7 +297,7 @@ class CurrencyController extends Controller $data = $request->getCurrencyData(); $currency = $this->repository->update($currency, $data); - $request->session()->flash('success', trans('firefly.updated_currency', ['name' => $currency->name])); + $request->session()->flash('success', (string)trans('firefly.updated_currency', ['name' => $currency->name])); app('preferences')->mark(); if (1 === (int)$request->get('return_to_edit')) { diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index dbdad0512d..989b4c2ea6 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -130,7 +130,7 @@ class DebugController extends Controller // set languages, see what happens: $original = setlocale(LC_ALL, 0); $localeAttempts = []; - $parts = explode(',', trans('config.locale')); + $parts = explode(',', (string)trans('config.locale')); foreach ($parts as $code) { $code = trim($code); $localeAttempts[$code] = var_export(setlocale(LC_ALL, $code), true); diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index aa7f320b10..6b45211868 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -48,7 +48,7 @@ class ExportController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-file-archive-o'); - app('view')->share('title', trans('firefly.export_and_backup_data')); + app('view')->share('title', (string)trans('firefly.export_and_backup_data')); return $next($request); } @@ -100,7 +100,7 @@ class ExportController extends Controller */ public function getStatus(ExportJob $job): JsonResponse { - return response()->json(['status' => trans('firefly.' . $job->status)]); + return response()->json(['status' => (string)trans('firefly.' . $job->status)]); } /** diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index ef151d2c02..71d3ec36a3 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -108,7 +108,7 @@ class HomeController extends Controller if (0 === $count) { return redirect(route('new-user.index')); } - $subTitle = trans('firefly.welcomeBack'); + $subTitle = (string)trans('firefly.welcomeBack'); $transactions = []; $frontPage = app('preferences')->get( 'frontPageAccounts', diff --git a/app/Http/Controllers/Import/IndexController.php b/app/Http/Controllers/Import/IndexController.php index 21a41c2a7d..5c5b8dddc6 100644 --- a/app/Http/Controllers/Import/IndexController.php +++ b/app/Http/Controllers/Import/IndexController.php @@ -53,7 +53,7 @@ class IndexController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-archive'); - app('view')->share('title', trans('firefly.import_index_title')); + app('view')->share('title', (string)trans('firefly.import_index_title')); $this->repository = app(ImportJobRepositoryInterface::class); $this->userRepository = app(UserRepositoryInterface::class); @@ -78,7 +78,7 @@ class IndexController extends Controller $providers = array_keys($this->getProviders()); if (!\in_array($importProvider, $providers, true)) { Log::error(sprintf('%s-provider is disabled. Cannot create job.', $importProvider)); - session()->flash('warning', trans('import.cannot_create_for_provider', ['provider' => $importProvider])); + session()->flash('warning', (string)trans('import.cannot_create_for_provider', ['provider' => $importProvider])); return redirect(route('import.index')); } @@ -185,7 +185,7 @@ class IndexController extends Controller public function index() { $providers = $this->getProviders(); - $subTitle = trans('import.index_breadcrumb'); + $subTitle = (string)trans('import.index_breadcrumb'); $subTitleIcon = 'fa-home'; return view('import.index', compact('subTitle', 'subTitleIcon', 'providers')); diff --git a/app/Http/Controllers/Import/JobConfigurationController.php b/app/Http/Controllers/Import/JobConfigurationController.php index fc11df8284..e68cafc78a 100644 --- a/app/Http/Controllers/Import/JobConfigurationController.php +++ b/app/Http/Controllers/Import/JobConfigurationController.php @@ -50,7 +50,7 @@ class JobConfigurationController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-archive'); - app('view')->share('title', trans('firefly.import_index_title')); + app('view')->share('title', (string)trans('firefly.import_index_title')); $this->repository = app(ImportJobRepositoryInterface::class); return $next($request); @@ -74,7 +74,7 @@ class JobConfigurationController extends Controller $allowed = ['has_prereq', 'need_job_config']; if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) { Log::debug(sprintf('Job has state "%s", but we only accept %s', $importJob->status, json_encode($allowed))); - session()->flash('error', trans('import.bad_job_status', ['status' => $importJob->status])); + session()->flash('error', (string)trans('import.bad_job_status', ['status' => $importJob->status])); return redirect(route('import.index')); } @@ -104,7 +104,7 @@ class JobConfigurationController extends Controller $view = $configurator->getNextView(); $data = $configurator->getNextData(); - $subTitle = trans('import.job_configuration_breadcrumb', ['key' => $importJob->key]); + $subTitle = (string)trans('import.job_configuration_breadcrumb', ['key' => $importJob->key]); $subTitleIcon = 'fa-wrench'; return view($view, compact('data', 'importJob', 'subTitle', 'subTitleIcon')); @@ -125,7 +125,7 @@ class JobConfigurationController extends Controller // catch impossible status: $allowed = ['has_prereq', 'need_job_config']; if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) { - session()->flash('error', trans('import.bad_job_status', ['status' => $importJob->status])); + session()->flash('error', (string)trans('import.bad_job_status', ['status' => $importJob->status])); return redirect(route('import.index')); } diff --git a/app/Http/Controllers/Import/JobStatusController.php b/app/Http/Controllers/Import/JobStatusController.php index 8cae35eb92..fea52a3f06 100644 --- a/app/Http/Controllers/Import/JobStatusController.php +++ b/app/Http/Controllers/Import/JobStatusController.php @@ -50,7 +50,7 @@ class JobStatusController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-archive'); - app('view')->share('title', trans('firefly.import_index_title')); + app('view')->share('title', (string)trans('firefly.import_index_title')); $this->repository = app(ImportJobRepositoryInterface::class); return $next($request); @@ -66,7 +66,7 @@ class JobStatusController extends Controller public function index(ImportJob $importJob) { $subTitleIcon = 'fa-gear'; - $subTitle = trans('import.job_status_breadcrumb', ['key' => $importJob->key]); + $subTitle = (string)trans('import.job_status_breadcrumb', ['key' => $importJob->key]); return view('import.status', compact('importJob', 'subTitle', 'subTitleIcon')); } @@ -85,7 +85,7 @@ class JobStatusController extends Controller 'count' => $count, 'tag_id' => $importJob->tag_id, 'tag_name' => null === $importJob->tag_id ? null : $importJob->tag->tag, - 'report_txt' => trans('import.unknown_import_result'), + 'report_txt' => (string)trans('import.unknown_import_result'), 'download_config' => false, 'download_config_text' => '', ]; @@ -93,8 +93,8 @@ class JobStatusController extends Controller if ('file' === $importJob->provider) { $json['download_config'] = true; $json['download_config_text'] - = trans('import.should_download_config', ['route' => route('import.job.download', [$importJob->key])]) . ' ' - . trans('import.share_config_file'); + = (string)trans('import.should_download_config', ['route' => route('import.job.download', [$importJob->key])]) . ' ' + . (string)trans('import.share_config_file'); } // if count is zero: @@ -102,7 +102,7 @@ class JobStatusController extends Controller $count = $importJob->tag->transactionJournals->count(); } if (0 === $count) { - $json['report_txt'] = trans('import.result_no_transactions'); + $json['report_txt'] = (string)trans('import.result_no_transactions'); } if (1 === $count && null !== $importJob->tag_id) { $json['report_txt'] = trans( diff --git a/app/Http/Controllers/Import/PrerequisitesController.php b/app/Http/Controllers/Import/PrerequisitesController.php index 8b37e1178b..709d0cc2fe 100644 --- a/app/Http/Controllers/Import/PrerequisitesController.php +++ b/app/Http/Controllers/Import/PrerequisitesController.php @@ -50,7 +50,7 @@ class PrerequisitesController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-archive'); - app('view')->share('title', trans('firefly.import_index_title')); + app('view')->share('title', (string)trans('firefly.import_index_title')); app('view')->share('subTitleIcon', 'fa-check'); $this->repository = app(ImportJobRepositoryInterface::class); @@ -76,12 +76,12 @@ class PrerequisitesController extends Controller $allowed = ['new']; if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) { Log::error(sprintf('Job has state "%s" but this Prerequisites::index() only accepts %s', $importJob->status, json_encode($allowed))); - session()->flash('error', trans('import.bad_job_status', ['status' => $importJob->status])); + session()->flash('error', (string)trans('import.bad_job_status', ['status' => $importJob->status])); return redirect(route('import.index')); } - app('view')->share('subTitle', trans('import.prerequisites_breadcrumb_' . $importProvider)); + app('view')->share('subTitle', (string)trans('import.prerequisites_breadcrumb_' . $importProvider)); $class = (string)config(sprintf('import.prerequisites.%s', $importProvider)); if (!class_exists($class)) { throw new FireflyException(sprintf('No class to handle prerequisites for "%s".', $importProvider)); // @codeCoverageIgnore @@ -132,7 +132,7 @@ class PrerequisitesController extends Controller $allowed = ['new']; if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) { Log::error(sprintf('Job has state "%s" but this Prerequisites::post() only accepts %s', $importJob->status, json_encode($allowed))); - session()->flash('error', trans('import.bad_job_status', ['status' => $importJob->status])); + session()->flash('error', (string)trans('import.bad_job_status', ['status' => $importJob->status])); return redirect(route('import.index')); } diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.php index 70870db0d5..13dd03262c 100644 --- a/app/Http/Controllers/Json/IntroController.php +++ b/app/Http/Controllers/Json/IntroController.php @@ -105,7 +105,7 @@ class IntroController Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key)); app('preferences')->set($key, false); - return response()->json(['message' => trans('firefly.intro_boxes_after_refresh')]); + return response()->json(['message' => (string)trans('firefly.intro_boxes_after_refresh')]); } /** @@ -142,7 +142,7 @@ class IntroController $currentStep = $options; // get the text: - $currentStep['intro'] = trans('intro.' . $route . '_' . $key); + $currentStep['intro'] = (string)trans('intro.' . $route . '_' . $key); // save in array: $steps[] = $currentStep; @@ -173,7 +173,7 @@ class IntroController $currentStep = $options; // get the text: - $currentStep['intro'] = trans('intro.' . $route . '_' . $specificPage . '_' . $key); + $currentStep['intro'] = (string)trans('intro.' . $route . '_' . $specificPage . '_' . $key); // save in array: $steps[] = $currentStep; diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php index cfea152bea..a837a210c4 100644 --- a/app/Http/Controllers/Json/ReconcileController.php +++ b/app/Http/Controllers/Json/ReconcileController.php @@ -64,7 +64,7 @@ class ReconcileController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-credit-card'); - app('view')->share('title', trans('firefly.accounts')); + app('view')->share('title', (string)trans('firefly.accounts')); $this->repository = app(JournalRepositoryInterface::class); $this->accountRepos = app(AccountRepositoryInterface::class); $this->currencyRepos = app(CurrencyRepositoryInterface::class); diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php index 86340617f1..ee26ffcc0a 100644 --- a/app/Http/Controllers/JsonController.php +++ b/app/Http/Controllers/JsonController.php @@ -42,7 +42,7 @@ class JsonController extends Controller $keys = array_keys(config('firefly.rule-actions')); $actions = []; foreach ($keys as $key) { - $actions[$key] = trans('firefly.rule_action_' . $key . '_choice'); + $actions[$key] = (string)trans('firefly.rule_action_' . $key . '_choice'); } $view = view('rules.partials.action', compact('actions', 'count'))->render(); @@ -62,7 +62,7 @@ class JsonController extends Controller $triggers = []; foreach ($keys as $key) { if ('user_action' !== $key) { - $triggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice'); + $triggers[$key] = (string)trans('firefly.rule_trigger_' . $key . '_choice'); } } asort($triggers); diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php index a6c8ac24bc..267d96beaf 100644 --- a/app/Http/Controllers/NewUserController.php +++ b/app/Http/Controllers/NewUserController.php @@ -58,7 +58,7 @@ class NewUserController extends Controller */ public function index() { - app('view')->share('title', trans('firefly.welcome')); + app('view')->share('title', (string)trans('firefly.welcome')); app('view')->share('mainTitleIcon', 'fa-fire'); $types = config('firefly.accountTypesByIdentifier.asset'); diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php index 8d03d667e1..f5133285a6 100644 --- a/app/Http/Controllers/PiggyBankController.php +++ b/app/Http/Controllers/PiggyBankController.php @@ -60,7 +60,7 @@ class PiggyBankController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.piggyBanks')); + app('view')->share('title', (string)trans('firefly.piggyBanks')); app('view')->share('mainTitleIcon', 'fa-sort-amount-asc'); $this->piggyRepos = app(PiggyBankRepositoryInterface::class); @@ -129,7 +129,7 @@ class PiggyBankController extends Controller */ public function create() { - $subTitle = trans('firefly.new_piggy_bank'); + $subTitle = (string)trans('firefly.new_piggy_bank'); $subTitleIcon = 'fa-plus'; // put previous url in session if not redirect from store (not "create another"). @@ -148,7 +148,7 @@ class PiggyBankController extends Controller */ public function delete(PiggyBank $piggyBank) { - $subTitle = trans('firefly.delete_piggy_bank', ['name' => $piggyBank->name]); + $subTitle = (string)trans('firefly.delete_piggy_bank', ['name' => $piggyBank->name]); // put previous url in session $this->rememberPreviousUri('piggy-banks.delete.uri'); @@ -177,7 +177,7 @@ class PiggyBankController extends Controller */ public function edit(PiggyBank $piggyBank) { - $subTitle = trans('firefly.update_piggy_title', ['name' => $piggyBank->name]); + $subTitle = (string)trans('firefly.update_piggy_title', ['name' => $piggyBank->name]); $subTitleIcon = 'fa-pencil'; $targetDate = null; $startDate = null; diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 92bdfb547e..be0d1cc62c 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -40,7 +40,7 @@ class PreferencesController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.preferences')); + app('view')->share('title', (string)trans('firefly.preferences')); app('view')->share('mainTitleIcon', 'fa-gear'); return $next($request); diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index a1e33f6855..db0e0b3023 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -61,7 +61,7 @@ class ProfileController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.profile')); + app('view')->share('title', (string)trans('firefly.profile')); app('view')->share('mainTitleIcon', 'fa-user'); return $next($request); diff --git a/app/Http/Controllers/Recurring/CreateController.php b/app/Http/Controllers/Recurring/CreateController.php index 559ad1b444..4cc9c77251 100644 --- a/app/Http/Controllers/Recurring/CreateController.php +++ b/app/Http/Controllers/Recurring/CreateController.php @@ -54,8 +54,8 @@ class CreateController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-paint-brush'); - app('view')->share('title', trans('firefly.recurrences')); - app('view')->share('subTitle', trans('firefly.create_new_recurrence')); + app('view')->share('title', (string)trans('firefly.recurrences')); + app('view')->share('subTitle', (string)trans('firefly.create_new_recurrence')); $this->recurring = app(RecurringRepositoryInterface::class); $this->budgets = app(BudgetRepositoryInterface::class); @@ -86,16 +86,16 @@ class CreateController extends Controller // when will it end? $repetitionEnds = [ - 'forever' => trans('firefly.repeat_forever'), - 'until_date' => trans('firefly.repeat_until_date'), - 'times' => trans('firefly.repeat_times'), + 'forever' => (string)trans('firefly.repeat_forever'), + 'until_date' => (string)trans('firefly.repeat_until_date'), + 'times' => (string)trans('firefly.repeat_times'), ]; // what to do in the weekend? $weekendResponses = [ - RecurrenceRepetition::WEEKEND_DO_NOTHING => trans('firefly.do_nothing'), - RecurrenceRepetition::WEEKEND_SKIP_CREATION => trans('firefly.skip_transaction'), - RecurrenceRepetition::WEEKEND_TO_FRIDAY => trans('firefly.jump_to_friday'), - RecurrenceRepetition::WEEKEND_TO_MONDAY => trans('firefly.jump_to_monday'), + RecurrenceRepetition::WEEKEND_DO_NOTHING => (string)trans('firefly.do_nothing'), + RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string)trans('firefly.skip_transaction'), + RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string)trans('firefly.jump_to_friday'), + RecurrenceRepetition::WEEKEND_TO_MONDAY => (string)trans('firefly.jump_to_monday'), ]; // flash some data: diff --git a/app/Http/Controllers/Recurring/DeleteController.php b/app/Http/Controllers/Recurring/DeleteController.php index a36a0ce018..2081551457 100644 --- a/app/Http/Controllers/Recurring/DeleteController.php +++ b/app/Http/Controllers/Recurring/DeleteController.php @@ -48,7 +48,7 @@ class DeleteController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-paint-brush'); - app('view')->share('title', trans('firefly.recurrences')); + app('view')->share('title', (string)trans('firefly.recurrences')); $this->recurring = app(RecurringRepositoryInterface::class); @@ -64,7 +64,7 @@ class DeleteController extends Controller */ public function delete(Recurrence $recurrence) { - $subTitle = trans('firefly.delete_recurring', ['title' => $recurrence->title]); + $subTitle = (string)trans('firefly.delete_recurring', ['title' => $recurrence->title]); // put previous url in session $this->rememberPreviousUri('recurrences.delete.uri'); diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.php index 6438361472..1305516655 100644 --- a/app/Http/Controllers/Recurring/EditController.php +++ b/app/Http/Controllers/Recurring/EditController.php @@ -56,8 +56,8 @@ class EditController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-paint-brush'); - app('view')->share('title', trans('firefly.recurrences')); - app('view')->share('subTitle', trans('firefly.recurrences')); + app('view')->share('title', (string)trans('firefly.recurrences')); + app('view')->share('subTitle', (string)trans('firefly.recurrences')); $this->recurring = app(RecurringRepositoryInterface::class); $this->budgets = app(BudgetRepositoryInterface::class); @@ -105,9 +105,9 @@ class EditController extends Controller $repetitionEnd = 'forever'; // types of repetitions: $repetitionEnds = [ - 'forever' => trans('firefly.repeat_forever'), - 'until_date' => trans('firefly.repeat_until_date'), - 'times' => trans('firefly.repeat_times'), + 'forever' => (string)trans('firefly.repeat_forever'), + 'until_date' => (string)trans('firefly.repeat_until_date'), + 'times' => (string)trans('firefly.repeat_times'), ]; if (null !== $recurrence->repeat_until) { $repetitionEnd = 'until_date'; @@ -118,10 +118,10 @@ class EditController extends Controller // what to do in the weekend? $weekendResponses = [ - RecurrenceRepetition::WEEKEND_DO_NOTHING => trans('firefly.do_nothing'), - RecurrenceRepetition::WEEKEND_SKIP_CREATION => trans('firefly.skip_transaction'), - RecurrenceRepetition::WEEKEND_TO_FRIDAY => trans('firefly.jump_to_friday'), - RecurrenceRepetition::WEEKEND_TO_MONDAY => trans('firefly.jump_to_monday'), + RecurrenceRepetition::WEEKEND_DO_NOTHING => (string)trans('firefly.do_nothing'), + RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string)trans('firefly.skip_transaction'), + RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string)trans('firefly.jump_to_friday'), + RecurrenceRepetition::WEEKEND_TO_MONDAY => (string)trans('firefly.jump_to_monday'), ]; // code to handle active-checkboxes diff --git a/app/Http/Controllers/Recurring/IndexController.php b/app/Http/Controllers/Recurring/IndexController.php index e2c75c1e8a..a731fd61ea 100644 --- a/app/Http/Controllers/Recurring/IndexController.php +++ b/app/Http/Controllers/Recurring/IndexController.php @@ -55,7 +55,7 @@ class IndexController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-paint-brush'); - app('view')->share('title', trans('firefly.recurrences')); + app('view')->share('title', (string)trans('firefly.recurrences')); $this->recurring = app(RecurringRepositoryInterface::class); @@ -201,7 +201,7 @@ class IndexController extends Controller } } - $subTitle = trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]); + $subTitle = (string)trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]); return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'transactions')); } @@ -225,12 +225,12 @@ class IndexController extends Controller $yearly = sprintf('yearly,%s', $date->format('Y-m-d')); $yearlyDate = $date->formatLocalized(trans('config.month_and_day_no_year')); $result = [ - 'daily' => ['label' => trans('firefly.recurring_daily'), 'selected' => 0 === strpos($preSelected, 'daily')], - $weekly => ['label' => trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]), 'selected' => 0 === strpos($preSelected, 'weekly')], - $monthly => ['label' => trans('firefly.recurring_monthly', ['dayOfMonth' => $date->day]), 'selected' => 0 === strpos($preSelected, 'monthly')], - $ndom => ['label' => trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]), + 'daily' => ['label' => (string)trans('firefly.recurring_daily'), 'selected' => 0 === strpos($preSelected, 'daily')], + $weekly => ['label' => (string)trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]), 'selected' => 0 === strpos($preSelected, 'weekly')], + $monthly => ['label' => (string)trans('firefly.recurring_monthly', ['dayOfMonth' => $date->day]), 'selected' => 0 === strpos($preSelected, 'monthly')], + $ndom => ['label' => (string)trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]), 'selected' => 0 === strpos($preSelected, 'ndom')], - $yearly => ['label' => trans('firefly.recurring_yearly', ['date' => $yearlyDate]), 'selected' => 0 === strpos($preSelected, 'yearly')], + $yearly => ['label' => (string)trans('firefly.recurring_yearly', ['date' => $yearlyDate]), 'selected' => 0 === strpos($preSelected, 'yearly')], ]; } diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 169e17ff84..5f00bded10 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -58,7 +58,7 @@ class ReportController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.reports')); + app('view')->share('title', (string)trans('firefly.reports')); app('view')->share('mainTitleIcon', 'fa-line-chart'); app('view')->share('subTitleIcon', 'fa-calendar'); $this->helper = app(ReportHelperInterface::class); @@ -81,7 +81,7 @@ class ReportController extends Controller public function accountReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end) { if ($end < $start) { - return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore + return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore } if ($start < session('first')) { @@ -115,7 +115,7 @@ class ReportController extends Controller public function auditReport(Collection $accounts, Carbon $start, Carbon $end) { if ($end < $start) { - return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore + return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore } if ($start < session('first')) { $start = session('first'); @@ -152,7 +152,7 @@ class ReportController extends Controller public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end) { if ($end < $start) { - return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore + return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore } if ($start < session('first')) { $start = session('first'); @@ -190,7 +190,7 @@ class ReportController extends Controller public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end) { if ($end < $start) { - return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore + return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore } if ($start < session('first')) { $start = session('first'); @@ -227,7 +227,7 @@ class ReportController extends Controller public function defaultReport(Collection $accounts, Carbon $start, Carbon $end) { if ($end < $start) { - return view('error')->with('message', trans('firefly.end_after_start_date')); + return view('error')->with('message', (string)trans('firefly.end_after_start_date')); } if ($start < session('first')) { @@ -322,31 +322,31 @@ class ReportController extends Controller if (0 === $request->getAccountList()->count()) { Log::debug('Account count is zero'); - session()->flash('error', trans('firefly.select_more_than_one_account')); + session()->flash('error', (string)trans('firefly.select_more_than_one_account')); return redirect(route('reports.index')); } if ('category' === $reportType && 0 === $request->getCategoryList()->count()) { - session()->flash('error', trans('firefly.select_more_than_one_category')); + session()->flash('error', (string)trans('firefly.select_more_than_one_category')); return redirect(route('reports.index')); } if ('budget' === $reportType && 0 === $request->getBudgetList()->count()) { - session()->flash('error', trans('firefly.select_more_than_one_budget')); + session()->flash('error', (string)trans('firefly.select_more_than_one_budget')); return redirect(route('reports.index')); } if ('tag' === $reportType && 0 === $request->getTagList()->count()) { - session()->flash('error', trans('firefly.select_more_than_one_tag')); + session()->flash('error', (string)trans('firefly.select_more_than_one_tag')); return redirect(route('reports.index')); } if ($request->getEndDate() < $request->getStartDate()) { - return view('error')->with('message', trans('firefly.end_after_start_date')); + return view('error')->with('message', (string)trans('firefly.end_after_start_date')); } switch ($reportType) { @@ -386,7 +386,7 @@ class ReportController extends Controller public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end) { if ($end < $start) { - return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore + return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore } if ($start < session('first')) { $start = session('first'); diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index 24ca0a01de..7083fa714e 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -69,7 +69,7 @@ class RuleController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.rules')); + app('view')->share('title', (string)trans('firefly.rules')); app('view')->share('mainTitleIcon', 'fa-random'); $this->accountRepos = app(AccountRepositoryInterface::class); @@ -121,8 +121,8 @@ class RuleController extends Controller if (null !== $bill && !$request->old()) { // create some sensible defaults: - $preFilled['title'] = trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]); - $preFilled['description'] = trans('firefly.new_rule_for_bill_description', ['name' => $bill->name]); + $preFilled['title'] = (string)trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]); + $preFilled['description'] = (string)trans('firefly.new_rule_for_bill_description', ['name' => $bill->name]); // get triggers and actions for bill: @@ -133,7 +133,7 @@ class RuleController extends Controller $triggerCount = \count($oldTriggers); $actionCount = \count($oldActions); $subTitleIcon = 'fa-clone'; - $subTitle = trans('firefly.make_new_rule', ['title' => $ruleGroup->title]); + $subTitle = (string)trans('firefly.make_new_rule', ['title' => $ruleGroup->title]); $request->session()->flash('preFilled', $preFilled); @@ -161,7 +161,7 @@ class RuleController extends Controller */ public function delete(Rule $rule) { - $subTitle = trans('firefly.delete_rule', ['title' => $rule->title]); + $subTitle = (string)trans('firefly.delete_rule', ['title' => $rule->title]); // put previous url in session $this->rememberPreviousUri('rules.delete.uri'); @@ -181,7 +181,7 @@ class RuleController extends Controller $title = $rule->title; $this->ruleRepos->destroy($rule); - session()->flash('success', trans('firefly.deleted_rule', ['title' => $title])); + session()->flash('success', (string)trans('firefly.deleted_rule', ['title' => $title])); app('preferences')->mark(); return redirect($this->getPreviousUri('rules.delete.uri')); @@ -237,7 +237,7 @@ class RuleController extends Controller // get rule trigger for update / store-journal: $primaryTrigger = $this->ruleRepos->getPrimaryTrigger($rule); - $subTitle = trans('firefly.edit_rule', ['title' => $rule->title]); + $subTitle = (string)trans('firefly.edit_rule', ['title' => $rule->title]); // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('rules.edit.fromUpdate')) { @@ -357,7 +357,7 @@ class RuleController extends Controller { $data = $request->getRuleData(); $rule = $this->ruleRepos->store($data); - session()->flash('success', trans('firefly.stored_new_rule', ['title' => $rule->title])); + session()->flash('success', (string)trans('firefly.stored_new_rule', ['title' => $rule->title])); app('preferences')->mark(); // redirect to show bill. @@ -400,7 +400,7 @@ class RuleController extends Controller $triggers = $this->getValidTriggerList($request); if (0 === \count($triggers)) { - return response()->json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore + return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore } $limit = (int)config('firefly.test-triggers.limit'); @@ -424,10 +424,10 @@ class RuleController extends Controller // Warn the user if only a subset of transactions is returned $warning = ''; if ($matchingTransactions->count() === $limit) { - $warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); // @codeCoverageIgnore + $warning = (string)trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); // @codeCoverageIgnore } if (0 === $matchingTransactions->count()) { - $warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); // @codeCoverageIgnore + $warning = (string)trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); // @codeCoverageIgnore } // Return json response @@ -462,7 +462,7 @@ class RuleController extends Controller $triggers = $rule->ruleTriggers; if (0 === \count($triggers)) { - return response()->json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore + return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore } $limit = (int)config('firefly.test-triggers.limit'); @@ -486,10 +486,10 @@ class RuleController extends Controller // Warn the user if only a subset of transactions is returned $warning = ''; if ($matchingTransactions->count() === $limit) { - $warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); // @codeCoverageIgnore + $warning = (string)trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); // @codeCoverageIgnore } if (0 === $matchingTransactions->count()) { - $warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); // @codeCoverageIgnore + $warning = (string)trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); // @codeCoverageIgnore } // Return json response @@ -530,7 +530,7 @@ class RuleController extends Controller $data = $request->getRuleData(); $this->ruleRepos->update($rule, $data); - session()->flash('success', trans('firefly.updated_rule', ['title' => $rule->title])); + session()->flash('success', (string)trans('firefly.updated_rule', ['title' => $rule->title])); app('preferences')->mark(); $redirect = redirect($this->getPreviousUri('rules.edit.uri')); if (1 === (int)$request->get('return_to_edit')) { @@ -553,20 +553,20 @@ class RuleController extends Controller $data = [ 'rule_group_id' => $this->ruleRepos->getFirstRuleGroup()->id, 'stop-processing' => 0, - 'title' => trans('firefly.default_rule_name'), - 'description' => trans('firefly.default_rule_description'), + 'title' => (string)trans('firefly.default_rule_name'), + 'description' => (string)trans('firefly.default_rule_description'), 'trigger' => 'store-journal', 'strict' => true, 'rule-triggers' => [ [ 'name' => 'description_is', - 'value' => trans('firefly.default_rule_trigger_description'), + 'value' => (string)trans('firefly.default_rule_trigger_description'), 'stop-processing' => false, ], [ 'name' => 'from_account_is', - 'value' => trans('firefly.default_rule_trigger_from_account'), + 'value' => (string)trans('firefly.default_rule_trigger_from_account'), 'stop-processing' => false, ], @@ -575,12 +575,12 @@ class RuleController extends Controller 'rule-actions' => [ [ 'name' => 'prepend_description', - 'value' => trans('firefly.default_rule_action_prepend'), + 'value' => (string)trans('firefly.default_rule_action_prepend'), 'stop-processing' => false, ], [ 'name' => 'set_category', - 'value' => trans('firefly.default_rule_action_set_category'), + 'value' => (string)trans('firefly.default_rule_action_set_category'), 'stop-processing' => false, ], ], @@ -597,8 +597,8 @@ class RuleController extends Controller { if (0 === $this->ruleGroupRepos->count()) { $data = [ - 'title' => trans('firefly.default_rule_group_name'), - 'description' => trans('firefly.default_rule_group_description'), + 'title' => (string)trans('firefly.default_rule_group_name'), + 'description' => (string)trans('firefly.default_rule_group_description'), ]; $this->ruleGroupRepos->store($data); diff --git a/app/Http/Controllers/RuleGroupController.php b/app/Http/Controllers/RuleGroupController.php index 50e4e2833f..2516ad77ea 100644 --- a/app/Http/Controllers/RuleGroupController.php +++ b/app/Http/Controllers/RuleGroupController.php @@ -47,7 +47,7 @@ class RuleGroupController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.rules')); + app('view')->share('title', (string)trans('firefly.rules')); app('view')->share('mainTitleIcon', 'fa-random'); return $next($request); @@ -61,7 +61,7 @@ class RuleGroupController extends Controller public function create() { $subTitleIcon = 'fa-clone'; - $subTitle = trans('firefly.make_new_rule_group'); + $subTitle = (string)trans('firefly.make_new_rule_group'); // put previous url in session if not redirect from store (not "create another"). if (true !== session('rule-groups.create.fromStore')) { @@ -79,7 +79,7 @@ class RuleGroupController extends Controller */ public function delete(RuleGroup $ruleGroup) { - $subTitle = trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]); + $subTitle = (string)trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]); // put previous url in session $this->rememberPreviousUri('rule-groups.delete.uri'); @@ -132,7 +132,7 @@ class RuleGroupController extends Controller */ public function edit(Request $request, RuleGroup $ruleGroup) { - $subTitle = trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]); + $subTitle = (string)trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]); $hasOldInput = null !== $request->old('_token'); $preFilled = [ diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 9e97fae2a2..21f0115c12 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -43,7 +43,7 @@ class SearchController extends Controller $this->middleware( function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-search'); - app('view')->share('title', trans('firefly.search')); + app('view')->share('title', (string)trans('firefly.search')); return $next($request); } @@ -63,7 +63,7 @@ class SearchController extends Controller // parse search terms: $searcher->parseQuery($fullQuery); $query = $searcher->getWordsAsString(); - $subTitle = trans('breadcrumbs.search_result', ['query' => $query]); + $subTitle = (string)trans('breadcrumbs.search_result', ['query' => $query]); return view('search.index', compact('query', 'fullQuery', 'subTitle')); } diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 529a26d4c1..cb43bbb42a 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -67,7 +67,7 @@ class TagController extends Controller */ public function create() { - $subTitle = trans('firefly.new_tag'); + $subTitle = (string)trans('firefly.new_tag'); $subTitleIcon = 'fa-tag'; // put previous url in session if not redirect from store (not "create another"). @@ -88,7 +88,7 @@ class TagController extends Controller */ public function delete(Tag $tag) { - $subTitle = trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]); + $subTitle = (string)trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]); // put previous url in session $this->rememberPreviousUri('tags.delete.uri'); @@ -121,7 +121,7 @@ class TagController extends Controller */ public function edit(Tag $tag) { - $subTitle = trans('firefly.edit_tag', ['tag' => $tag->tag]); + $subTitle = (string)trans('firefly.edit_tag', ['tag' => $tag->tag]); $subTitleIcon = 'fa-tag'; // put previous url in session if not redirect from store (not "return_to_edit"). @@ -184,7 +184,7 @@ class TagController extends Controller // prep for "all" view. if ('all' === $moment) { - $subTitle = trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]); + $subTitle = (string)trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]); $start = $this->repository->firstUseDate($tag); $end = new Carbon; $path = route('tags.show', [$tag->id, 'all']); diff --git a/app/Http/Controllers/Transaction/BulkController.php b/app/Http/Controllers/Transaction/BulkController.php index a2648b35e1..6237993e00 100644 --- a/app/Http/Controllers/Transaction/BulkController.php +++ b/app/Http/Controllers/Transaction/BulkController.php @@ -52,7 +52,7 @@ class BulkController extends Controller $this->middleware( function ($request, $next) { $this->repository = app(JournalRepositoryInterface::class); - app('view')->share('title', trans('firefly.transactions')); + app('view')->share('title', (string)trans('firefly.transactions')); app('view')->share('mainTitleIcon', 'fa-repeat'); return $next($request); @@ -67,7 +67,7 @@ class BulkController extends Controller */ public function edit(Collection $journals) { - $subTitle = trans('firefly.mass_bulk_journals'); + $subTitle = (string)trans('firefly.mass_bulk_journals'); // get list of budgets: /** @var BudgetRepositoryInterface $repository */ @@ -128,7 +128,7 @@ class BulkController extends Controller } app('preferences')->mark(); - $request->session()->flash('success', trans('firefly.mass_edited_transactions_success', ['amount' => $count])); + $request->session()->flash('success', (string)trans('firefly.mass_edited_transactions_success', ['amount' => $count])); // redirect to previous URL: return redirect($this->getPreviousUri('transactions.bulk-edit.uri')); diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.php index c6f45d7790..ca11f83e21 100644 --- a/app/Http/Controllers/Transaction/ConvertController.php +++ b/app/Http/Controllers/Transaction/ConvertController.php @@ -53,7 +53,7 @@ class ConvertController extends Controller function ($request, $next) { $this->repository = app(JournalRepositoryInterface::class); - app('view')->share('title', trans('firefly.transactions')); + app('view')->share('title', (string)trans('firefly.transactions')); app('view')->share('mainTitleIcon', 'fa-exchange'); return $next($request); @@ -79,13 +79,13 @@ class ConvertController extends Controller // @codeCoverageIgnoreEnd $positiveAmount = $this->repository->getJournalTotal($journal); $sourceType = $journal->transactionType; - $subTitle = trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]); + $subTitle = (string)trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]); $subTitleIcon = 'fa-exchange'; // cannot convert to its own type. if ($sourceType->type === $destinationType->type) { Log::debug('This is already a transaction of the expected type..'); - session()->flash('info', trans('firefly.convert_is_already_type_' . $destinationType->type)); + session()->flash('info', (string)trans('firefly.convert_is_already_type_' . $destinationType->type)); return redirect(route('transactions.show', [$journal->id])); } @@ -93,7 +93,7 @@ class ConvertController extends Controller // cannot convert split. if ($journal->transactions()->count() > 2) { Log::info('This journal has more than two transactions.'); - session()->flash('error', trans('firefly.cannot_convert_split_journal')); + session()->flash('error', (string)trans('firefly.cannot_convert_split_journal')); return redirect(route('transactions.show', [$journal->id])); } @@ -135,14 +135,14 @@ class ConvertController extends Controller if ($journal->transactionType->type === $destinationType->type) { Log::info('Journal is already of the desired type.'); - session()->flash('error', trans('firefly.convert_is_already_type_' . $destinationType->type)); + session()->flash('error', (string)trans('firefly.convert_is_already_type_' . $destinationType->type)); return redirect(route('transactions.show', [$journal->id])); } if ($journal->transactions()->count() > 2) { Log::info('Journal has more than two transactions.'); - session()->flash('error', trans('firefly.cannot_convert_split_journal')); + session()->flash('error', (string)trans('firefly.cannot_convert_split_journal')); return redirect(route('transactions.show', [$journal->id])); } @@ -158,7 +158,7 @@ class ConvertController extends Controller return redirect(route('transactions.convert.index', [strtolower($destinationType->type), $journal->id]))->withErrors($errors)->withInput(); } - session()->flash('success', trans('firefly.converted_to_' . $destinationType->type)); + session()->flash('success', (string)trans('firefly.converted_to_' . $destinationType->type)); return redirect(route('transactions.show', [$journal->id])); } diff --git a/app/Http/Controllers/Transaction/LinkController.php b/app/Http/Controllers/Transaction/LinkController.php index 0d5a3d4998..34cb561004 100644 --- a/app/Http/Controllers/Transaction/LinkController.php +++ b/app/Http/Controllers/Transaction/LinkController.php @@ -50,7 +50,7 @@ class LinkController extends Controller // some useful repositories: $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.transactions')); + app('view')->share('title', (string)trans('firefly.transactions')); app('view')->share('mainTitleIcon', 'fa-repeat'); $this->journalRepository = app(JournalRepositoryInterface::class); @@ -69,7 +69,7 @@ class LinkController extends Controller public function delete(TransactionJournalLink $link) { $subTitleIcon = 'fa-link'; - $subTitle = trans('breadcrumbs.delete_journal_link'); + $subTitle = (string)trans('breadcrumbs.delete_journal_link'); $this->rememberPreviousUri('journal_links.delete.uri'); return view('transactions.links.delete', compact('link', 'subTitle', 'subTitleIcon')); @@ -102,14 +102,14 @@ class LinkController extends Controller Log::debug('We are here (store)'); $linkInfo = $request->getLinkInfo(); if (0 === $linkInfo['transaction_journal_id']) { - session()->flash('error', trans('firefly.invalid_link_selection')); + session()->flash('error', (string)trans('firefly.invalid_link_selection')); return redirect(route('transactions.show', [$journal->id])); } $other = $this->journalRepository->findNull($linkInfo['transaction_journal_id']); if (null === $other) { - session()->flash('error', trans('firefly.invalid_link_selection')); + session()->flash('error', (string)trans('firefly.invalid_link_selection')); return redirect(route('transactions.show', [$journal->id])); } @@ -117,19 +117,19 @@ class LinkController extends Controller $alreadyLinked = $this->repository->findLink($journal, $other); if ($other->id === $journal->id) { - session()->flash('error', trans('firefly.journals_link_to_self')); + session()->flash('error', (string)trans('firefly.journals_link_to_self')); return redirect(route('transactions.show', [$journal->id])); } if ($alreadyLinked) { - session()->flash('error', trans('firefly.journals_error_linked')); + session()->flash('error', (string)trans('firefly.journals_error_linked')); return redirect(route('transactions.show', [$journal->id])); } Log::debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id)); $this->repository->storeLink($linkInfo, $other, $journal); - session()->flash('success', trans('firefly.journals_linked')); + session()->flash('success', (string)trans('firefly.journals_linked')); return redirect(route('transactions.show', [$journal->id])); } diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index 77063142f0..e8bb3ea05a 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -57,7 +57,7 @@ class MassController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.transactions')); + app('view')->share('title', (string)trans('firefly.transactions')); app('view')->share('mainTitleIcon', 'fa-repeat'); $this->repository = app(JournalRepositoryInterface::class); @@ -73,7 +73,7 @@ class MassController extends Controller */ public function delete(Collection $journals): IlluminateView { - $subTitle = trans('firefly.mass_delete_journals'); + $subTitle = (string)trans('firefly.mass_delete_journals'); // put previous url in session $this->rememberPreviousUri('transactions.mass-delete.uri'); @@ -110,7 +110,7 @@ class MassController extends Controller } app('preferences')->mark(); - session()->flash('success', trans('firefly.mass_deleted_transactions_success', ['amount' => $count])); + session()->flash('success', (string)trans('firefly.mass_deleted_transactions_success', ['amount' => $count])); // redirect to previous URL: return redirect($this->getPreviousUri('transactions.mass-delete.uri')); @@ -125,7 +125,7 @@ class MassController extends Controller { /** @var User $user */ $user = auth()->user(); - $subTitle = trans('firefly.mass_edit_journals'); + $subTitle = (string)trans('firefly.mass_edit_journals'); /** @var AccountRepositoryInterface $repository */ @@ -240,7 +240,7 @@ class MassController extends Controller } } app('preferences')->mark(); - session()->flash('success', trans('firefly.mass_edited_transactions_success', ['amount' => $count])); + session()->flash('success', (string)trans('firefly.mass_edited_transactions_success', ['amount' => $count])); // redirect to previous URL: return redirect($this->getPreviousUri('transactions.mass-edit.uri')); diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php index 6ebe79d23d..3fa181ec25 100644 --- a/app/Http/Controllers/Transaction/SingleController.php +++ b/app/Http/Controllers/Transaction/SingleController.php @@ -71,7 +71,7 @@ class SingleController extends Controller $this->attachments = app(AttachmentHelperInterface::class); $this->repository = app(JournalRepositoryInterface::class); - app('view')->share('title', trans('firefly.transactions')); + app('view')->share('title', (string)trans('firefly.transactions')); app('view')->share('mainTitleIcon', 'fa-repeat'); return $next($request); @@ -145,7 +145,7 @@ class SingleController extends Controller $what = (string)($request->old('what') ?? $what); $budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets()); $preFilled = session()->has('preFilled') ? session('preFilled') : []; - $subTitle = trans('form.add_new_' . $what); + $subTitle = (string)trans('form.add_new_' . $what); $subTitleIcon = 'fa-plus'; $optionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data; $source = (int)$request->get('source'); @@ -192,7 +192,7 @@ class SingleController extends Controller // @codeCoverageIgnoreEnd $what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type); - $subTitle = trans('firefly.delete_' . $what, ['description' => $journal->description]); + $subTitle = (string)trans('firefly.delete_' . $what, ['description' => $journal->description]); // put previous url in session $this->rememberPreviousUri('transactions.delete.uri'); @@ -253,7 +253,7 @@ class SingleController extends Controller $budgetList = ExpandedForm::makeSelectListWithEmpty($this->budgets->getBudgets()); // view related code - $subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); + $subTitle = (string)trans('breadcrumbs.edit_journal', ['description' => $journal->description]); // journal related code $sourceAccounts = $repository->getJournalSourceAccounts($journal); diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php index 42772721e4..86e75acede 100644 --- a/app/Http/Controllers/Transaction/SplitController.php +++ b/app/Http/Controllers/Transaction/SplitController.php @@ -72,7 +72,7 @@ class SplitController extends Controller $this->currencies = app(CurrencyRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class); app('view')->share('mainTitleIcon', 'fa-share-alt'); - app('view')->share('title', trans('firefly.split-transactions')); + app('view')->share('title', (string)trans('firefly.split-transactions')); return $next($request); } @@ -93,7 +93,7 @@ class SplitController extends Controller } // basic fields: $uploadSize = min(app('steam')->phpBytes(ini_get('upload_max_filesize')), app('steam')->phpBytes(ini_get('post_max_size'))); - $subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); + $subTitle = (string)trans('breadcrumbs.edit_journal', ['description' => $journal->description]); $subTitleIcon = 'fa-pencil'; // lists and collections diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 7c18e342a3..df344675b4 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -60,7 +60,7 @@ class TransactionController extends Controller $this->middleware( function ($request, $next) { - app('view')->share('title', trans('firefly.transactions')); + app('view')->share('title', (string)trans('firefly.transactions')); app('view')->share('mainTitleIcon', 'fa-repeat'); $this->repository = app(JournalRepositoryInterface::class); @@ -101,7 +101,7 @@ class TransactionController extends Controller $startStr = $start->formatLocalized($this->monthAndDayFormat); $endStr = $end->formatLocalized($this->monthAndDayFormat); - $subTitle = trans('firefly.title_' . $what . '_between', ['start' => $startStr, 'end' => $endStr]); + $subTitle = (string)trans('firefly.title_' . $what . '_between', ['start' => $startStr, 'end' => $endStr]); $periods = $this->getPeriodOverview($what, $end); /** @var JournalCollectorInterface $collector */ @@ -134,7 +134,7 @@ class TransactionController extends Controller $first = $this->repository->firstNull(); $start = null === $first ? new Carbon : $first->date; $end = new Carbon; - $subTitle = trans('firefly.all_' . $what); + $subTitle = (string)trans('firefly.all_' . $what); /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); @@ -230,7 +230,7 @@ class TransactionController extends Controller $events = $this->repository->getPiggyBankEvents($journal); $what = strtolower($transactionType); - $subTitle = trans('firefly.' . $what) . ' "' . $journal->description . '"'; + $subTitle = (string)trans('firefly.' . $what) . ' "' . $journal->description . '"'; return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions', 'linkTypes', 'links')); } diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php index 868d69a767..03aaa1aade 100644 --- a/app/Http/Middleware/Range.php +++ b/app/Http/Middleware/Range.php @@ -80,7 +80,7 @@ class Range $lang = $pref->data; App::setLocale($lang); Carbon::setLocale(substr($lang, 0, 2)); - $locale = explode(',', trans('config.locale')); + $locale = explode(',', (string)trans('config.locale')); $locale = array_map('trim', $locale); setlocale(LC_TIME, $locale); diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php index ac2068bbea..7c14013d74 100644 --- a/app/Http/Requests/JournalFormRequest.php +++ b/app/Http/Requests/JournalFormRequest.php @@ -250,7 +250,7 @@ class JournalFormRequest extends Request && 0 !== $accountCurrency ) { Log::debug('ADD validation error on native_amount'); - $validator->errors()->add('native_amount', trans('validation.numeric_native')); + $validator->errors()->add('native_amount', (string)trans('validation.numeric_native')); return; } @@ -265,7 +265,7 @@ class JournalFormRequest extends Request && 0 !== $selectedCurrency && 0 !== $accountCurrency ) { - $validator->errors()->add('native_amount', trans('validation.numeric_native')); + $validator->errors()->add('native_amount', (string)trans('validation.numeric_native')); return; } @@ -285,15 +285,15 @@ class JournalFormRequest extends Request && 0 !== $sourceCurrency && 0 !== $destinationCurrency ) { - $validator->errors()->add('source_amount', trans('validation.numeric_source')); + $validator->errors()->add('source_amount', (string)trans('validation.numeric_source')); } if ($sourceCurrency !== $destinationCurrency && '' === $destinationAmount && 0 !== $sourceCurrency && 0 !== $destinationCurrency ) { - $validator->errors()->add('destination_amount', trans('validation.numeric_destination')); - $validator->errors()->add('destination_amount', trans('validation.numeric', ['attribute' => 'destination_amount'])); + $validator->errors()->add('destination_amount', (string)trans('validation.numeric_destination')); + $validator->errors()->add('destination_amount', (string)trans('validation.numeric', ['attribute' => 'destination_amount'])); } return; diff --git a/app/Http/Requests/SplitJournalFormRequest.php b/app/Http/Requests/SplitJournalFormRequest.php index ec7b6316a3..fec9c93519 100644 --- a/app/Http/Requests/SplitJournalFormRequest.php +++ b/app/Http/Requests/SplitJournalFormRequest.php @@ -155,8 +155,8 @@ class SplitJournalFormRequest extends Request /** @var array $array */ foreach ($transactions as $array) { if (null !== $array['destination_id'] && null !== $array['source_id'] && $array['destination_id'] === $array['source_id']) { - $validator->errors()->add('journal_source_id', trans('validation.source_equals_destination')); - $validator->errors()->add('journal_destination_id', trans('validation.source_equals_destination')); + $validator->errors()->add('journal_source_id', (string)trans('validation.source_equals_destination')); + $validator->errors()->add('journal_destination_id', (string)trans('validation.source_equals_destination')); } } diff --git a/app/Import/JobConfiguration/FakeJobConfiguration.php b/app/Import/JobConfiguration/FakeJobConfiguration.php index 5408b030ad..2003a2b230 100644 --- a/app/Import/JobConfiguration/FakeJobConfiguration.php +++ b/app/Import/JobConfiguration/FakeJobConfiguration.php @@ -114,8 +114,8 @@ class FakeJobConfiguration implements JobConfigurationInterface { return [ 'rulesOptions' => [ - 1 => trans('firefly.yes'), - 0 => trans('firefly.no'), + 1 => (string)trans('firefly.yes'), + 0 => (string)trans('firefly.no'), ], ]; } diff --git a/app/Import/Mapper/AssetAccountIbans.php b/app/Import/Mapper/AssetAccountIbans.php index 9460771bd6..3d166184b7 100644 --- a/app/Import/Mapper/AssetAccountIbans.php +++ b/app/Import/Mapper/AssetAccountIbans.php @@ -56,7 +56,7 @@ class AssetAccountIbans implements MapperInterface /** @noinspection AdditionOperationOnArraysInspection */ $list = $topList + $list; asort($list); - $list = [0 => trans('import.map_do_not_map')] + $list; + $list = [0 => (string)trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/AssetAccounts.php b/app/Import/Mapper/AssetAccounts.php index 23d8b23322..c5754a3717 100644 --- a/app/Import/Mapper/AssetAccounts.php +++ b/app/Import/Mapper/AssetAccounts.php @@ -52,7 +52,7 @@ class AssetAccounts implements MapperInterface $list[$accountId] = $name; } asort($list); - $list = [0 => trans('import.map_do_not_map')] + $list; + $list = [0 => (string)trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/Bills.php b/app/Import/Mapper/Bills.php index 8caa0f76a3..8e8c8efa2e 100644 --- a/app/Import/Mapper/Bills.php +++ b/app/Import/Mapper/Bills.php @@ -46,7 +46,7 @@ class Bills implements MapperInterface $list[$billId] = $bill->name; } asort($list); - $list = [0 => trans('import.map_do_not_map')] + $list; + $list = [0 => (string)trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/Budgets.php b/app/Import/Mapper/Budgets.php index 4c566611b4..d8399dce85 100644 --- a/app/Import/Mapper/Budgets.php +++ b/app/Import/Mapper/Budgets.php @@ -46,7 +46,7 @@ class Budgets implements MapperInterface $list[$budgetId] = $budget->name; } asort($list); - $list = [0 => trans('import.map_do_not_map')] + $list; + $list = [0 => (string)trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/Categories.php b/app/Import/Mapper/Categories.php index e8cddc8c2c..bb840743e5 100644 --- a/app/Import/Mapper/Categories.php +++ b/app/Import/Mapper/Categories.php @@ -46,7 +46,7 @@ class Categories implements MapperInterface $list[$categoryId] = $category->name; } asort($list); - $list = [0 => trans('import.map_do_not_map')] + $list; + $list = [0 => (string)trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/OpposingAccountIbans.php b/app/Import/Mapper/OpposingAccountIbans.php index a567648563..a8b3d4eb99 100644 --- a/app/Import/Mapper/OpposingAccountIbans.php +++ b/app/Import/Mapper/OpposingAccountIbans.php @@ -61,7 +61,7 @@ class OpposingAccountIbans implements MapperInterface } $list = $topList + $list; asort($list); - $list = [0 => trans('import.map_do_not_map')] + $list; + $list = [0 => (string)trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/OpposingAccounts.php b/app/Import/Mapper/OpposingAccounts.php index b5ee6089b5..e887078758 100644 --- a/app/Import/Mapper/OpposingAccounts.php +++ b/app/Import/Mapper/OpposingAccounts.php @@ -58,7 +58,7 @@ class OpposingAccounts implements MapperInterface $list[$accountId] = $name; } asort($list); - $list = [0 => trans('import.map_do_not_map')] + $list; + $list = [0 => (string)trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/Tags.php b/app/Import/Mapper/Tags.php index b2cfa3f630..e81fb2a2be 100644 --- a/app/Import/Mapper/Tags.php +++ b/app/Import/Mapper/Tags.php @@ -46,7 +46,7 @@ class Tags implements MapperInterface $list[$tagId] = $tag->tag; } asort($list); - $list = [0 => trans('import.map_do_not_map')] + $list; + $list = [0 => (string)trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/TransactionCurrencies.php b/app/Import/Mapper/TransactionCurrencies.php index e9fa683bce..b0eaf956bd 100644 --- a/app/Import/Mapper/TransactionCurrencies.php +++ b/app/Import/Mapper/TransactionCurrencies.php @@ -44,7 +44,7 @@ class TransactionCurrencies implements MapperInterface } asort($list); - $list = [0 => trans('import.map_do_not_map')] + $list; + $list = [0 => (string)trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Specifics/AbnAmroDescription.php b/app/Import/Specifics/AbnAmroDescription.php index b714734836..dcdb8600c3 100644 --- a/app/Import/Specifics/AbnAmroDescription.php +++ b/app/Import/Specifics/AbnAmroDescription.php @@ -72,7 +72,7 @@ class AbnAmroDescription implements SpecificInterface // If the description could not be parsed, specify an unknown opposing // account, as an opposing account is required if (!$parsed) { - $this->row[8] = trans('firefly.unknown'); // opposing-account-name + $this->row[8] = (string)trans('firefly.unknown'); // opposing-account-name } return $this->row; diff --git a/app/Import/Storage/ImportArrayStorage.php b/app/Import/Storage/ImportArrayStorage.php index 15d5ae58fa..551bec3d14 100644 --- a/app/Import/Storage/ImportArrayStorage.php +++ b/app/Import/Storage/ImportArrayStorage.php @@ -260,7 +260,7 @@ class ImportArrayStorage $repository = app(TagRepositoryInterface::class); $repository->setUser($this->importJob->user); $data = [ - 'tag' => trans('import.import_with_key', ['key' => $this->importJob->key]), + 'tag' => (string)trans('import.import_with_key', ['key' => $this->importJob->key]), 'date' => new Carbon, 'description' => null, 'latitude' => null, diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.php index d4a09795af..2240394ec2 100644 --- a/app/Jobs/CreateRecurringTransactions.php +++ b/app/Jobs/CreateRecurringTransactions.php @@ -255,7 +255,7 @@ class CreateRecurringTransactions implements ShouldQueue 'date' => $date, 'tags' => $this->repository->getTags($recurrence), 'user' => $recurrence->user_id, - 'notes' => trans('firefly.created_from_recurrence', ['id' => $recurrence->id, 'title' => $recurrence->title]), + 'notes' => (string)trans('firefly.created_from_recurrence', ['id' => $recurrence->id, 'title' => $recurrence->title]), // journal data: 'description' => $recurrence->recurrenceTransactions()->first()->description, diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index e79df9d0a5..d5e58f96f6 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -64,10 +64,10 @@ class JournalRepository implements JournalRepositoryInterface if ($source->id === $destination->id || null === $source->id || null === $destination->id) { // default message bag that shows errors for everything. $messages = new MessageBag; - $messages->add('source_account_revenue', trans('firefly.invalid_convert_selection')); - $messages->add('destination_account_asset', trans('firefly.invalid_convert_selection')); - $messages->add('destination_account_expense', trans('firefly.invalid_convert_selection')); - $messages->add('source_account_asset', trans('firefly.invalid_convert_selection')); + $messages->add('source_account_revenue', (string)trans('firefly.invalid_convert_selection')); + $messages->add('destination_account_asset', (string)trans('firefly.invalid_convert_selection')); + $messages->add('destination_account_expense', (string)trans('firefly.invalid_convert_selection')); + $messages->add('source_account_asset', (string)trans('firefly.invalid_convert_selection')); return $messages; } @@ -78,10 +78,10 @@ class JournalRepository implements JournalRepositoryInterface // default message bag that shows errors for everything. $messages = new MessageBag; - $messages->add('source_account_revenue', trans('firefly.source_or_dest_invalid')); - $messages->add('destination_account_asset', trans('firefly.source_or_dest_invalid')); - $messages->add('destination_account_expense', trans('firefly.source_or_dest_invalid')); - $messages->add('source_account_asset', trans('firefly.source_or_dest_invalid')); + $messages->add('source_account_revenue', (string)trans('firefly.source_or_dest_invalid')); + $messages->add('destination_account_asset', (string)trans('firefly.source_or_dest_invalid')); + $messages->add('destination_account_expense', (string)trans('firefly.source_or_dest_invalid')); + $messages->add('source_account_asset', (string)trans('firefly.source_or_dest_invalid')); return $messages; } diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php index 43be804321..31b6a3b8d9 100644 --- a/app/Repositories/Recurring/RecurringRepository.php +++ b/app/Repositories/Recurring/RecurringRepository.php @@ -526,23 +526,23 @@ class RecurringRepository implements RecurringRepositoryInterface throw new FireflyException(sprintf('Cannot translate recurring transaction repetition type "%s"', $repetition->repetition_type)); break; case 'daily': - return trans('firefly.recurring_daily', [], $language); + return (string)trans('firefly.recurring_daily', [], $language); break; case 'weekly': $dayOfWeek = trans(sprintf('config.dow_%s', $repetition->repetition_moment), [], $language); - return trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek], $language); + return (string)trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek], $language); break; case 'monthly': // format a date: - return trans('firefly.recurring_monthly', ['dayOfMonth' => $repetition->repetition_moment], $language); + return (string)trans('firefly.recurring_monthly', ['dayOfMonth' => $repetition->repetition_moment], $language); break; case 'ndom': $parts = explode(',', $repetition->repetition_moment); // first part is number of week, second is weekday. $dayOfWeek = trans(sprintf('config.dow_%s', $parts[1]), [], $language); - return trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $parts[0]], $language); + return (string)trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $parts[0]], $language); break; case 'yearly': // @@ -553,7 +553,7 @@ class RecurringRepository implements RecurringRepositoryInterface $repDate->addYears($diffInYears); // technically not necessary. $string = $repDate->formatLocalized(trans('config.month_and_day_no_year')); - return trans('firefly.recurring_yearly', ['date' => $string], $language); + return (string)trans('firefly.recurring_yearly', ['date' => $string], $language); break; } diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.php index c96ba66a19..bc1ee68f3e 100644 --- a/app/Rules/BelongsUser.php +++ b/app/Rules/BelongsUser.php @@ -54,7 +54,7 @@ class BelongsUser implements Rule */ public function message() { - return trans('validation.belongs_user'); + return (string)trans('validation.belongs_user'); } /** diff --git a/app/Rules/IsValidAttachmentModel.php b/app/Rules/IsValidAttachmentModel.php index 954e5a2151..9e817f22d1 100644 --- a/app/Rules/IsValidAttachmentModel.php +++ b/app/Rules/IsValidAttachmentModel.php @@ -54,7 +54,7 @@ class IsValidAttachmentModel implements Rule */ public function message(): string { - return trans('validation.model_id_invalid'); + return (string)trans('validation.model_id_invalid'); } /** diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.php index 5af463b6b4..a710ae78ad 100644 --- a/app/Rules/UniqueIban.php +++ b/app/Rules/UniqueIban.php @@ -59,7 +59,7 @@ class UniqueIban implements Rule */ public function message() { - return trans('validation.unique_iban_for_user'); + return (string)trans('validation.unique_iban_for_user'); } /** diff --git a/app/Rules/ValidRecurrenceRepetitionType.php b/app/Rules/ValidRecurrenceRepetitionType.php index c8aa3eedbd..06b3d07cad 100644 --- a/app/Rules/ValidRecurrenceRepetitionType.php +++ b/app/Rules/ValidRecurrenceRepetitionType.php @@ -38,7 +38,7 @@ class ValidRecurrenceRepetitionType implements Rule */ public function message(): string { - return trans('validation.valid_recurrence_rep_type'); + return (string)trans('validation.valid_recurrence_rep_type'); } /** diff --git a/app/Rules/ValidRecurrenceRepetitionValue.php b/app/Rules/ValidRecurrenceRepetitionValue.php index 3e2afe32a5..8c838a8991 100644 --- a/app/Rules/ValidRecurrenceRepetitionValue.php +++ b/app/Rules/ValidRecurrenceRepetitionValue.php @@ -41,7 +41,7 @@ class ValidRecurrenceRepetitionValue implements Rule */ public function message(): string { - return trans('validation.valid_recurrence_rep_type'); + return (string)trans('validation.valid_recurrence_rep_type'); } /** diff --git a/app/Rules/ValidTransactions.php b/app/Rules/ValidTransactions.php index 888c98adf7..17a8e714ee 100644 --- a/app/Rules/ValidTransactions.php +++ b/app/Rules/ValidTransactions.php @@ -51,7 +51,7 @@ class ValidTransactions implements Rule */ public function message() { - return trans('validation.invalid_selection'); + return (string)trans('validation.invalid_selection'); } /** diff --git a/app/Services/Spectre/Object/Transaction.php b/app/Services/Spectre/Object/Transaction.php index 58739d23e9..0ebd50cd2e 100644 --- a/app/Services/Spectre/Object/Transaction.php +++ b/app/Services/Spectre/Object/Transaction.php @@ -186,7 +186,7 @@ class Transaction extends SpectreObject switch ($key) { case 'account_number': $data['number'] = $value; - $data['name'] = $data['name'] ?? trans('import.spectre_account_with_number', ['number' => $value]); + $data['name'] = $data['name'] ?? (string)trans('import.spectre_account_with_number', ['number' => $value]); break; case 'payee': $data['name'] = $value; diff --git a/app/Support/Amount.php b/app/Support/Amount.php index 5426d27ece..01973c203d 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -118,7 +118,7 @@ class Amount */ public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true): string { - $locale = explode(',', trans('config.locale')); + $locale = explode(',', (string)trans('config.locale')); $locale = array_map('trim', $locale); setlocale(LC_MONETARY, $locale); $float = round($amount, 12); diff --git a/app/Support/Binder/SimpleJournalList.php b/app/Support/Binder/SimpleJournalList.php index 070aa6dd06..6375208c1c 100644 --- a/app/Support/Binder/SimpleJournalList.php +++ b/app/Support/Binder/SimpleJournalList.php @@ -74,22 +74,22 @@ class SimpleJournalList implements BinderInterface $sources = $repository->getJournalSourceAccounts($journal); $destinations = $repository->getJournalDestinationAccounts($journal); if ($sources->count() > 1) { - $messages[] = trans('firefly.cannot_edit_multiple_source', ['description' => $journal->description, 'id' => $journal->id]); + $messages[] = (string)trans('firefly.cannot_edit_multiple_source', ['description' => $journal->description, 'id' => $journal->id]); continue; } if ($destinations->count() > 1) { - $messages[] = trans('firefly.cannot_edit_multiple_dest', ['description' => $journal->description, 'id' => $journal->id]); + $messages[] = (string)trans('firefly.cannot_edit_multiple_dest', ['description' => $journal->description, 'id' => $journal->id]); continue; } if (TransactionType::OPENING_BALANCE === $repository->getTransactionType($journal)) { - $messages[] = trans('firefly.cannot_edit_opening_balance'); + $messages[] = (string)trans('firefly.cannot_edit_opening_balance'); continue; } // cannot edit reconciled transactions / journals: if ($repository->isJournalReconciled($journal)) { - $messages[] = trans('firefly.cannot_edit_reconciled', ['description' => $journal->description, 'id' => $journal->id]); + $messages[] = (string)trans('firefly.cannot_edit_reconciled', ['description' => $journal->description, 'id' => $journal->id]); continue; } diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 24669d64a0..487a5d4da9 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -302,7 +302,7 @@ class ExpandedForm // get all currencies: $list = $currencyRepos->get(); $array = [ - 0 => trans('firefly.no_currency'), + 0 => (string)trans('firefly.no_currency'), ]; /** @var TransactionCurrency $currency */ foreach ($list as $currency) { @@ -593,7 +593,7 @@ class ExpandedForm $repository = app(PiggyBankRepositoryInterface::class); $piggyBanks = $repository->getPiggyBanksWithAmount(); $array = [ - 0 => trans('firefly.none_in_select_list'), + 0 => (string)trans('firefly.none_in_select_list'), ]; /** @var PiggyBank $piggy */ foreach ($piggyBanks as $piggy) { @@ -644,7 +644,7 @@ class ExpandedForm // get all currencies: $list = $groupRepos->get(); $array = [ - 0 => trans('firefly.none_in_select_list'), + 0 => (string)trans('firefly.none_in_select_list'), ]; /** @var RuleGroup $group */ foreach ($list as $group) { diff --git a/app/Support/Import/Information/BunqInformation.php b/app/Support/Import/Information/BunqInformation.php index 33dbf1a273..fe45cba550 100644 --- a/app/Support/Import/Information/BunqInformation.php +++ b/app/Support/Import/Information/BunqInformation.php @@ -34,7 +34,6 @@ use FireflyIII\Support\CacheProperties; use FireflyIII\User; use Illuminate\Support\Collection; use Log; -use Preferences; /** * @codeCoverageIgnore diff --git a/app/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandler.php b/app/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandler.php index ff8764cb52..c73f214b66 100644 --- a/app/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandler.php +++ b/app/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandler.php @@ -86,7 +86,7 @@ class ChooseAccountsHandler implements BunqJobConfigurationInterface } if (\count($mapping) === 0) { $messages = new MessageBag; - $messages->add('nomap', trans('import.bunq_no_mapping')); + $messages->add('nomap', (string)trans('import.bunq_no_mapping')); return $messages; } diff --git a/app/Support/Import/JobConfiguration/File/ConfigureRolesHandler.php b/app/Support/Import/JobConfiguration/File/ConfigureRolesHandler.php index 699917e711..0c73e691df 100644 --- a/app/Support/Import/JobConfiguration/File/ConfigureRolesHandler.php +++ b/app/Support/Import/JobConfiguration/File/ConfigureRolesHandler.php @@ -296,7 +296,7 @@ class ConfigureRolesHandler implements FileConfigurationInterface { $roles = []; foreach (array_keys(config('csv.import_roles')) as $role) { - $roles[$role] = trans('import.column_' . $role); + $roles[$role] = (string)trans('import.column_' . $role); } asort($roles); diff --git a/app/Support/Import/JobConfiguration/File/ConfigureUploadHandler.php b/app/Support/Import/JobConfiguration/File/ConfigureUploadHandler.php index 76962d0132..7e521e527c 100644 --- a/app/Support/Import/JobConfiguration/File/ConfigureUploadHandler.php +++ b/app/Support/Import/JobConfiguration/File/ConfigureUploadHandler.php @@ -80,7 +80,7 @@ class ConfigureUploadHandler implements FileConfigurationInterface } if (!$complete) { $messages = new MessageBag; - $messages->add('account', trans('import.invalid_import_account')); + $messages->add('account', (string)trans('import.invalid_import_account')); return $messages; } @@ -96,9 +96,9 @@ class ConfigureUploadHandler implements FileConfigurationInterface public function getNextData(): array { $delimiters = [ - ',' => trans('form.csv_comma'), - ';' => trans('form.csv_semicolon'), - 'tab' => trans('form.csv_tab'), + ',' => (string)trans('form.csv_comma'), + ';' => (string)trans('form.csv_semicolon'), + 'tab' => (string)trans('form.csv_tab'), ]; $config = $this->importJob->configuration; $config['date-format'] = $config['date-format'] ?? 'Ymd'; diff --git a/app/Support/Import/JobConfiguration/File/NewFileJobHandler.php b/app/Support/Import/JobConfiguration/File/NewFileJobHandler.php index 40c9ac8888..34f79e92c9 100644 --- a/app/Support/Import/JobConfiguration/File/NewFileJobHandler.php +++ b/app/Support/Import/JobConfiguration/File/NewFileJobHandler.php @@ -91,7 +91,7 @@ class NewFileJobHandler implements FileConfigurationInterface $importFileTypes = []; $defaultImportType = config('import.options.file.default_import_format'); foreach ($allowedTypes as $type) { - $importFileTypes[$type] = trans('import.import_file_type_' . $type); + $importFileTypes[$type] = (string)trans('import.import_file_type_' . $type); } return [ @@ -145,7 +145,7 @@ class NewFileJobHandler implements FileConfigurationInterface // check if content is UTF8: if (!$this->isUTF8($attachment)) { - $message = trans('import.file_not_utf8'); + $message = (string)trans('import.file_not_utf8'); Log::error($message); $messages->add('import_file', $message); // delete attachment: diff --git a/app/Support/Import/JobConfiguration/Spectre/ChooseAccountsHandler.php b/app/Support/Import/JobConfiguration/Spectre/ChooseAccountsHandler.php index 8dcabdf64b..186993d99f 100644 --- a/app/Support/Import/JobConfiguration/Spectre/ChooseAccountsHandler.php +++ b/app/Support/Import/JobConfiguration/Spectre/ChooseAccountsHandler.php @@ -100,7 +100,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface $config['apply-rules'] = $applyRules; $this->repository->setConfiguration($this->importJob, $config); if ($final === [0 => 0] || \count($final) === 0) { - $messages->add('count', trans('import.spectre_no_mapping')); + $messages->add('count', (string)trans('import.spectre_no_mapping')); } return $messages; diff --git a/app/Support/Import/Placeholder/ImportTransaction.php b/app/Support/Import/Placeholder/ImportTransaction.php index 4d070a3393..2f110b781a 100644 --- a/app/Support/Import/Placeholder/ImportTransaction.php +++ b/app/Support/Import/Placeholder/ImportTransaction.php @@ -236,7 +236,7 @@ class ImportTransaction $this->note = trim($this->note . ' ' . $columnValue->getValue()); break; case 'opposing-id': - $mappedValue = $this->getMappedValue($columnValue); + $mappedValue = $this->getMappedValue($columnValue); $this->opposingId = $mappedValue; Log::debug(sprintf('Going to set the OPPOSING-id. Original value is "%s", mapped value is "%s".', $columnValue->getValue(), $mappedValue)); break; diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 0a3a5caadd..5e348990af 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -302,19 +302,19 @@ class Navigation { $date = clone $theDate; $formatMap = [ - '1D' => trans('config.specific_day'), - 'daily' => trans('config.specific_day'), - 'custom' => trans('config.specific_day'), - '1W' => trans('config.week_in_year'), - 'week' => trans('config.week_in_year'), - 'weekly' => trans('config.week_in_year'), - '1M' => trans('config.month'), - 'month' => trans('config.month'), - 'monthly' => trans('config.month'), - '1Y' => trans('config.year'), - 'year' => trans('config.year'), - 'yearly' => trans('config.year'), - '6M' => trans('config.half_year'), + '1D' => (string)trans('config.specific_day'), + 'daily' => (string)trans('config.specific_day'), + 'custom' => (string)trans('config.specific_day'), + '1W' => (string)trans('config.week_in_year'), + 'week' => (string)trans('config.week_in_year'), + 'weekly' => (string)trans('config.week_in_year'), + '1M' => (string)trans('config.month'), + 'month' => (string)trans('config.month'), + 'monthly' => (string)trans('config.month'), + '1Y' => (string)trans('config.year'), + 'year' => (string)trans('config.year'), + 'yearly' => (string)trans('config.year'), + '6M' => (string)trans('config.half_year'), ]; if (isset($formatMap[$repeatFrequency])) { diff --git a/app/Support/Twig/Extension/Transaction.php b/app/Support/Twig/Extension/Transaction.php index 5294840ac7..cd5b488956 100644 --- a/app/Support/Twig/Extension/Transaction.php +++ b/app/Support/Twig/Extension/Transaction.php @@ -261,7 +261,7 @@ class Transaction extends Twig_Extension } if (AccountType::CASH === $type) { - $txt = '(' . trans('firefly.cash') . ')'; + $txt = '(' . (string)trans('firefly.cash') . ')'; return $txt; } @@ -310,19 +310,19 @@ class Transaction extends Twig_Extension { switch ($transaction->transaction_type_type) { case TransactionType::WITHDRAWAL: - $txt = sprintf('', trans('firefly.withdrawal')); + $txt = sprintf('', (string)trans('firefly.withdrawal')); break; case TransactionType::DEPOSIT: - $txt = sprintf('', trans('firefly.deposit')); + $txt = sprintf('', (string)trans('firefly.deposit')); break; case TransactionType::TRANSFER: - $txt = sprintf('', trans('firefly.transfer')); + $txt = sprintf('', (string)trans('firefly.transfer')); break; case TransactionType::OPENING_BALANCE: - $txt = sprintf('', trans('firefly.opening_balance')); + $txt = sprintf('', (string)trans('firefly.opening_balance')); break; case TransactionType::RECONCILIATION: - $txt = sprintf('', trans('firefly.reconciliation_transaction')); + $txt = sprintf('', (string)trans('firefly.reconciliation_transaction')); break; default: $txt = ''; @@ -412,7 +412,7 @@ class Transaction extends Twig_Extension } if (AccountType::CASH === $type) { - $txt = '(' . trans('firefly.cash') . ')'; + $txt = '(' . (string)trans('firefly.cash') . ')'; return $txt; } diff --git a/app/Support/Twig/Rule.php b/app/Support/Twig/Rule.php index bb6830bc92..72d531796c 100644 --- a/app/Support/Twig/Rule.php +++ b/app/Support/Twig/Rule.php @@ -43,7 +43,7 @@ class Rule extends Twig_Extension $ruleActions = array_keys(Config::get('firefly.rule-actions')); $possibleActions = []; foreach ($ruleActions as $key) { - $possibleActions[$key] = trans('firefly.rule_action_' . $key . '_choice'); + $possibleActions[$key] = (string)trans('firefly.rule_action_' . $key . '_choice'); } unset($key, $ruleActions); asort($possibleActions); @@ -62,8 +62,8 @@ class Rule extends Twig_Extension 'allJournalTriggers', function () { return [ - 'store-journal' => trans('firefly.rule_trigger_store_journal'), - 'update-journal' => trans('firefly.rule_trigger_update_journal'), + 'store-journal' => (string)trans('firefly.rule_trigger_store_journal'), + 'update-journal' => (string)trans('firefly.rule_trigger_update_journal'), ]; } ); @@ -81,7 +81,7 @@ class Rule extends Twig_Extension $possibleTriggers = []; foreach ($ruleTriggers as $key) { if ('user_action' !== $key) { - $possibleTriggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice'); + $possibleTriggers[$key] = (string)trans('firefly.rule_trigger_' . $key . '_choice'); } } unset($key, $ruleTriggers); diff --git a/app/User.php b/app/User.php index aad71c773e..9e0963ad36 100644 --- a/app/User.php +++ b/app/User.php @@ -60,8 +60,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * @property int $id * @property string $email * @property bool $isAdmin used in admin user controller. - * @property bool $has2FA used in admin user controller. - * @property array $prefs used in admin user controller. + * @property bool $has2FA used in admin user controller. + * @property array $prefs used in admin user controller. * @property mixed password */ class User extends Authenticatable diff --git a/app/Validation/RecurrenceValidation.php b/app/Validation/RecurrenceValidation.php index 42f46d3d3e..71ee97daec 100644 --- a/app/Validation/RecurrenceValidation.php +++ b/app/Validation/RecurrenceValidation.php @@ -51,7 +51,7 @@ trait RecurrenceValidation foreach ($repetitions as $index => $repetition) { switch ($repetition['type']) { default: - $validator->errors()->add(sprintf('repetitions.%d.type', $index), trans('validation.valid_recurrence_rep_type')); + $validator->errors()->add(sprintf('repetitions.%d.type', $index), (string)trans('validation.valid_recurrence_rep_type')); return; case 'daily': @@ -84,7 +84,7 @@ trait RecurrenceValidation $repetitions = $data['repetitions'] ?? []; // need at least one transaction if (\count($repetitions) === 0) { - $validator->errors()->add('description', trans('validation.at_least_one_repetition')); + $validator->errors()->add('description', (string)trans('validation.at_least_one_repetition')); } } @@ -101,8 +101,8 @@ trait RecurrenceValidation $repeatUntil = $data['repeat_until'] ?? null; if (null !== $repetitions && null !== $repeatUntil) { // expect a date OR count: - $validator->errors()->add('repeat_until', trans('validation.require_repeat_until')); - $validator->errors()->add('nr_of_repetitions', trans('validation.require_repeat_until')); + $validator->errors()->add('repeat_until', (string)trans('validation.require_repeat_until')); + $validator->errors()->add('nr_of_repetitions', (string)trans('validation.require_repeat_until')); } } @@ -116,7 +116,7 @@ trait RecurrenceValidation protected function validateDaily(Validator $validator, int $index, string $moment): void { if ('' !== $moment) { - $validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); + $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment')); } } @@ -130,7 +130,7 @@ trait RecurrenceValidation protected function validateMonthly(Validator $validator, int $index, int $dayOfMonth): void { if ($dayOfMonth < 1 || $dayOfMonth > 31) { - $validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); + $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment')); } } @@ -146,19 +146,19 @@ trait RecurrenceValidation { $parameters = explode(',', $moment); if (\count($parameters) !== 2) { - $validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); + $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment')); return; } $nthDay = (int)($parameters[0] ?? 0.0); $dayOfWeek = (int)($parameters[1] ?? 0.0); if ($nthDay < 1 || $nthDay > 5) { - $validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); + $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment')); return; } if ($dayOfWeek < 1 || $dayOfWeek > 7) { - $validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); + $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment')); } } @@ -172,7 +172,7 @@ trait RecurrenceValidation protected function validateWeekly(Validator $validator, int $index, int $dayOfWeek): void { if ($dayOfWeek < 1 || $dayOfWeek > 7) { - $validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); + $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment')); } } @@ -188,7 +188,7 @@ trait RecurrenceValidation try { Carbon::createFromFormat('Y-m-d', $moment); } catch (InvalidArgumentException|Exception $e) { - $validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); + $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment')); } } } \ No newline at end of file diff --git a/app/Validation/TransactionValidation.php b/app/Validation/TransactionValidation.php index af397a7e0e..f4ef17b211 100644 --- a/app/Validation/TransactionValidation.php +++ b/app/Validation/TransactionValidation.php @@ -92,14 +92,14 @@ trait TransactionValidation $destinationAccount = $this->assetAccountExists($validator, $destinationId, $destinationName, $idField, $nameField); break; default: - $validator->errors()->add($idField, trans('validation.invalid_account_info')); + $validator->errors()->add($idField, (string)trans('validation.invalid_account_info')); return; } // add some errors in case of same account submitted: if (null !== $sourceAccount && null !== $destinationAccount && $sourceAccount->id === $destinationAccount->id) { - $validator->errors()->add($idField, trans('validation.source_equals_destination')); + $validator->errors()->add($idField, (string)trans('validation.source_equals_destination')); } } } @@ -124,7 +124,7 @@ trait TransactionValidation // no valid descriptions and empty journal description? error. if ($validDescriptions === 0 && '' === $journalDescription) { - $validator->errors()->add('description', trans('validation.filled', ['attribute' => trans('validation.attributes.description')])); + $validator->errors()->add('description', (string)trans('validation.filled', ['attribute' => (string)trans('validation.attributes.description')])); } } @@ -144,7 +144,7 @@ trait TransactionValidation || isset($transaction['foreign_currency_code']))) { $validator->errors()->add( 'transactions.' . $index . '.foreign_amount', - trans('validation.require_currency_info') + (string)trans('validation.require_currency_info') ); } } @@ -164,7 +164,7 @@ trait TransactionValidation $description = (string)($transaction['description'] ?? ''); // description cannot be equal to journal description. if ($description === $journalDescription) { - $validator->errors()->add('transactions.' . $index . '.description', trans('validation.equal_description')); + $validator->errors()->add('transactions.' . $index . '.description', (string)trans('validation.equal_description')); } } } @@ -180,7 +180,7 @@ trait TransactionValidation $transactions = $data['transactions'] ?? []; // need at least one transaction if (\count($transactions) === 0) { - $validator->errors()->add('description', trans('validation.at_least_one_transaction')); + $validator->errors()->add('description', (string)trans('validation.at_least_one_transaction')); } } @@ -223,18 +223,18 @@ trait TransactionValidation switch ($data['type']) { case 'withdrawal': if (\count($sources) > 1) { - $validator->errors()->add('transactions.0.source_id', trans('validation.all_accounts_equal')); + $validator->errors()->add('transactions.0.source_id', (string)trans('validation.all_accounts_equal')); } break; case 'deposit': if (\count($destinations) > 1) { - $validator->errors()->add('transactions.0.destination_id', trans('validation.all_accounts_equal')); + $validator->errors()->add('transactions.0.destination_id', (string)trans('validation.all_accounts_equal')); } break; case 'transfer': if (\count($sources) > 1 || \count($destinations) > 1) { - $validator->errors()->add('transactions.0.source_id', trans('validation.all_accounts_equal')); - $validator->errors()->add('transactions.0.destination_id', trans('validation.all_accounts_equal')); + $validator->errors()->add('transactions.0.source_id', (string)trans('validation.all_accounts_equal')); + $validator->errors()->add('transactions.0.destination_id', (string)trans('validation.all_accounts_equal')); } break; } @@ -256,7 +256,7 @@ trait TransactionValidation if ('' === $description && \count($transactions) > 1) { $validator->errors()->add( 'transactions.' . $index . '.description', - trans('validation.filled', ['attribute' => trans('validation.attributes.transaction_description')]) + (string)trans('validation.filled', ['attribute' => (string)trans('validation.attributes.transaction_description')]) ); } } @@ -283,7 +283,7 @@ trait TransactionValidation $accountName = (string)$accountName; // both empty? hard exit. if ($accountId < 1 && '' === $accountName) { - $validator->errors()->add($idField, trans('validation.filled', ['attribute' => $idField])); + $validator->errors()->add($idField, (string)trans('validation.filled', ['attribute' => $idField])); return null; } @@ -297,7 +297,7 @@ trait TransactionValidation /** @var Account $first */ $first = $set->first(); if ($first->accountType->type !== AccountType::ASSET) { - $validator->errors()->add($idField, trans('validation.belongs_user')); + $validator->errors()->add($idField, (string)trans('validation.belongs_user')); return null; } @@ -308,7 +308,7 @@ trait TransactionValidation $account = $repository->findByName($accountName, [AccountType::ASSET]); if (null === $account) { - $validator->errors()->add($nameField, trans('validation.belongs_user')); + $validator->errors()->add($nameField, (string)trans('validation.belongs_user')); return null; } @@ -350,7 +350,7 @@ trait TransactionValidation /** @var Account $first */ $first = $set->first(); if ($first->accountType->type !== $type) { - $validator->errors()->add($idField, trans('validation.belongs_user')); + $validator->errors()->add($idField, (string)trans('validation.belongs_user')); return null; }