From 394d0eabef25cc160184e20f0fac8039036838a9 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 3 Jan 2025 14:56:06 +0100 Subject: [PATCH] Fix various phpstan issues. --- app/Console/Commands/Tools/ApplyRules.php | 8 +-- .../Upgrade/RepairsAccountBalances.php | 2 +- .../Upgrade/UpgradesCurrencyPreferences.php | 4 +- app/Exceptions/Handler.php | 11 ---- app/Factory/TransactionJournalFactory.php | 2 +- app/Handlers/Observer/TransactionObserver.php | 4 +- app/Http/Controllers/Admin/LinkController.php | 6 +- .../Admin/NotificationController.php | 2 +- app/Http/Controllers/Admin/UserController.php | 2 +- .../Controllers/Budget/CreateController.php | 7 ++- .../Controllers/Budget/EditController.php | 7 ++- app/Http/Controllers/DebugController.php | 10 ++-- .../ExchangeRates/IndexController.php | 2 +- .../Controllers/Json/ReconcileController.php | 4 +- .../Controllers/PreferencesController.php | 6 +- .../Controllers/Profile/MfaController.php | 2 +- .../Recurring/CreateController.php | 17 +++--- .../Controllers/Recurring/EditController.php | 9 +-- app/Http/Middleware/SecureHeaders.php | 2 +- app/Jobs/CreateAutoBudgetLimits.php | 7 ++- app/Models/PiggyBankEvent.php | 18 +++--- app/Models/TransactionType.php | 9 +-- app/Notifications/ReturnsSettings.php | 2 +- app/Repositories/Budget/BudgetRepository.php | 7 ++- .../Internal/Update/JournalUpdateService.php | 4 +- app/Support/Amount.php | 4 +- .../Category/FrontpageChartGenerator.php | 3 + .../Http/Controllers/GetConfigurationData.php | 5 +- .../Summarizer/TransactionSummarizer.php | 8 ++- .../Recurring/FiltersWeekends.php | 7 ++- .../Actions/UpdatePiggybank.php | 2 +- .../Engine/SearchRuleEngine.php | 10 ++-- app/Transformers/BillTransformer.php | 2 +- app/Transformers/BudgetTransformer.php | 7 ++- app/Transformers/V2/AccountTransformer.php | 2 + .../V2/TransactionGroupTransformer.php | 6 +- app/Validation/FireflyValidator.php | 4 +- bootstrap/app.php | 2 +- config/jsonapi.php | 56 ------------------- database/seeders/AccountTypeSeeder.php | 27 ++++----- database/seeders/TransactionTypeSeeder.php | 13 +++-- routes/web.php | 2 +- 42 files changed, 133 insertions(+), 181 deletions(-) delete mode 100644 config/jsonapi.php diff --git a/app/Console/Commands/Tools/ApplyRules.php b/app/Console/Commands/Tools/ApplyRules.php index 79e261dd51..1c66652856 100644 --- a/app/Console/Commands/Tools/ApplyRules.php +++ b/app/Console/Commands/Tools/ApplyRules.php @@ -126,7 +126,7 @@ class ApplyRules extends Command $ruleEngine->addOperator(['type' => 'account_id', 'value' => $list]); // add the date as a filter: - $ruleEngine->addOperator(['type' => 'date_after', 'value' => $this->start_date->format('Y-m-d')]); + $ruleEngine->addOperator(['type' => 'date_after', 'value' => $this->startDate->format('Y-m-d')]); $ruleEngine->addOperator(['type' => 'date_before', 'value' => $this->endDate->format('Y-m-d')]); // start running rules. @@ -227,7 +227,7 @@ class ApplyRules extends Command foreach ($ruleGroupList as $ruleGroupId) { $ruleGroup = $this->ruleGroupRepository->find((int) $ruleGroupId); - if ($ruleGroup->active) { + if (true === $ruleGroup->active) { $this->ruleGroupSelection[] = $ruleGroup->id; } if (false === $ruleGroup->active) { @@ -249,7 +249,7 @@ class ApplyRules extends Command foreach ($ruleList as $ruleId) { $rule = $this->ruleRepository->find((int) $ruleId); - if (null !== $rule && $rule->active) { + if (null !== $rule && true === $rule->active) { $this->ruleSelection[] = $rule->id; } } @@ -294,7 +294,7 @@ class ApplyRules extends Command [$inputEnd, $inputStart] = [$inputStart, $inputEnd]; } - $this->start_date = $inputStart; + $this->startDate = $inputStart; $this->endDate = $inputEnd; } diff --git a/app/Console/Commands/Upgrade/RepairsAccountBalances.php b/app/Console/Commands/Upgrade/RepairsAccountBalances.php index 670b20995c..0acebbf969 100644 --- a/app/Console/Commands/Upgrade/RepairsAccountBalances.php +++ b/app/Console/Commands/Upgrade/RepairsAccountBalances.php @@ -43,7 +43,7 @@ class RepairsAccountBalances extends Command return 0; } - if (config('firefly.feature_flags.running_balance_column')) { + if (true === config('firefly.feature_flags.running_balance_column')) { $this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.'); $this->markAsExecuted(); $this->correctBalanceAmounts(); diff --git a/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php b/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php index 50ed8b6ff3..05c2a48583 100644 --- a/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php +++ b/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php @@ -95,7 +95,7 @@ class UpgradesCurrencyPreferences extends Command /** @var TransactionCurrency $currency */ foreach ($currencies as $currency) { - if ($currency->enabled) { + if (true === $currency->enabled) { $enabled->push($currency); } } @@ -109,7 +109,7 @@ class UpgradesCurrencyPreferences extends Command /** @var TransactionCurrency $currency */ foreach ($currencies as $currency) { - if ($currency->enabled) { + if (true === $currency->enabled) { $enabled->push($currency); } } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 60d31fa76f..3c3aacb68e 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -87,17 +87,6 @@ class Handler extends ExceptionHandler app('log')->debug('Now in Handler::render()'); - if ($e instanceof JsonApiException) { - // ignore it: controller will handle it. - - app('log')->debug(sprintf( - 'Return to parent to handle JsonApiException(%d)', - $e->getCode() - )); - - return parent::render($request, $e); - } - if ($e instanceof LaravelValidationException && $expectsJson) { // ignore it: controller will handle it. diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index 18d29929ad..9ff2a464ed 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -174,7 +174,7 @@ class TransactionJournalFactory // 2024-11-19, overrule timezone with UTC and store it as UTC. - if (FireflyConfig::get('utc', false)->data) { + if (true === FireflyConfig::get('utc', false)->data) { $carbon->setTimezone('UTC'); } // $carbon->setTimezone('UTC'); diff --git a/app/Handlers/Observer/TransactionObserver.php b/app/Handlers/Observer/TransactionObserver.php index ebf2fca3c8..bbcae5a091 100644 --- a/app/Handlers/Observer/TransactionObserver.php +++ b/app/Handlers/Observer/TransactionObserver.php @@ -40,7 +40,7 @@ class TransactionObserver { Log::debug('Observe "created" of a transaction.'); if (config('firefly.feature_flags.running_balance_column')) { - if (1 === bccomp($transaction->amount, '0') && self::$recalculate) { + if (1 === bccomp($transaction->amount, '0') && true === self::$recalculate) { Log::debug('Trigger recalculateForJournal'); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); } @@ -57,7 +57,7 @@ class TransactionObserver public function updated(Transaction $transaction): void { // Log::debug('Observe "updated" of a transaction.'); - if (config('firefly.feature_flags.running_balance_column') && self::$recalculate) { + if (config('firefly.feature_flags.running_balance_column') && true === self::$recalculate) { if (1 === bccomp($transaction->amount, '0')) { Log::debug('Trigger recalculateForJournal'); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.php index 92dc5ccd53..0ed8801810 100644 --- a/app/Http/Controllers/Admin/LinkController.php +++ b/app/Http/Controllers/Admin/LinkController.php @@ -88,7 +88,7 @@ class LinkController extends Controller */ public function delete(Request $request, LinkType $linkType) { - if (!$linkType->editable) { + if (false === $linkType->editable) { $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)])); return redirect(route('admin.links.index')); @@ -139,7 +139,7 @@ class LinkController extends Controller */ public function edit(Request $request, LinkType $linkType) { - if (!$linkType->editable) { + if (false === $linkType->editable) { $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)])); return redirect(route('admin.links.index')); @@ -231,7 +231,7 @@ class LinkController extends Controller */ public function update(LinkTypeFormRequest $request, LinkType $linkType) { - if (!$linkType->editable) { + if (false === $linkType->editable) { $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)])); return redirect(route('admin.links.index')); diff --git a/app/Http/Controllers/Admin/NotificationController.php b/app/Http/Controllers/Admin/NotificationController.php index 39351c6e09..91a9f42c6d 100644 --- a/app/Http/Controllers/Admin/NotificationController.php +++ b/app/Http/Controllers/Admin/NotificationController.php @@ -57,7 +57,7 @@ class NotificationController extends Controller // admin notification settings: $notifications = []; foreach (config('notifications.notifications.owner') as $key => $info) { - if ($info['enabled']) { + if (true === $info['enabled']) { $notifications[$key] = app('fireflyconfig')->get(sprintf('notification_%s', $key), true)->data; } } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index dc8ed34398..b6f6c4cf57 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -85,7 +85,7 @@ class UserController extends Controller public function deleteInvite(InvitedUser $invitedUser): JsonResponse { app('log')->debug('Will now delete invitation'); - if ($invitedUser->redeemed) { + if (true === $invitedUser->redeemed) { app('log')->debug('Is already redeemed.'); session()->flash('error', trans('firefly.invite_is_already_redeemed', ['address' => $invitedUser->email])); diff --git a/app/Http/Controllers/Budget/CreateController.php b/app/Http/Controllers/Budget/CreateController.php index 026b3629e4..6c27bed324 100644 --- a/app/Http/Controllers/Budget/CreateController.php +++ b/app/Http/Controllers/Budget/CreateController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Budget; +use FireflyIII\Enums\AutoBudgetType; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Controllers\Controller; @@ -74,9 +75,9 @@ class CreateController extends Controller // auto budget types $autoBudgetTypes = [ 0 => (string) trans('firefly.auto_budget_none'), - AutoBudget::AUTO_BUDGET_RESET => (string) trans('firefly.auto_budget_reset'), - AutoBudget::AUTO_BUDGET_ROLLOVER => (string) trans('firefly.auto_budget_rollover'), - AutoBudget::AUTO_BUDGET_ADJUSTED => (string) trans('firefly.auto_budget_adjusted'), + AutoBudgetType::AUTO_BUDGET_RESET->value => (string) trans('firefly.auto_budget_reset'), + AutoBudgetType::AUTO_BUDGET_ROLLOVER->value => (string) trans('firefly.auto_budget_rollover'), + AutoBudgetType::AUTO_BUDGET_ADJUSTED->value => (string) trans('firefly.auto_budget_adjusted'), ]; $autoBudgetPeriods = [ 'daily' => (string) trans('firefly.auto_budget_period_daily'), diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.php index 382dc3a756..23ad6bb1c9 100644 --- a/app/Http/Controllers/Budget/EditController.php +++ b/app/Http/Controllers/Budget/EditController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Budget; +use FireflyIII\Enums\AutoBudgetType; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\BudgetFormUpdateRequest; @@ -76,9 +77,9 @@ class EditController extends Controller // auto budget types $autoBudgetTypes = [ 0 => (string) trans('firefly.auto_budget_none'), - AutoBudget::AUTO_BUDGET_RESET => (string) trans('firefly.auto_budget_reset'), - AutoBudget::AUTO_BUDGET_ROLLOVER => (string) trans('firefly.auto_budget_rollover'), - AutoBudget::AUTO_BUDGET_ADJUSTED => (string) trans('firefly.auto_budget_adjusted'), + AutoBudgetType::AUTO_BUDGET_RESET->value => (string) trans('firefly.auto_budget_reset'), + AutoBudgetType::AUTO_BUDGET_ROLLOVER->value => (string) trans('firefly.auto_budget_rollover'), + AutoBudgetType::AUTO_BUDGET_ADJUSTED->value => (string) trans('firefly.auto_budget_adjusted'), ]; $autoBudgetPeriods = [ 'daily' => (string) trans('firefly.auto_budget_period_daily'), diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index dcae0bd53c..4f868317c0 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -247,7 +247,7 @@ class DebugController extends Controller private function getBuildInfo(): array { $return = [ - 'is_docker' => env('IS_DOCKER', false), + 'is_docker' => env('IS_DOCKER', false), // @phpstan-ignore-line 'build' => '(unknown)', 'build_date' => '(unknown)', 'base_build' => '(unknown)', @@ -272,11 +272,11 @@ class DebugController extends Controller app('log')->debug('Could not check build date, but thats ok.'); app('log')->warning($e->getMessage()); } - if ('' !== (string) env('BASE_IMAGE_BUILD')) { - $return['base_build'] = env('BASE_IMAGE_BUILD'); + if ('' !== (string) env('BASE_IMAGE_BUILD')) { // @phpstan-ignore-line + $return['base_build'] = env('BASE_IMAGE_BUILD'); // @phpstan-ignore-line } - if ('' !== (string) env('BASE_IMAGE_DATE')) { - $return['base_build_date'] = env('BASE_IMAGE_DATE'); + if ('' !== (string) env('BASE_IMAGE_DATE')) { // @phpstan-ignore-line + $return['base_build_date'] = env('BASE_IMAGE_DATE'); // @phpstan-ignore-line } return $return; diff --git a/app/Http/Controllers/ExchangeRates/IndexController.php b/app/Http/Controllers/ExchangeRates/IndexController.php index 4cff4418e2..258052606b 100644 --- a/app/Http/Controllers/ExchangeRates/IndexController.php +++ b/app/Http/Controllers/ExchangeRates/IndexController.php @@ -47,7 +47,7 @@ class IndexController extends Controller return $next($request); } ); - if (!config('cer.enabled')) { + if (false === config('cer.enabled')) { throw new NotFoundHttpException(); } } diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php index c906914a94..089fd09bce 100644 --- a/app/Http/Controllers/Json/ReconcileController.php +++ b/app/Http/Controllers/Json/ReconcileController.php @@ -124,10 +124,10 @@ class ReconcileController extends Controller Log::debug(sprintf('End balance: "%s"', $endBalance)); Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount)); Log::debug(sprintf('Amount: "%s"', $amount)); - $difference = bcadd(bcadd(bcsub($startBalance ?? '0', $endBalance ?? '0'), $clearedAmount ?? '0'), $amount); + $difference = bcadd(bcadd(bcsub($startBalance ?? '0', $endBalance ?? '0'), $clearedAmount), $amount); $diffCompare = bccomp($difference, '0'); $countCleared = count($clearedJournals); - $reconSum = bcadd(bcadd($startBalance ?? '0', $amount ?? '0'), $clearedAmount ?? '0'); + $reconSum = bcadd(bcadd($startBalance ?? '0', $amount), $clearedAmount); try { $view = view('accounts.reconcile.overview', compact('account', 'start', 'diffCompare', 'difference', 'end', 'clearedAmount', 'startBalance', 'endBalance', 'amount', 'route', 'countCleared', 'reconSum', 'selectedIds'))->render(); diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index aebf9edcc9..c2f9d2b244 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -72,7 +72,7 @@ class PreferencesController extends Controller public function index(AccountRepositoryInterface $repository) { $accounts = $repository->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]); - $isDocker = env('IS_DOCKER', false); + $isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line $groupedAccounts = []; /** @var Account $account */ @@ -129,10 +129,10 @@ class PreferencesController extends Controller // notification preferences $notifications = []; foreach (config('notifications.notifications.user') as $key => $info) { - if ($info['enabled']) { + if (true === $info['enabled']) { $notifications[$key] = [ - 'enabled' => app('preferences')->get(sprintf('notification_%s', $key), true)->data, + 'enabled' => true === app('preferences')->get(sprintf('notification_%s', $key), true)->data, 'configurable' => $info['configurable'], ]; } diff --git a/app/Http/Controllers/Profile/MfaController.php b/app/Http/Controllers/Profile/MfaController.php index 340d7240ef..09af41c9d0 100644 --- a/app/Http/Controllers/Profile/MfaController.php +++ b/app/Http/Controllers/Profile/MfaController.php @@ -215,7 +215,7 @@ class MfaController extends Controller $domain = $this->getDomain(); $secret = \Google2FA::generateSecretKey(); - $image = \Google2FA::getQRCodeInline($domain, auth()->user()->email, (string) $secret); + $image = \Google2FA::getQRCodeInline($domain, auth()->user()->email, $secret); app('preferences')->set('temp-mfa-secret', $secret); diff --git a/app/Http/Controllers/Recurring/CreateController.php b/app/Http/Controllers/Recurring/CreateController.php index 2a79a90092..21c306d233 100644 --- a/app/Http/Controllers/Recurring/CreateController.php +++ b/app/Http/Controllers/Recurring/CreateController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Recurring; +use FireflyIII\Enums\RecurrenceRepetitionWeekend; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Controllers\Controller; @@ -100,10 +101,10 @@ class CreateController extends Controller 'times' => (string) trans('firefly.repeat_times'), ]; $weekendResponses = [ - 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'), + RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value => (string) trans('firefly.do_nothing'), + RecurrenceRepetitionWeekend::WEEKEND_SKIP_CREATION->value => (string) trans('firefly.skip_transaction'), + RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value => (string) trans('firefly.jump_to_friday'), + RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value => (string) trans('firefly.jump_to_monday'), ]; $hasOldInput = null !== $request->old('_token'); // flash some data $preFilled = [ @@ -145,10 +146,10 @@ class CreateController extends Controller 'times' => (string) trans('firefly.repeat_times'), ]; $weekendResponses = [ - 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'), + RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value => (string) trans('firefly.do_nothing'), + RecurrenceRepetitionWeekend::WEEKEND_SKIP_CREATION->value => (string) trans('firefly.skip_transaction'), + RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value => (string) trans('firefly.jump_to_friday'), + RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value => (string) trans('firefly.jump_to_monday'), ]; // fill prefilled with journal info diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.php index c662ed3d04..b48e5f7b85 100644 --- a/app/Http/Controllers/Recurring/EditController.php +++ b/app/Http/Controllers/Recurring/EditController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Recurring; +use FireflyIII\Enums\RecurrenceRepetitionWeekend; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Controllers\Controller; @@ -126,10 +127,10 @@ class EditController extends Controller } $weekendResponses = [ - 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'), + RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value => (string) trans('firefly.do_nothing'), + RecurrenceRepetitionWeekend::WEEKEND_SKIP_CREATION->value => (string) trans('firefly.skip_transaction'), + RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value => (string) trans('firefly.jump_to_friday'), + RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value => (string) trans('firefly.jump_to_monday'), ]; $hasOldInput = null !== $request->old('_token'); diff --git a/app/Http/Middleware/SecureHeaders.php b/app/Http/Middleware/SecureHeaders.php index 2220dbfee7..d481c820af 100644 --- a/app/Http/Middleware/SecureHeaders.php +++ b/app/Http/Middleware/SecureHeaders.php @@ -65,7 +65,7 @@ class SecureHeaders ]; // overrule in development mode - if (true === env('IS_LOCAL_DEV')) { + if (true === env('IS_LOCAL_DEV')) { // @phpstan-ignore-line $csp = [ "default-src 'none'", "object-src 'none'", diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.php index e781cebb8a..c8a9e7e9b9 100644 --- a/app/Jobs/CreateAutoBudgetLimits.php +++ b/app/Jobs/CreateAutoBudgetLimits.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Jobs; use Carbon\Carbon; +use FireflyIII\Enums\AutoBudgetType; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\AutoBudget; use FireflyIII\Models\Budget; @@ -126,7 +127,7 @@ class CreateAutoBudgetLimits implements ShouldQueue // find budget limit: $budgetLimit = $this->findBudgetLimit($autoBudget->budget, $start, $end); - if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_RESET === (int) $autoBudget->auto_budget_type) { + if (null === $budgetLimit && AutoBudgetType::AUTO_BUDGET_RESET->value === (int) $autoBudget->auto_budget_type) { // that's easy: create one. // do nothing else. $this->createBudgetLimit($autoBudget, $start, $end); @@ -135,14 +136,14 @@ class CreateAutoBudgetLimits implements ShouldQueue return; } - if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ROLLOVER === (int) $autoBudget->auto_budget_type) { + if (null === $budgetLimit && AutoBudgetType::AUTO_BUDGET_ROLLOVER->value === (int) $autoBudget->auto_budget_type) { // budget limit exists already, $this->createRollover($autoBudget); app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id)); return; } - if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ADJUSTED === (int) $autoBudget->auto_budget_type) { + if (null === $budgetLimit && AutoBudgetType::AUTO_BUDGET_ADJUSTED->value === (int) $autoBudget->auto_budget_type) { // budget limit exists already, $this->createAdjustedLimit($autoBudget); app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id)); diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php index b1c6fc3e28..5316ecd40b 100644 --- a/app/Models/PiggyBankEvent.php +++ b/app/Models/PiggyBankEvent.php @@ -37,17 +37,17 @@ class PiggyBankEvent extends Model use ReturnsIntegerIdTrait; protected $casts - = [ - 'created_at' => 'datetime', - 'updated_at' => 'datetime', - 'date' => SeparateTimezoneCaster::class, - 'amount' => 'string', - 'amount' => 'native_string', + = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'date' => SeparateTimezoneCaster::class, + 'amount' => 'string', + 'native_amount' => 'string', ]; protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'date_tz', 'amount', 'native_amount']; - protected $hidden = ['amount_encrypted']; + protected $hidden = ['amount_encrypted']; public function piggyBank(): BelongsTo { @@ -73,14 +73,14 @@ class PiggyBankEvent extends Model protected function amount(): Attribute { return Attribute::make( - get: static fn ($value) => (string) $value, + get: static fn($value) => (string) $value, ); } protected function piggyBankId(): Attribute { return Attribute::make( - get: static fn ($value) => (int) $value, + get: static fn($value) => (int) $value, ); } } diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php index b807264dec..aba5569a54 100644 --- a/app/Models/TransactionType.php +++ b/app/Models/TransactionType.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Models; +use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Support\Models\ReturnsIntegerIdTrait; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -86,22 +87,22 @@ class TransactionType extends Model public function isDeposit(): bool { - return self::DEPOSIT === $this->type; + return TransactionTypeEnum::DEPOSIT->value === $this->type; } public function isOpeningBalance(): bool { - return self::OPENING_BALANCE === $this->type; + return TransactionTypeEnum::OPENING_BALANCE->value === $this->type; } public function isTransfer(): bool { - return self::TRANSFER === $this->type; + return TransactionTypeEnum::TRANSFER->value === $this->type; } public function isWithdrawal(): bool { - return self::WITHDRAWAL === $this->type; + return TransactionTypeEnum::WITHDRAWAL->value === $this->type; } public function transactionJournals(): HasMany diff --git a/app/Notifications/ReturnsSettings.php b/app/Notifications/ReturnsSettings.php index f0582ec751..40b918d37d 100644 --- a/app/Notifications/ReturnsSettings.php +++ b/app/Notifications/ReturnsSettings.php @@ -69,7 +69,7 @@ class ReturnsSettings config(['ntfy-notification-channel.server' => $settings['ntfy_server']]); config(['ntfy-notification-channel.topic' => $settings['ntfy_topic']]); - if ($settings['ntfy_auth']) { + if (true === $settings['ntfy_auth']) { // overrule auth as well. config(['ntfy-notification-channel.authentication.enabled' => true]); config(['ntfy-notification-channel.authentication.username' => $settings['ntfy_user']]); diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 3f071e31eb..82c36a2c64 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Budget; use Carbon\Carbon; +use FireflyIII\Enums\AutoBudgetType; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; @@ -760,13 +761,13 @@ class BudgetRepository implements BudgetRepositoryInterface } if ('reset' === $type) { - $type = AutoBudget::AUTO_BUDGET_RESET; + $type = AutoBudgetType::AUTO_BUDGET_RESET->value; } if ('rollover' === $type) { - $type = AutoBudget::AUTO_BUDGET_ROLLOVER; + $type = AutoBudgetType::AUTO_BUDGET_ROLLOVER->value; } if ('adjusted' === $type) { - $type = AutoBudget::AUTO_BUDGET_ADJUSTED; + $type = AutoBudgetType::AUTO_BUDGET_ADJUSTED->value; } /** @var CurrencyRepositoryInterface $repos */ diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index cacf78be5a..5d498c52b7 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -492,7 +492,7 @@ class JournalUpdateService $value->setTimezone(config('app.timezone')); // 2024-11-22, overrule timezone with UTC and store it as UTC. - if (FireflyConfig::get('utc', false)->data) { + if (true === FireflyConfig::get('utc', false)->data) { $value->setTimezone('UTC'); } @@ -770,6 +770,4 @@ class JournalUpdateService $this->sourceTransaction->refresh(); $this->destinationTransaction->refresh(); } - - private function collectCurrency(): TransactionCurrency {} } diff --git a/app/Support/Amount.php b/app/Support/Amount.php index ac4dc9cbe0..b02ebc8ecc 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -71,11 +71,11 @@ class Amount public function convertToNative(?User $user = null): bool { if (null === $user) { - return Preferences::get('convert_to_native', false)->data && config('cer.enabled'); + return true === Preferences::get('convert_to_native', false)->data && true === config('cer.enabled'); // Log::debug(sprintf('convertToNative [a]: %s', var_export($result, true))); } - return Preferences::getForUser($user, 'convert_to_native', false)->data && config('cer.enabled'); + return true === Preferences::getForUser($user, 'convert_to_native', false)->data && true === config('cer.enabled'); // Log::debug(sprintf('convertToNative [b]: %s', var_export($result, true))); } diff --git a/app/Support/Chart/Category/FrontpageChartGenerator.php b/app/Support/Chart/Category/FrontpageChartGenerator.php index d9d8da6884..ddba057a18 100644 --- a/app/Support/Chart/Category/FrontpageChartGenerator.php +++ b/app/Support/Chart/Category/FrontpageChartGenerator.php @@ -27,6 +27,7 @@ namespace FireflyIII\Support\Chart\Category; use Carbon\Carbon; use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Models\Category; +use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Category\NoCategoryRepositoryInterface; @@ -48,6 +49,8 @@ class FrontpageChartGenerator private NoCategoryRepositoryInterface $noCatRepos; private OperationsRepositoryInterface $opsRepos; private CategoryRepositoryInterface $repository; + public bool $convertToNative = false; + public TransactionCurrency $defaultCurrency; private Carbon $start; /** diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.php index 5619de0ef0..73988e1d2a 100644 --- a/app/Support/Http/Controllers/GetConfigurationData.php +++ b/app/Support/Http/Controllers/GetConfigurationData.php @@ -40,11 +40,10 @@ trait GetConfigurationData { $array = [ -1 => 'ALL errors', - E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED => 'E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED', + E_ALL & ~E_NOTICE & ~E_DEPRECATED => 'E_ALL & ~E_NOTICE & ~E_DEPRECATED', E_ALL => 'E_ALL', - E_ALL & ~E_DEPRECATED & ~E_STRICT => 'E_ALL & ~E_DEPRECATED & ~E_STRICT', + E_ALL & ~E_DEPRECATED => 'E_ALL & ~E_DEPRECATED ', E_ALL & ~E_NOTICE => 'E_ALL & ~E_NOTICE', - E_ALL & ~E_NOTICE & ~E_STRICT => 'E_ALL & ~E_NOTICE & ~E_STRICT', E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_ERROR | E_CORE_ERROR => 'E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR', ]; diff --git a/app/Support/Report/Summarizer/TransactionSummarizer.php b/app/Support/Report/Summarizer/TransactionSummarizer.php index 7e74cd09f0..d0d076e3d7 100644 --- a/app/Support/Report/Summarizer/TransactionSummarizer.php +++ b/app/Support/Report/Summarizer/TransactionSummarizer.php @@ -96,7 +96,13 @@ class TransactionSummarizer 'currency_code' => $currencyCode, 'currency_decimal_places' => $currencyDecimalPlaces, ]; - $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->{$method}($amount)); + if('positive' === $method) { + $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->positive($amount)); + } + if('negative' === $method) { + $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($amount)); + } + // $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->{$method}($amount)); // Log::debug(sprintf('Journal #%d adds amount %s %s', $journal['transaction_journal_id'], $currencyCode, $amount)); } Log::debug('End of sumExpenses.', $array); diff --git a/app/Support/Repositories/Recurring/FiltersWeekends.php b/app/Support/Repositories/Recurring/FiltersWeekends.php index e5b4108c93..222879cc29 100644 --- a/app/Support/Repositories/Recurring/FiltersWeekends.php +++ b/app/Support/Repositories/Recurring/FiltersWeekends.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Support\Repositories\Recurring; use Carbon\Carbon; +use FireflyIII\Enums\RecurrenceRepetitionWeekend; use FireflyIII\Models\RecurrenceRepetition; use Illuminate\Support\Collection; @@ -39,7 +40,7 @@ trait FiltersWeekends protected function filterWeekends(RecurrenceRepetition $repetition, array $dates): array { app('log')->debug(sprintf('Now in %s', __METHOD__)); - if (RecurrenceRepetition::WEEKEND_DO_NOTHING === $repetition->weekend) { + if (RecurrenceRepetitionWeekend::WEEKEND_DO_NOTHING->value === $repetition->weekend) { app('log')->debug('Repetition will not be filtered on weekend days.'); return $dates; @@ -57,7 +58,7 @@ trait FiltersWeekends } // is weekend and must set back to Friday? - if (RecurrenceRepetition::WEEKEND_TO_FRIDAY === $repetition->weekend) { + if (RecurrenceRepetitionWeekend::WEEKEND_TO_FRIDAY->value === $repetition->weekend) { $clone = clone $date; $clone->addDays(5 - $date->dayOfWeekIso); app('log')->debug( @@ -69,7 +70,7 @@ trait FiltersWeekends } // postpone to Monday? - if (RecurrenceRepetition::WEEKEND_TO_MONDAY === $repetition->weekend) { + if (RecurrenceRepetitionWeekend::WEEKEND_TO_MONDAY->value === $repetition->weekend) { $clone = clone $date; $clone->addDays(8 - $date->dayOfWeekIso); app('log')->debug( diff --git a/app/TransactionRules/Actions/UpdatePiggybank.php b/app/TransactionRules/Actions/UpdatePiggybank.php index bb3ff0fc84..5d6198d13f 100644 --- a/app/TransactionRules/Actions/UpdatePiggybank.php +++ b/app/TransactionRules/Actions/UpdatePiggybank.php @@ -235,7 +235,7 @@ class UpdatePiggybank implements ActionInterface return true; } } - Log::debug(sprintf('Piggy bank is not connected to account #%d "%s"', $account->id, $account->name)); + Log::debug(sprintf('Piggy bank is not connected to account #%d "%s"', $link?->id, $link?->name)); return false; } diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php index d06a20de72..fac43b1d59 100644 --- a/app/TransactionRules/Engine/SearchRuleEngine.php +++ b/app/TransactionRules/Engine/SearchRuleEngine.php @@ -277,7 +277,7 @@ class SearchRuleEngine implements RuleEngineInterface app('log')->debug(sprintf('Total collection is now %d transactions', $total->count())); ++$count; // if trigger says stop processing, do so. - if ($ruleTrigger->stop_processing && $result->count() > 0) { + if (true === $ruleTrigger->stop_processing && $result->count() > 0) { app('log')->debug('The trigger says to stop processing, so stop processing other triggers.'); break; @@ -319,10 +319,10 @@ class SearchRuleEngine implements RuleEngineInterface /** @var Rule $rule */ foreach ($this->rules as $rule) { $result = $this->fireRule($rule); - if (true === $result && $rule->stop_processing) { + if (true === $result && true === $rule->stop_processing) { app('log')->debug(sprintf('Rule #%d has triggered and executed, but calls to stop processing. Since not in the context of a group, do not stop.', $rule->id)); } - if (false === $result && $rule->stop_processing) { + if (false === $result && true === $rule->stop_processing) { app('log')->debug(sprintf('Rule #%d has triggered and changed nothing, but calls to stop processing. Do not stop.', $rule->id)); } } @@ -461,12 +461,12 @@ class SearchRuleEngine implements RuleEngineInterface } // pick up from the action if it actually acted or not: - if ($ruleAction->stop_processing && true === $result) { + if (true === $ruleAction->stop_processing && true === $result) { app('log')->debug(sprintf('Rule action "%s" reports changes AND asks to break, so break!', $ruleAction->action_type)); return true; } - if ($ruleAction->stop_processing && false === $result) { + if (true === $ruleAction->stop_processing && false === $result) { app('log')->debug(sprintf('Rule action "%s" reports NO changes AND asks to break, but we wont break!', $ruleAction->action_type)); } diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.php index a9de92351d..9c66a1f8c6 100644 --- a/app/Transformers/BillTransformer.php +++ b/app/Transformers/BillTransformer.php @@ -59,7 +59,7 @@ class BillTransformer extends AbstractTransformer */ public function transform(Bill $bill): array { - $defaultCurrency = $this->parameters->get('defaultCurrency') ?? Amount::getDefaultCurrency(); + $defaultCurrency = $this->parameters->get('defaultCurrency') ?? app('amount')->getDefaultCurrency(); $paidData = $this->paidData($bill); $lastPaidDate = $this->getLastPaidDate($paidData); diff --git a/app/Transformers/BudgetTransformer.php b/app/Transformers/BudgetTransformer.php index da818c671a..9e5f065687 100644 --- a/app/Transformers/BudgetTransformer.php +++ b/app/Transformers/BudgetTransformer.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Transformers; +use FireflyIII\Enums\AutoBudgetType; use FireflyIII\Models\AutoBudget; use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; @@ -71,9 +72,9 @@ class BudgetTransformer extends AbstractTransformer $notes = $this->repository->getNoteText($budget); $types = [ - AutoBudget::AUTO_BUDGET_RESET => 'reset', - AutoBudget::AUTO_BUDGET_ROLLOVER => 'rollover', - AutoBudget::AUTO_BUDGET_ADJUSTED => 'adjusted', + AutoBudgetType::AUTO_BUDGET_RESET->value => 'reset', + AutoBudgetType::AUTO_BUDGET_ROLLOVER->value => 'rollover', + AutoBudgetType::AUTO_BUDGET_ADJUSTED->value => 'adjusted', ]; if (null !== $autoBudget) { diff --git a/app/Transformers/V2/AccountTransformer.php b/app/Transformers/V2/AccountTransformer.php index 0f51e9b213..4308e106ba 100644 --- a/app/Transformers/V2/AccountTransformer.php +++ b/app/Transformers/V2/AccountTransformer.php @@ -48,6 +48,7 @@ class AccountTransformer extends AbstractTransformer private array $fullTypes; private array $lastActivity; private array $objectGroups; + private array $balances; /** * This method collects meta-data for one or all accounts in the transformer's collection. @@ -55,6 +56,7 @@ class AccountTransformer extends AbstractTransformer public function collectMetaData(Collection $objects): Collection { $this->currencies = []; + $this->balances = []; $this->accountMeta = []; $this->accountTypes = []; $this->fullTypes = []; diff --git a/app/Transformers/V2/TransactionGroupTransformer.php b/app/Transformers/V2/TransactionGroupTransformer.php index e740477570..f244943b1f 100644 --- a/app/Transformers/V2/TransactionGroupTransformer.php +++ b/app/Transformers/V2/TransactionGroupTransformer.php @@ -56,10 +56,10 @@ class TransactionGroupTransformer extends AbstractTransformer // private array $currencies = []; // private array $transactionTypes = []; - // private array $meta = []; - // private array $notes = []; + private array $meta = []; + private array $notes = []; // private array $locations = []; - // private array $tags = []; + private array $tags = []; // private array $amounts = []; // private array $foreignAmounts = []; // private array $journalCurrencies = []; diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 7fd93ac714..5b32fb8df0 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -77,7 +77,7 @@ class FireflyValidator extends Validator } $secret = (string) $secret; - return (bool) \Google2FA::verifyKey((string) $secret, $value); + return (bool) \Google2FA::verifyKey($secret, $value); } /** @@ -823,7 +823,7 @@ class FireflyValidator extends Validator } $query->where('piggy_banks.name', $value); - return 0 === $query->get(['piggy_banks.*'])->count(); + return 0 === $query->count(['piggy_banks.*']); } /** diff --git a/bootstrap/app.php b/bootstrap/app.php index 5da0446b16..e5fc51d13d 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -43,7 +43,7 @@ if (!function_exists('envNonEmpty')) { */ function envNonEmpty(string $key, string | int | bool | null $default = null) { - $result = env($key, $default); + $result = env($key, $default); // @phpstan-ignore-line if ('' === $result) { $result = $default; } diff --git a/config/jsonapi.php b/config/jsonapi.php deleted file mode 100644 index da22db9fd3..0000000000 --- a/config/jsonapi.php +++ /dev/null @@ -1,56 +0,0 @@ - 'JsonApi', - - /* - |-------------------------------------------------------------------------- - | Servers - |-------------------------------------------------------------------------- - | - | A list of the JSON:API compliant APIs in your application, referred to - | as "servers". They must be listed below, with the array key being the - | unique name for each server, and the value being the fully-qualified - | class name of the server class. - */ - 'servers' => [ - 'v2' => Server::class, - ], -]; diff --git a/database/seeders/AccountTypeSeeder.php b/database/seeders/AccountTypeSeeder.php index c142b1b615..e52e06136c 100644 --- a/database/seeders/AccountTypeSeeder.php +++ b/database/seeders/AccountTypeSeeder.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace Database\Seeders; +use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Models\AccountType; use Illuminate\Database\Seeder; @@ -34,19 +35,19 @@ class AccountTypeSeeder extends Seeder public function run(): void { $types = [ - AccountType::DEFAULT, - AccountType::CASH, - AccountType::ASSET, - AccountType::EXPENSE, - AccountType::REVENUE, - AccountType::INITIAL_BALANCE, - AccountType::BENEFICIARY, - AccountType::IMPORT, - AccountType::LOAN, - AccountType::RECONCILIATION, - AccountType::DEBT, - AccountType::MORTGAGE, - AccountType::LIABILITY_CREDIT, + AccountTypeEnum::DEFAULT->value, + AccountTypeEnum::CASH->value, + AccountTypeEnum::ASSET->value, + AccountTypeEnum::EXPENSE->value, + AccountTypeEnum::REVENUE->value, + AccountTypeEnum::INITIAL_BALANCE->value, + AccountTypeEnum::BENEFICIARY->value, + AccountTypeEnum::IMPORT->value, + AccountTypeEnum::LOAN->value, + AccountTypeEnum::RECONCILIATION->value, + AccountTypeEnum::DEBT->value, + AccountTypeEnum::MORTGAGE->value, + AccountTypeEnum::LIABILITY_CREDIT->value, ]; foreach ($types as $type) { if (null === AccountType::where('type', $type)->first()) { diff --git a/database/seeders/TransactionTypeSeeder.php b/database/seeders/TransactionTypeSeeder.php index 7ac0f3e975..401f993c2e 100644 --- a/database/seeders/TransactionTypeSeeder.php +++ b/database/seeders/TransactionTypeSeeder.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace Database\Seeders; +use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Models\TransactionType; use Illuminate\Database\Seeder; @@ -34,13 +35,13 @@ class TransactionTypeSeeder extends Seeder public function run(): void { $types = [ - TransactionType::WITHDRAWAL, + TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value, - TransactionType::TRANSFER, - TransactionType::OPENING_BALANCE, - TransactionType::RECONCILIATION, - TransactionType::INVALID, - TransactionType::LIABILITY_CREDIT, + TransactionTypeEnum::TRANSFER->value, + TransactionTypeEnum::OPENING_BALANCE->value, + TransactionTypeEnum::RECONCILIATION->value, + TransactionTypeEnum::INVALID->value, + TransactionTypeEnum::LIABILITY_CREDIT->value, ]; foreach ($types as $type) { diff --git a/routes/web.php b/routes/web.php index 147d547579..d977b3586d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -40,7 +40,7 @@ Route::group( // the rest $guard = config('passport.guard', null); - Route::middleware(['web', $guard ? 'auth:'.$guard : 'auth'])->group(function (): void { + Route::middleware(['web', null !== $guard ? 'auth:'.$guard : 'auth'])->group(function (): void { Route::post('/token/refresh', ['uses' => 'TransientTokenController@refresh', 'as' => 'token.refresh']); Route::post('/authorize', ['uses' => 'ApproveAuthorizationController@approve', 'as' => 'authorizations.approve']); Route::delete('/authorize', ['uses' => 'DenyAuthorizationController@deny', 'as' => 'authorizations.deny']);