diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php b/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php index aeff2c01d0..125f64c25b 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\BudgetLimit; use FireflyIII\Api\V1\Controllers\Controller; -use FireflyIII\Api\V1\Requests\Data\SameDateRequest; use FireflyIII\Api\V1\Requests\DateRangeRequest; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Budget; @@ -124,9 +123,7 @@ final class ShowController extends Controller $manager = $this->getManager(); $manager->parseIncludes('budget'); $pageSize = $this->parameters->get('limit'); - $collection = $this->blRepository->getAllBudgetLimits( - $request->attributes->get('start'), - $request->attributes->get('end')); + $collection = $this->blRepository->getAllBudgetLimits($request->attributes->get('start'), $request->attributes->get('end')); $count = $collection->count(); $budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); $paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page')); diff --git a/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php b/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php index 47e4f8e5f5..c6293319ad 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php @@ -26,7 +26,6 @@ namespace FireflyIII\Api\V1\Controllers\Models\Recurrence; use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Requests\DateRequest; -use FireflyIII\Api\V1\Requests\Generic\SingleDateRequest; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Jobs\CreateRecurringTransactions; use FireflyIII\Models\Recurrence; diff --git a/app/Console/Commands/Correction/CorrectsAccountTypes.php b/app/Console/Commands/Correction/CorrectsAccountTypes.php index ae45828486..b45c4cde82 100644 --- a/app/Console/Commands/Correction/CorrectsAccountTypes.php +++ b/app/Console/Commands/Correction/CorrectsAccountTypes.php @@ -231,9 +231,10 @@ class CorrectsAccountTypes extends Command { /** @var null|Transaction $res */ $res = $journal->transactions->firstWhere('amount', '>', 0); - if(null === $res) { + if (null === $res) { throw new FireflyException('Could not find transaction.'); } + return $res; } @@ -241,9 +242,10 @@ class CorrectsAccountTypes extends Command { /** @var null|Transaction $res */ $res = $journal->transactions->firstWhere('amount', '<', 0); - if(null === $res) { + if (null === $res) { throw new FireflyException('Could not find transaction.'); } + return $res; } diff --git a/app/Console/Commands/Upgrade/UpgradesToGroups.php b/app/Console/Commands/Upgrade/UpgradesToGroups.php index 4dd227e560..58b92eae82 100644 --- a/app/Console/Commands/Upgrade/UpgradesToGroups.php +++ b/app/Console/Commands/Upgrade/UpgradesToGroups.php @@ -93,7 +93,8 @@ class UpgradesToGroups extends Command return $amount && $identifier; }); - /** @var Transaction|null */ + + /** @var null|Transaction */ return $set->first(); } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 32d5bc4ae6..077c6c056a 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -34,7 +34,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\Preferences; use FireflyIII\User; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 7e49032b46..dc09d7f464 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -27,7 +27,6 @@ use Carbon\Carbon; use FireflyIII\Events\Security\System\UnknownUserTriedLogin; use FireflyIII\Events\Security\User\UserFailedLoginAttempt; use FireflyIII\Events\Security\User\UserSuccessfullyLoggedIn; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Providers\RouteServiceProvider; use FireflyIII\Repositories\User\UserRepositoryInterface; @@ -48,8 +47,6 @@ use Illuminate\Support\Facades\Cookie; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Validation\ValidationException; -use Psr\Container\ContainerExceptionInterface; -use Psr\Container\NotFoundExceptionInterface; use Symfony\Component\HttpFoundation\Response as ResponseAlias; /** diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 6c52e02385..7d7867f0be 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -38,7 +38,6 @@ use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Routing\Redirector; use Illuminate\Support\Facades\Log; -use Illuminate\Validation\ValidationException; use Illuminate\View\View; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; diff --git a/app/Http/Controllers/ObjectGroup/EditController.php b/app/Http/Controllers/ObjectGroup/EditController.php index 4204e90808..0771583af9 100644 --- a/app/Http/Controllers/ObjectGroup/EditController.php +++ b/app/Http/Controllers/ObjectGroup/EditController.php @@ -29,7 +29,6 @@ use FireflyIII\Http\Requests\ObjectGroupFormRequest; use FireflyIII\Models\ObjectGroup; use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface; use FireflyIII\Support\Facades\Preferences; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; @@ -77,7 +76,6 @@ final class EditController extends Controller /** * Update a piggy bank. - * */ public function update(ObjectGroupFormRequest $request, ObjectGroup $objectGroup): Redirector|RedirectResponse { diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 76670a6c2a..932414f182 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -38,7 +38,6 @@ use FireflyIII\Support\Http\Controllers\CreateStuff; use FireflyIII\User; use Illuminate\Auth\AuthenticationException; use Illuminate\Contracts\Auth\Guard; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; @@ -342,7 +341,6 @@ final class ProfileController extends Controller } /** - * * @throws AuthenticationException */ public function postLogoutOtherSessions(Request $request): Redirector|RedirectResponse diff --git a/app/Http/Controllers/System/CronController.php b/app/Http/Controllers/System/CronController.php index 560b64eb88..5ae03b91b6 100644 --- a/app/Http/Controllers/System/CronController.php +++ b/app/Http/Controllers/System/CronController.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\System; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Routing\ResponseFactory; use Illuminate\Http\Response; use Illuminate\Support\Facades\Log; diff --git a/app/Http/Controllers/Transaction/BulkController.php b/app/Http/Controllers/Transaction/BulkController.php index 029a697533..6afae496b1 100644 --- a/app/Http/Controllers/Transaction/BulkController.php +++ b/app/Http/Controllers/Transaction/BulkController.php @@ -34,7 +34,6 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Support\Facades\Preferences; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; use Illuminate\Routing\Redirector; diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index eafc6e973e..d875800819 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -42,7 +42,6 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Services\Internal\Update\JournalUpdateService; use FireflyIII\Support\Facades\Preferences; use FireflyIII\Support\Facades\Steam; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Http\RedirectResponse; use Illuminate\Routing\Redirector; use Illuminate\Support\Facades\Log; @@ -64,7 +63,7 @@ final class MassController extends Controller parent::__construct(); $this->middleware(function ($request, $next) { - app('view')->share('title', (string)trans('firefly.transactions')); + app('view')->share('title', (string) trans('firefly.transactions')); app('view')->share('mainTitleIcon', 'fa-exchange'); $this->repository = app(JournalRepositoryInterface::class); @@ -77,7 +76,7 @@ final class MassController extends Controller */ public function delete(array $journals): IlluminateView { - $subTitle = (string)trans('firefly.mass_delete_journals'); + $subTitle = (string) trans('firefly.mass_delete_journals'); // put previous url in session $this->rememberPreviousUrl('transactions.mass-delete.url'); @@ -85,15 +84,14 @@ final class MassController extends Controller return view('transactions.mass.delete', ['journals' => $journals, 'subTitle' => $subTitle]); } - public function destroy(MassDeleteJournalRequest $request): Redirector | RedirectResponse + public function destroy(MassDeleteJournalRequest $request): Redirector|RedirectResponse { Log::debug(sprintf('Now in %s', __METHOD__)); - $ids = $request->input('confirm_mass_delete'); - $count = 0; + $ids = $request->input('confirm_mass_delete'); + $count = 0; $objects = new TransactionGroupEventObjects(); - if (is_array($ids)) { Log::debug('Array of IDs', $ids); @@ -102,8 +100,8 @@ final class MassController extends Controller Log::debug(sprintf('Searching for ID #%d', $journalId)); /** @var null|TransactionJournal $journal */ - $journal = $this->repository->find((int)$journalId); - if (null !== $journal && (int)$journalId === $journal->id) { + $journal = $this->repository->find((int) $journalId); + if (null !== $journal && (int) $journalId === $journal->id) { $objects->appendFromTransactionGroup($journal->transactionGroup); $this->repository->destroyJournal($journal); @@ -119,7 +117,7 @@ final class MassController extends Controller session()->flash('success', trans_choice('firefly.mass_deleted_transactions_success', $count)); // trigger just after destruction - $flags = new TransactionGroupEventFlags(); + $flags = new TransactionGroupEventFlags(); event(new DestroyedSingleTransactionGroup($flags, $objects)); event(new WebhookMessagesRequestSending()); @@ -132,22 +130,22 @@ final class MassController extends Controller */ public function edit(array $journals): IlluminateView { - $subTitle = (string)trans('firefly.mass_edit_journals'); + $subTitle = (string) trans('firefly.mass_edit_journals'); /** @var AccountRepositoryInterface $accountRepository */ - $accountRepository = app(AccountRepositoryInterface::class); + $accountRepository = app(AccountRepositoryInterface::class); // valid withdrawal sources: - $array = array_keys(config(sprintf('firefly.source_dests.%s', TransactionTypeEnum::WITHDRAWAL->value))); - $withdrawalSources = $accountRepository->getAccountsByType($array); + $array = array_keys(config(sprintf('firefly.source_dests.%s', TransactionTypeEnum::WITHDRAWAL->value))); + $withdrawalSources = $accountRepository->getAccountsByType($array); // valid deposit destinations: $array = config(sprintf('firefly.source_dests.%s.%s', TransactionTypeEnum::DEPOSIT->value, AccountTypeEnum::REVENUE->value)); $depositDestinations = $accountRepository->getAccountsByType($array); /** @var BudgetRepositoryInterface $budgetRepository */ - $budgetRepository = app(BudgetRepositoryInterface::class); - $budgets = $budgetRepository->getBudgets(); + $budgetRepository = app(BudgetRepositoryInterface::class); + $budgets = $budgetRepository->getBudgets(); // reverse amounts foreach ($journals as $index => $journal) { @@ -171,18 +169,18 @@ final class MassController extends Controller * * @throws FireflyException */ - public function update(MassEditJournalRequest $request): Redirector | RedirectResponse + public function update(MassEditJournalRequest $request): Redirector|RedirectResponse { $journalIds = $request->get('journals'); if (!is_array($journalIds)) { // TODO this is a weird error, should be caught. throw new FireflyException('This is not an array.'); } - $count = 0; + $count = 0; /** @var string $journalId */ foreach ($journalIds as $journalId) { - $integer = (int)$journalId; + $integer = (int) $journalId; try { $this->updateJournal($integer, $request); @@ -231,7 +229,7 @@ final class MassController extends Controller return null; } - return (int)$value[$journalId]; + return (int) $value[$journalId]; } private function getStringFromRequest(MassEditJournalRequest $request, int $journalId, string $string): ?string @@ -244,7 +242,7 @@ final class MassController extends Controller return null; } - return (string)$value[$journalId]; + return (string) $value[$journalId]; } /** @@ -260,7 +258,7 @@ final class MassController extends Controller // for each field, call the update service. $service->setTransactionJournal($journal); - $data = [ + $data = [ 'date' => $this->getDateFromRequest($request, $journal->id, 'date'), 'description' => $this->getStringFromRequest($request, $journal->id, 'description'), 'source_id' => $this->getIntFromRequest($request, $journal->id, 'source_id'), diff --git a/app/Http/Controllers/Webhooks/DeleteController.php b/app/Http/Controllers/Webhooks/DeleteController.php index 4cb3f31d61..2309d28cac 100644 --- a/app/Http/Controllers/Webhooks/DeleteController.php +++ b/app/Http/Controllers/Webhooks/DeleteController.php @@ -27,7 +27,6 @@ namespace FireflyIII\Http\Controllers\Webhooks; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Webhook; use FireflyIII\Support\Facades\FireflyConfig; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Log; diff --git a/app/Http/Controllers/Webhooks/EditController.php b/app/Http/Controllers/Webhooks/EditController.php index a2c0b16202..8f5efb73cd 100644 --- a/app/Http/Controllers/Webhooks/EditController.php +++ b/app/Http/Controllers/Webhooks/EditController.php @@ -27,7 +27,6 @@ namespace FireflyIII\Http\Controllers\Webhooks; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Webhook; use FireflyIII\Support\Facades\FireflyConfig; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Log; @@ -54,6 +53,7 @@ final class EditController extends Controller return $next($request); }); } + public function index(Webhook $webhook): Factory|View { if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { diff --git a/app/Http/Controllers/Webhooks/ShowController.php b/app/Http/Controllers/Webhooks/ShowController.php index 6deaea3a26..9a6dbadadb 100644 --- a/app/Http/Controllers/Webhooks/ShowController.php +++ b/app/Http/Controllers/Webhooks/ShowController.php @@ -27,7 +27,6 @@ namespace FireflyIII\Http\Controllers\Webhooks; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Webhook; use FireflyIII\Support\Facades\FireflyConfig; -use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Log; diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php index c09eb6fcbd..494e19f942 100644 --- a/app/Repositories/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/Budget/AvailableBudgetRepository.php @@ -54,17 +54,17 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U /** @var AvailableBudget $availableBudget */ foreach ($availableBudgets as $availableBudget) { - $start = $availableBudget->start_date->format('Y-m-d'); - $end = $availableBudget->end_date->format('Y-m-d'); - $key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end); + $start = $availableBudget->start_date->format('Y-m-d'); + $end = $availableBudget->end_date->format('Y-m-d'); + $key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end); if (array_key_exists($key, $exists)) { Log::debug(sprintf( - 'Found duplicate AB: %s %s, %s-%s. Has been deleted', - $availableBudget->transaction_currency_id, - $availableBudget->amount, - $start, - $end - )); + 'Found duplicate AB: %s %s, %s-%s. Has been deleted', + $availableBudget->transaction_currency_id, + $availableBudget->amount, + $start, + $end + )); $availableBudget->delete(); } $exists[$key] = true; @@ -96,12 +96,13 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U ->where('transaction_currency_id', $currency->id) ->where('start_date', $start->format('Y-m-d')) ->where('end_date', $end->format('Y-m-d')) - ->first(); + ->first() + ; } public function findById(int $id): ?AvailableBudget { - /** @var AvailableBudget|null */ + /** @var null|AvailableBudget */ return $this->user->availableBudgets->find($id); } @@ -117,7 +118,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U $q1->whereBetween('start_date', [$start, $end]); $q1->orWhereBetween('end_date', [$start, $end]); }) - ->get(['available_budgets.*']); + ->get(['available_budgets.*']) + ; } /** @@ -125,7 +127,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U */ public function get(?Carbon $start = null, ?Carbon $end = null): Collection { - $query = $this->user->availableBudgets()->with(['transactionCurrency']); + $query = $this->user->availableBudgets()->with(['transactionCurrency']); if ($start instanceof Carbon && $end instanceof Carbon) { $query->where(static function (Builder $q1) use ($start, $end): void { $q1->where('start_date', '=', $start->format('Y-m-d')); @@ -141,7 +143,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U #[Deprecated] public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string { - $amount = '0'; + $amount = '0'; /** @var null|AvailableBudget $availableBudget */ $availableBudget = $this->user @@ -149,7 +151,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U ->where('transaction_currency_id', $currency->id) ->where('start_date', $start->format('Y-m-d')) ->where('end_date', $end->format('Y-m-d')) - ->first(); + ->first() + ; if (null !== $availableBudget) { return $availableBudget->amount; } @@ -165,7 +168,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U return $this->user ->availableBudgets() ->where('transaction_currency_id', $currency->id) - ->get(); + ->get() + ; } /** @@ -194,7 +198,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U ->availableBudgets() ->where('start_date', '=', $start->format('Y-m-d')) ->where('end_date', '=', $end->format('Y-m-d')) - ->get(); + ->get() + ; } public function getAvailableBudgetWithCurrency(Carbon $start, Carbon $end): array @@ -205,7 +210,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U ->availableBudgets() ->where('start_date', $start->format('Y-m-d')) ->where('end_date', $end->format('Y-m-d')) - ->get(); + ->get() + ; Log::debug(sprintf('Found %d available budgets (already converted)', $availableBudgets->count())); @@ -220,7 +226,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U : $availableBudget->transaction_currency_id; $field = $convertToPrimary && $availableBudget->transaction_currency_id !== $primary->id ? 'native_amount' : 'amount'; $return[$currencyId] ??= '0'; - $amount = '' === (string)$availableBudget->{$field} ? '0' : (string)$availableBudget->{$field}; + $amount = '' === (string) $availableBudget->{$field} ? '0' : (string) $availableBudget->{$field}; $return[$currencyId] = bcadd($return[$currencyId], $amount); Log::debug(sprintf('Add #%d %s (%s) for a total of %s', $currencyId, $amount, $field, $return[$currencyId])); } @@ -236,25 +242,26 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U ->where('transaction_currency_id', $currency->id) ->where('start_date', $start->format('Y-m-d')) ->where('end_date', $end->format('Y-m-d')) - ->first(); + ->first() + ; } #[Override] public function recalculateAmount(AvailableBudget $availableBudget): void { Log::debug(sprintf('Now in recalculateAmount(#%d)', $availableBudget->id)); - $newAmount = '0'; - $period = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY()); + $newAmount = '0'; + $period = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY()); Log::debug(sprintf( - 'Now recalculating available budget #%d, (%s to %s)', - $availableBudget->id, - $availableBudget->start_date->format('Y-m-d'), - $availableBudget->end_date->format('Y-m-d') - )); + 'Now recalculating available budget #%d, (%s to %s)', + $availableBudget->id, + $availableBudget->start_date->format('Y-m-d'), + $availableBudget->end_date->format('Y-m-d') + )); // have to recalculate everything just in case. $blRepository = app(BudgetLimitRepositoryInterface::class); $blRepository->setUser($this->user); - $set = $blRepository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date); + $set = $blRepository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date); Log::debug(sprintf('Found %d interesting budget limit(s).', $set->count())); /** @var BudgetLimit $budgetLimit */ @@ -275,14 +282,15 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): AvailableBudget { /** @var null|AvailableBudget $availableBudget */ - $availableBudget = $this->user + $availableBudget = $this->user ->availableBudgets() ->where('transaction_currency_id', $currency->id) ->where('start_date', $start->format('Y-m-d')) ->where('end_date', $end->format('Y-m-d')) - ->first(); + ->first() + ; if (null === $availableBudget) { - $availableBudget = new AvailableBudget(); + $availableBudget = new AvailableBudget(); $availableBudget->user()->associate($this->user); $availableBudget->transactionCurrency()->associate($currency); $availableBudget->start_date = $start->startOfDay(); @@ -302,21 +310,21 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U if ($start instanceof Carbon) { $start = $data['start']->startOfDay(); } - $end = $data['end']; + $end = $data['end']; if ($end instanceof Carbon) { $end = $data['end']->endOfDay(); } return AvailableBudget::create([ - 'user_id' => $this->user->id, - 'user_group_id' => $this->user->user_group_id, - 'transaction_currency_id' => $data['currency_id'], - 'amount' => $data['amount'], - 'start_date' => $start, - 'start_date_tz' => $start->format('e'), - 'end_date' => $end, - 'end_date_tz' => $end->format('e'), - ]); + 'user_id' => $this->user->id, + 'user_group_id' => $this->user->user_group_id, + 'transaction_currency_id' => $data['currency_id'], + 'amount' => $data['amount'], + 'start_date' => $start, + 'start_date_tz' => $start->format('e'), + 'end_date' => $end, + 'end_date_tz' => $end->format('e'), + ]); } public function update(AvailableBudget $availableBudget, array $data): AvailableBudget @@ -368,24 +376,24 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U $blRepository->setUser($this->user); Log::debug(sprintf( - 'Found interesting budget limit #%d (%s to %s)', - $budgetLimit->id, - $budgetLimit->start_date->format('Y-m-d'), - $budgetLimit->end_date->format('Y-m-d') - )); + 'Found interesting budget limit #%d (%s to %s)', + $budgetLimit->id, + $budgetLimit->start_date->format('Y-m-d'), + $budgetLimit->end_date->format('Y-m-d') + )); // overlap in days: - $limitPeriod = Period::make($budgetLimit->start_date, $budgetLimit->end_date, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE()); + $limitPeriod = Period::make($budgetLimit->start_date, $budgetLimit->end_date, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE()); // if both equal each other, amount from this BL must be added to the AB if ($limitPeriod->equals($availableBudgetPeriod)) { Log::debug('This budget limit is equal to the available budget period.'); - return (string)$budgetLimit->amount; + return (string) $budgetLimit->amount; } // if budget limit period is inside AB period, it can be added in full. if ($availableBudgetPeriod->contains($limitPeriod)) { Log::debug('This budget limit is smaller than the available budget period.'); - return (string)$budgetLimit->amount; + return (string) $budgetLimit->amount; } if ($availableBudgetPeriod->overlapsWith($limitPeriod)) { @@ -394,7 +402,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U if ($overlap instanceof Period) { $length = $overlap->length(); - return bcmul($blRepository->getDailyAmount($budgetLimit), (string)$length); + return bcmul($blRepository->getDailyAmount($budgetLimit), (string) $length); } } diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index a8cc394082..f3e1aabb07 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -296,13 +296,15 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf ->currencies() ->orderBy('code', 'ASC') ->withPivot(['group_default']) - ->get(); + ->get() + ; $all->map(static function (TransactionCurrency $current): TransactionCurrency { $current->userGroupEnabled = true; $current->userGroupNative = 1 === (int) $current->pivot->group_default; return $current; }); + /** @var Collection */ return $all; } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 1adc89ce3c..96c2cddfe6 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -129,7 +129,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac */ public function firstNull(): ?TransactionJournal { - /** @var TransactionJournal|null */ + /** @var null|TransactionJournal */ return $this->user ->transactionJournals() ->orderBy('date', 'ASC') @@ -150,11 +150,13 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac if (null === $transaction) { throw new FireflyException(sprintf('Your administration is broken. Transaction journal #%d has no destination transaction.', $journal->id)); } - /** @var Account|null $res */ - $res = $transaction->account; - if(null === $res) { + + /** @var null|Account $res */ + $res = $transaction->account; + if (null === $res) { throw new FireflyException('Account is unexpectedly NULL.'); } + return $res; } @@ -180,7 +182,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac public function getLast(): ?TransactionJournal { - /** @var TransactionJournal|null */ + /** @var null|TransactionJournal */ return $this->user ->transactionJournals() ->orderBy('date', 'DESC') @@ -227,11 +229,12 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac throw new FireflyException(sprintf('Your administration is broken. Transaction journal #%d has no source transaction.', $journal->id)); } - /** @var Account|null $res */ - $res = $transaction->account; - if(null === $res) { + /** @var null|Account $res */ + $res = $transaction->account; + if (null === $res) { throw new FireflyException('Account is unexpectedly NULL.'); } + return $res; } diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.php index 5069299d31..aa0c71777e 100644 --- a/app/Rules/BelongsUser.php +++ b/app/Rules/BelongsUser.php @@ -82,6 +82,7 @@ class BelongsUser implements ValidationRule $objects = $class::where('user_id', '=', auth()->user()->id)->get(); } $count = 0; + /** @var Model $object */ foreach ($objects as $object) { $objectValue = trim((string) $object->{$field}); diff --git a/app/Rules/BelongsUserGroup.php b/app/Rules/BelongsUserGroup.php index 97f43f7c8b..47acb6f958 100644 --- a/app/Rules/BelongsUserGroup.php +++ b/app/Rules/BelongsUserGroup.php @@ -95,6 +95,7 @@ class BelongsUserGroup implements ValidationRule $objects = $class::where('user_group_id', '=', $this->userGroup->id)->get(); } $count = 0; + /** @var Model $object */ foreach ($objects as $object) { $objectValue = trim((string) $object->{$field}); diff --git a/app/Rules/IsAllowedGroupAction.php b/app/Rules/IsAllowedGroupAction.php index e070b2faa3..1b7a64ef4c 100644 --- a/app/Rules/IsAllowedGroupAction.php +++ b/app/Rules/IsAllowedGroupAction.php @@ -71,6 +71,7 @@ class IsAllowedGroupAction implements ValidationRule private function validateUserGroup(): void { Log::debug('This method is not yet in use', $this->acceptedRoles); + try { throw new FireflyException('Here we are'); } catch (FireflyException $e) { diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index cd42602d0d..3ff5514b89 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -633,7 +633,7 @@ class JournalUpdateService */ private function updateField(string $fieldName): void { - if(null === $this->transactionJournal) { + if (null === $this->transactionJournal) { return; } if (array_key_exists($fieldName, $this->data) && '' !== (string) $this->data[$fieldName]) { @@ -668,7 +668,15 @@ class JournalUpdateService } $factory->updateOrCreate($set); } - event(new TransactionGroupRequestsAuditLogEntry($this->transactionJournal->user, $this->transactionJournal, sprintf('update_%s', $fieldName), $this->transactionJournal->{$fieldName}, $value)); + event( + new TransactionGroupRequestsAuditLogEntry( + $this->transactionJournal->user, + $this->transactionJournal, + sprintf('update_%s', $fieldName), + $this->transactionJournal->{$fieldName}, + $value + ) + ); $this->transactionJournal->{$fieldName} = $value; Log::debug(sprintf('Updated %s', $fieldName)); diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php index 54058e87fd..94bc3cf46b 100644 --- a/app/Support/Export/ExportDataGenerator.php +++ b/app/Support/Export/ExportDataGenerator.php @@ -62,7 +62,6 @@ use Illuminate\Support\Facades\Log; use League\Csv\AbstractCsv; use League\Csv\CannotInsertRecord; use League\Csv\Exception; -use League\Csv\Writer; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; @@ -89,7 +88,8 @@ class ExportDataGenerator private bool $exportTransactions = false; private Carbon $start; private User $user; - //private UserGroup $userGroup; + + // private UserGroup $userGroup; public function __construct() { @@ -284,7 +284,7 @@ class ExportDataGenerator } // load the CSV document from a string - $csv = AbstractCsv::fromString(); + $csv = AbstractCsv::fromString(); // insert the header try { @@ -353,7 +353,7 @@ class ExportDataGenerator } // load the CSV document from a string - $csv = AbstractCsv::fromString(); + $csv = AbstractCsv::fromString(); // insert the header try { @@ -412,7 +412,7 @@ class ExportDataGenerator } // load the CSV document from a string - $csv = AbstractCsv::fromString(); + $csv = AbstractCsv::fromString(); // insert the header try { @@ -457,7 +457,7 @@ class ExportDataGenerator } // load the CSV document from a string - $csv = AbstractCsv::fromString(); + $csv = AbstractCsv::fromString(); // insert the header try { @@ -537,7 +537,7 @@ class ExportDataGenerator } // load the CSV document from a string - $csv = AbstractCsv::fromString(); + $csv = AbstractCsv::fromString(); // insert the header try { @@ -704,7 +704,7 @@ class ExportDataGenerator } } // load the CSV document from a string - $csv = AbstractCsv::fromString(); + $csv = AbstractCsv::fromString(); // insert the header try { @@ -851,7 +851,7 @@ class ExportDataGenerator } // load the CSV document from a string - $csv = AbstractCsv::fromString(); + $csv = AbstractCsv::fromString(); // insert the header try { @@ -907,7 +907,7 @@ class ExportDataGenerator } // load the CSV document from a string - $csv = AbstractCsv::fromString(); + $csv = AbstractCsv::fromString(); // insert the header try { @@ -1103,7 +1103,7 @@ class ExportDataGenerator } // load the CSV document from a string - $csv = AbstractCsv::fromString(); + $csv = AbstractCsv::fromString(); // insert the header try { diff --git a/app/TransactionRules/Actions/ConvertToDeposit.php b/app/TransactionRules/Actions/ConvertToDeposit.php index 10bd29657d..d7f12f74b1 100644 --- a/app/TransactionRules/Actions/ConvertToDeposit.php +++ b/app/TransactionRules/Actions/ConvertToDeposit.php @@ -253,11 +253,12 @@ class ConvertToDeposit implements ActionInterface throw new FireflyException(sprintf('Cannot find destination transaction for journal #%d', $journal->id)); } - /** @var Account|null $res */ - $res = $destTransaction->account; - if(null === $res) { + /** @var null|Account $res */ + $res = $destTransaction->account; + if (null === $res) { throw new FireflyException('Account is unexpectedly NULL.'); } + return $res; } @@ -272,11 +273,12 @@ class ConvertToDeposit implements ActionInterface throw new FireflyException(sprintf('Cannot find source transaction for journal #%d', $journal->id)); } - /** @var Account|null $res */ - $res = $sourceTransaction->account; - if(null === $res) { + /** @var null|Account $res */ + $res = $sourceTransaction->account; + if (null === $res) { throw new FireflyException('Account is unexpectedly NULL.'); } + return $res; } } diff --git a/app/TransactionRules/Actions/ConvertToTransfer.php b/app/TransactionRules/Actions/ConvertToTransfer.php index c48a18a09e..22f3e3ca4b 100644 --- a/app/TransactionRules/Actions/ConvertToTransfer.php +++ b/app/TransactionRules/Actions/ConvertToTransfer.php @@ -305,11 +305,12 @@ class ConvertToTransfer implements ActionInterface throw new FireflyException(sprintf('Cannot find destination transaction for journal #%d', $journal->id)); } - /** @var Account|null $res */ - $res = $destTransaction->account; - if(null === $res) { + /** @var null|Account $res */ + $res = $destTransaction->account; + if (null === $res) { throw new FireflyException('Account is unexpectedly NULL.'); } + return $res; } @@ -337,11 +338,12 @@ class ConvertToTransfer implements ActionInterface throw new FireflyException(sprintf('Cannot find source transaction for journal #%d', $journal->id)); } - /** @var Account|null $res */ - $res = $sourceTransaction->account; - if(null === $res) { + /** @var null|Account $res */ + $res = $sourceTransaction->account; + if (null === $res) { throw new FireflyException('Account is unexpectedly NULL.'); } + return $res; } diff --git a/app/TransactionRules/Actions/ConvertToWithdrawal.php b/app/TransactionRules/Actions/ConvertToWithdrawal.php index 096153df8f..039562a28b 100644 --- a/app/TransactionRules/Actions/ConvertToWithdrawal.php +++ b/app/TransactionRules/Actions/ConvertToWithdrawal.php @@ -244,11 +244,12 @@ class ConvertToWithdrawal implements ActionInterface throw new FireflyException(sprintf('Cannot find destination transaction for journal #%d', $journal->id)); } - /** @var Account|null $res */ - $res = $destTransaction->account; - if(null === $res) { + /** @var null|Account $res */ + $res = $destTransaction->account; + if (null === $res) { throw new FireflyException('Account is unexpectedly NULL.'); } + return $res; } @@ -263,11 +264,12 @@ class ConvertToWithdrawal implements ActionInterface throw new FireflyException(sprintf('Cannot find source transaction for journal #%d', $journal->id)); } - /** @var Account|null $res */ - $res = $sourceTransaction->account; - if(null === $res) { + /** @var null|Account $res */ + $res = $sourceTransaction->account; + if (null === $res) { throw new FireflyException('Account is unexpectedly NULL.'); } + return $res; } } diff --git a/app/Transformers/AbstractTransformer.php b/app/Transformers/AbstractTransformer.php index 96532797ec..e0d38afe98 100644 --- a/app/Transformers/AbstractTransformer.php +++ b/app/Transformers/AbstractTransformer.php @@ -44,7 +44,6 @@ abstract class AbstractTransformer extends TransformerAbstract return $this->parameters; } - /** * @deprecated */ diff --git a/app/Transformers/TransactionGroupTransformer.php b/app/Transformers/TransactionGroupTransformer.php index 123a8a7f16..858096e66d 100644 --- a/app/Transformers/TransactionGroupTransformer.php +++ b/app/Transformers/TransactionGroupTransformer.php @@ -182,7 +182,7 @@ class TransactionGroupTransformer extends AbstractTransformer */ private function getDestinationTransaction(TransactionJournal $journal): Transaction { - /** @var Transaction|null $result */ + /** @var null|Transaction $result */ $result = $journal->transactions->first(static fn (Transaction $transaction): bool => (float) $transaction->amount > 0); if (null === $result) { throw new FireflyException(sprintf('Journal #%d unexpectedly has no destination transaction.', $journal->id)); @@ -225,7 +225,7 @@ class TransactionGroupTransformer extends AbstractTransformer */ private function getSourceTransaction(TransactionJournal $journal): Transaction { - /** @var Transaction|null $result */ + /** @var null|Transaction $result */ $result = $journal->transactions->first(static fn (Transaction $transaction): bool => (float) $transaction->amount < 0); if (null === $result) { throw new FireflyException(sprintf('Journal #%d unexpectedly has no source transaction.', $journal->id)); diff --git a/composer.lock b/composer.lock index 0169a00e50..b9bf5b7775 100644 --- a/composer.lock +++ b/composer.lock @@ -10545,16 +10545,16 @@ }, { "name": "fruitcake/laravel-debugbar", - "version": "v4.0.10", + "version": "v4.1.1", "source": { "type": "git", "url": "https://github.com/fruitcake/laravel-debugbar.git", - "reference": "96afd5efc93c2cb3140df356893381296259695b" + "reference": "048876cf8ffdd8af2b82306289e2c0453fa0b059" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/96afd5efc93c2cb3140df356893381296259695b", - "reference": "96afd5efc93c2cb3140df356893381296259695b", + "url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/048876cf8ffdd8af2b82306289e2c0453fa0b059", + "reference": "048876cf8ffdd8af2b82306289e2c0453fa0b059", "shasum": "" }, "require": { @@ -10562,7 +10562,7 @@ "illuminate/session": "^11|^12|^13.0", "illuminate/support": "^11|^12|^13.0", "php": "^8.2", - "php-debugbar/php-debugbar": "^3.3.1", + "php-debugbar/php-debugbar": "^3.5", "php-debugbar/symfony-bridge": "^1.1" }, "replace": { @@ -10576,7 +10576,7 @@ "laravel/telescope": "^5.16", "livewire/livewire": "^3.7|^4", "mockery/mockery": "^1.3.3", - "orchestra/testbench-dusk": "^9|^10", + "orchestra/testbench-dusk": "^9|^10|^11", "php-debugbar/twig-bridge": "^2.0", "phpstan/phpstan-phpunit": "^2", "phpstan/phpstan-strict-rules": "^2.0", @@ -10594,7 +10594,7 @@ ] }, "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -10631,7 +10631,7 @@ ], "support": { "issues": "https://github.com/fruitcake/laravel-debugbar/issues", - "source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.0.10" + "source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.1.1" }, "funding": [ { @@ -10643,7 +10643,7 @@ "type": "github" } ], - "time": "2026-02-26T11:45:48+00:00" + "time": "2026-03-08T08:20:19+00:00" }, { "name": "hamcrest/hamcrest-php", diff --git a/config/firefly.php b/config/firefly.php index d7892ef013..89e883c6fb 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envDefaultWhenEmpty(env('USE_RUNNING_BALANCE'), true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2026-03-07', - 'build_time' => 1772875424, + 'version' => 'develop/2026-03-09', + 'build_time' => 1773028179, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used.