Skip to content

Firefly III: a personal finances manager

Clean up code.

James Cole46e130fdfe4c
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
index 5ce99fb923..f4a2fa05b3 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
@@ -255,7 +255,7 @@ class ListController extends Controller
$unfiltered = $recurringRepos->getAll();
// filter selection
- $collection = $unfiltered->filter(/** @phpstan-ignore-line */
+ $collection = $unfiltered->filter( // @phpstan-ignore-line
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions as $transaction) {
@@ -305,7 +305,7 @@ class ListController extends Controller
$ruleRepos = app(RuleRepositoryInterface::class);
$unfiltered = $ruleRepos->getAll();
- $collection = $unfiltered->filter(/** @phpstan-ignore-line */
+ $collection = $unfiltered->filter( // @phpstan-ignore-line
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line
/** @var RuleTrigger $trigger */
foreach ($rule->ruleTriggers as $trigger) {
diff --git a/app/Console/Commands/Correction/DeleteEmptyJournals.php b/app/Console/Commands/Correction/DeleteEmptyJournals.php
index b8953b57d9..ea6dcd2d7d 100644
--- a/app/Console/Commands/Correction/DeleteEmptyJournals.php
+++ b/app/Console/Commands/Correction/DeleteEmptyJournals.php
@@ -61,8 +61,7 @@ class DeleteEmptyJournals extends Command
{
$set = Transaction::whereNull('deleted_at')
->groupBy('transactions.transaction_journal_id')
- ->get([DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']);
- /** @phpstan-ignore-line */
+ ->get([DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']); // @phpstan-ignore-line
$total = 0;
/** @var Transaction $row */
foreach ($set as $row) {
diff --git a/app/Events/DestroyedTransactionLink.php b/app/Events/DestroyedTransactionLink.php
index 0f806901ed..9353e95883 100644
--- a/app/Events/DestroyedTransactionLink.php
+++ b/app/Events/DestroyedTransactionLink.php
@@ -33,8 +33,7 @@ class DestroyedTransactionLink extends Event
{
use SerializesModels;
- private TransactionJournalLink $link;
- /** @phpstan-ignore-line */
+ private TransactionJournalLink $link; // @phpstan-ignore-line
/**
* DestroyedTransactionLink constructor.
diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.php
index fc7c819d79..510d90b764 100644
--- a/app/Handlers/Events/APIEventHandler.php
+++ b/app/Handlers/Events/APIEventHandler.php
@@ -50,7 +50,7 @@ class APIEventHandler
if (null !== $user) {
try {
Notification::send($user, new NewAccessToken());
- } catch (Exception $e) { /** @phpstan-ignore-line */
+ } catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php
index 2f54f3cf18..e4f7c5e36b 100644
--- a/app/Handlers/Events/AdminEventHandler.php
+++ b/app/Handlers/Events/AdminEventHandler.php
@@ -31,7 +31,6 @@ use FireflyIII\Notifications\Admin\TestNotification;
use FireflyIII\Notifications\Admin\UserInvitation;
use FireflyIII\Notifications\Admin\VersionCheckResult;
use FireflyIII\Repositories\User\UserRepositoryInterface;
-use FireflyIII\Support\Facades\FireflyConfig;
use Illuminate\Support\Facades\Notification;
/**
@@ -58,7 +57,7 @@ class AdminEventHandler
if ($repository->hasRole($user, 'owner')) {
try {
Notification::send($user, new UserInvitation($event->invitee));
- } catch (Exception $e) { /** @phpstan-ignore-line */
+ } catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -96,7 +95,7 @@ class AdminEventHandler
if ($repository->hasRole($user, 'owner')) {
try {
Notification::send($user, new VersionCheckResult($event->message));
- } catch (Exception $e) { /** @phpstan-ignore-line */
+ } catch (Exception $e) {// @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -130,7 +129,7 @@ class AdminEventHandler
}
try {
Notification::send($event->user, new TestNotification($event->user->email));
- } catch (Exception $e) { /** @phpstan-ignore-line */
+ } catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.php
index 500b5ceec1..e7e8dc68b8 100644
--- a/app/Handlers/Events/AutomationHandler.php
+++ b/app/Handlers/Events/AutomationHandler.php
@@ -75,7 +75,7 @@ class AutomationHandler
}
try {
Notification::send($user, new TransactionCreation($groups));
- } catch (Exception $e) { /** @phpstan-ignore-line */
+ } catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.php
index ced3ab2aa9..d6864d095d 100644
--- a/app/Handlers/Events/BillEventHandler.php
+++ b/app/Handlers/Events/BillEventHandler.php
@@ -51,7 +51,7 @@ class BillEventHandler
app('log')->debug('Bill reminder is true!');
try {
Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff));
- } catch (Exception $e) { /** @phpstan-ignore-line */
+ } catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
diff --git a/app/Handlers/Events/Model/BudgetLimitHandler.php b/app/Handlers/Events/Model/BudgetLimitHandler.php
index 77bcba63bc..c1bc0d047b 100644
--- a/app/Handlers/Events/Model/BudgetLimitHandler.php
+++ b/app/Handlers/Events/Model/BudgetLimitHandler.php
@@ -93,7 +93,7 @@ class BudgetLimitHandler
$viewRange = '1M';
}
// safety catch
- if(null === $viewRange || is_array($viewRange)){
+ if (null === $viewRange || is_array($viewRange)) {
$viewRange = '1M';
}
$viewRange = (string)$viewRange;
@@ -190,8 +190,8 @@ class BudgetLimitHandler
);
// overlap in days:
$limitPeriod = Period::make(
- $budgetLimit->start_date,
- $budgetLimit->end_date,
+ $budgetLimit->start_date,
+ $budgetLimit->end_date,
precision : Precision::DAY(),
boundaries: Boundaries::EXCLUDE_NONE()
);
@@ -236,8 +236,8 @@ class BudgetLimitHandler
return '0';
}
$limitPeriod = Period::make(
- $budgetLimit->start_date,
- $budgetLimit->end_date,
+ $budgetLimit->start_date,
+ $budgetLimit->end_date,
precision : Precision::DAY(),
boundaries: Boundaries::EXCLUDE_NONE()
);
diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php
index fb4206fbf1..9cf9b577fe 100644
--- a/app/Handlers/Events/UserEventHandler.php
+++ b/app/Handlers/Events/UserEventHandler.php
@@ -131,7 +131,7 @@ class UserEventHandler
$group = null;
// create a new group.
- while (true === $groupExists) { /** @phpstan-ignore-line */
+ while (true === $groupExists) { // @phpstan-ignore-line
$groupExists = UserGroup::where('title', $groupTitle)->count() > 0;
if (false === $groupExists) {
$group = UserGroup::create(['title' => $groupTitle]);
@@ -205,7 +205,7 @@ class UserEventHandler
if (false === $entry['notified']) {
try {
Notification::send($user, new UserLogin($ipAddress));
- } catch (Exception $e) {/** @phpstan-ignore-line */
+ } catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -239,7 +239,7 @@ class UserEventHandler
if ($repository->hasRole($user, 'owner')) {
try {
Notification::send($user, new AdminRegistrationNotification($event->user));
- } catch (Exception $e) { /** @phpstan-ignore-line */
+ } catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -316,7 +316,7 @@ class UserEventHandler
{
try {
Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token])));
- } catch (Exception $e) { /** @phpstan-ignore-line */
+ } catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -364,7 +364,7 @@ class UserEventHandler
if ($sendMail) {
try {
Notification::send($event->user, new UserRegistrationNotification());
- } catch (Exception $e) { /** @phpstan-ignore-line */
+ } catch (Exception $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
diff --git a/app/Helpers/Collector/Extensions/AttachmentCollection.php b/app/Helpers/Collector/Extensions/AttachmentCollection.php
index 4d929fb4db..1f9e84894c 100644
--- a/app/Helpers/Collector/Extensions/AttachmentCollection.php
+++ b/app/Helpers/Collector/Extensions/AttachmentCollection.php
@@ -56,9 +56,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_contains(strtolower($attachment['filename']), strtolower($name)) || str_contains(
- strtolower($attachment['title']),
- strtolower($name)
- );
+ strtolower($attachment['title']),
+ strtolower($name)
+ );
if (true === $result) {
return true;
}
@@ -142,9 +142,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_contains(strtolower($attachment['filename']), strtolower($name)) && !str_contains(
- strtolower($attachment['title']),
- strtolower($name)
- );
+ strtolower($attachment['title']),
+ strtolower($name)
+ );
if (true === $result) {
return true;
}
@@ -179,9 +179,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_ends_with(strtolower($attachment['filename']), strtolower($name)) && !str_ends_with(
- strtolower($attachment['title']),
- strtolower($name)
- );
+ strtolower($attachment['title']),
+ strtolower($name)
+ );
if (true === $result) {
return true;
}
@@ -216,9 +216,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_starts_with(strtolower($attachment['filename']), strtolower($name)) && !str_starts_with(
- strtolower($attachment['title']),
- strtolower($name)
- );
+ strtolower($attachment['title']),
+ strtolower($name)
+ );
if (true === $result) {
return true;
}
@@ -246,9 +246,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_ends_with(strtolower($attachment['filename']), strtolower($name)) || str_ends_with(
- strtolower($attachment['title']),
- strtolower($name)
- );
+ strtolower($attachment['title']),
+ strtolower($name)
+ );
if (true === $result) {
return true;
}
@@ -330,9 +330,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_starts_with(strtolower($attachment['filename']), strtolower($name)) || str_starts_with(
- strtolower($attachment['title']),
- strtolower($name)
- );
+ strtolower($attachment['title']),
+ strtolower($name)
+ );
if (true === $result) {
return true;
}
diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php
index a4b816ee25..67e5238f03 100644
--- a/app/Helpers/Report/NetWorth.php
+++ b/app/Helpers/Report/NetWorth.php
@@ -102,8 +102,8 @@ class NetWorth implements NetWorthInterface
/** @var Account $account */
foreach ($accounts as $account) {
app('log')->debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name));
- $currency = $this->getRepository()->getAccountCurrency($account);
- if(null === $currency) {
+ $currency = $this->getRepository()->getAccountCurrency($account);
+ if (null === $currency) {
$currency = app('amount')->getDefaultCurrency();
}
$currencyId = $currency->id;
@@ -208,7 +208,7 @@ class NetWorth implements NetWorthInterface
$balance = bcsub($balance, $virtualBalance);
}
- $return[$currency->id] ??= [
+ $return[$currency->id] ??= [
'id' => (string)$currency->id,
'name' => $currency->name,
'symbol' => $currency->symbol,
diff --git a/app/Http/Controllers/Account/CreateController.php b/app/Http/Controllers/Account/CreateController.php
index a590844c11..d73a1ee05c 100644
--- a/app/Http/Controllers/Account/CreateController.php
+++ b/app/Http/Controllers/Account/CreateController.php
@@ -152,7 +152,7 @@ class CreateController extends Controller
// update preferences if necessary:
$frontPage = app('preferences')->get('frontPageAccounts', [])->data;
- if(!is_array($frontPage)) {
+ if (!is_array($frontPage)) {
$frontPage = [];
}
if (AccountType::ASSET === $account->accountType->type) {
diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.php
index 8a7b4f820e..f227deda97 100644
--- a/app/Http/Controllers/Account/EditController.php
+++ b/app/Http/Controllers/Account/EditController.php
@@ -94,7 +94,7 @@ class EditController extends Controller
$hasLocation = null !== $location;
$locations = [
'location' => [
- 'latitude' => null !== old('location_latitude') ? old('location_latitude'): $latitude,
+ 'latitude' => null !== old('location_latitude') ? old('location_latitude') : $latitude,
'longitude' => null !== old('location_longitude') ? old('location_longitude') : $longitude,
'zoom_level' => null !== old('location_zoom_level') ? old('location_zoom_level') : $zoomLevel,
'has_location' => $hasLocation || 'true' === old('location_has_location'),
diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.php
index 276767ea93..d84d9a7eda 100644
--- a/app/Http/Controllers/Admin/HomeController.php
+++ b/app/Http/Controllers/Admin/HomeController.php
@@ -26,7 +26,6 @@ namespace FireflyIII\Http\Controllers\Admin;
use FireflyIII\Events\AdminRequestedTestMessage;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser;
-use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Notifications\UrlValidator;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php
index cfe87cca85..3c863ab747 100644
--- a/app/Http/Controllers/Admin/UserController.php
+++ b/app/Http/Controllers/Admin/UserController.php
@@ -170,7 +170,7 @@ class UserController extends Controller
$subTitle = (string)trans('firefly.user_administration');
$subTitleIcon = 'fa-users';
$users = $this->repository->all();
- $singleUserMode = (bool) app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
+ $singleUserMode = (bool)app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$allowInvites = false;
if (!$this->externalIdentity && $singleUserMode) {
// also registration enabled.
diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php
index 49f1590b7a..e7a6f71a31 100644
--- a/app/Http/Controllers/AttachmentController.php
+++ b/app/Http/Controllers/AttachmentController.php
@@ -127,7 +127,7 @@ class AttachmentController extends Controller
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
- ->header('Content-Length', (string) strlen($content));
+ ->header('Content-Length', (string)strlen($content));
return $response;
}
diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php
index dc43499cda..7098c7bf7d 100644
--- a/app/Http/Controllers/Auth/TwoFactorController.php
+++ b/app/Http/Controllers/Auth/TwoFactorController.php
@@ -170,7 +170,7 @@ class TwoFactorController extends Controller
private function isBackupCode(string $mfaCode): bool
{
$list = app('preferences')->get('mfa_recovery', [])->data;
- if(!is_array($list)) {
+ if (!is_array($list)) {
$list = [];
}
if (in_array($mfaCode, $list, true)) {
@@ -187,8 +187,8 @@ class TwoFactorController extends Controller
*/
private function removeFromBackupCodes(string $mfaCode): void
{
- $list = app('preferences')->get('mfa_recovery', [])->data;
- if(!is_array($list)) {
+ $list = app('preferences')->get('mfa_recovery', [])->data;
+ if (!is_array($list)) {
$list = [];
}
$newList = array_values(array_diff($list, [$mfaCode]));
diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.php
index a7e4cfa43a..60079d3eeb 100644
--- a/app/Http/Controllers/Bill/IndexController.php
+++ b/app/Http/Controllers/Bill/IndexController.php
@@ -249,7 +249,7 @@ class IndexController extends Controller
* @var array $entry
*/
foreach ($array as $currencyId => $entry) {
- $totals[$currencyId] ??= [
+ $totals[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_code' => $entry['currency_code'],
'currency_name' => $entry['currency_name'],
diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php
index 3a7605bd78..cc9d868ca4 100644
--- a/app/Http/Controllers/Budget/BudgetLimitController.php
+++ b/app/Http/Controllers/Budget/BudgetLimitController.php
@@ -135,8 +135,8 @@ class BudgetLimitController extends Controller
if (null === $currency || null === $budget) {
throw new FireflyException('No valid currency or budget.');
}
- $start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
- $end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
+ $start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
+ $end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
if (false === $start || false === $end) {
return response()->json([]);
diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php
index 5b0bfd082c..e082379c76 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -106,13 +106,13 @@ class IndexController extends Controller
$isCustomRange = session('is_custom_range', false);
if (false === $isCustomRange) {
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
- $end ??= app('navigation')->endOfPeriod($start, $range);
+ $end ??= app('navigation')->endOfPeriod($start, $range);
}
// overrule start and end if necessary:
if (true === $isCustomRange) {
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
- $end ??= session('end', today(config('app.timezone'))->endOfMonth());
+ $end ??= session('end', today(config('app.timezone'))->endOfMonth());
}
@@ -135,7 +135,7 @@ class IndexController extends Controller
// get budgeted for default currency:
if (0 === count($availableBudgets)) {
- $budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency, );
+ $budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency,);
$spentArr = $this->opsRepository->sumExpenses($start, $end, null, null, $defaultCurrency);
$spent = $spentArr[$defaultCurrency->id]['sum'] ?? '0';
unset($spentArr);
@@ -194,7 +194,7 @@ class IndexController extends Controller
$array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0';
// budgeted in period:
- $budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency, );
+ $budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency,);
$array['budgeted'] = $budgeted;
$availableBudgets[] = $array;
unset($spentArr);
@@ -283,13 +283,12 @@ class IndexController extends Controller
foreach ($budget['spent'] as $spent) {
$currencyId = $spent['currency_id'];
$sums['spent'][$currencyId]
- ??=
- [
- 'amount' => '0',
- 'currency_id' => $spent['currency_id'],
- 'currency_symbol' => $spent['currency_symbol'],
- 'currency_decimal_places' => $spent['currency_decimal_places'],
- ];
+ ??= [
+ 'amount' => '0',
+ 'currency_id' => $spent['currency_id'],
+ 'currency_symbol' => $spent['currency_symbol'],
+ 'currency_decimal_places' => $spent['currency_decimal_places'],
+ ];
$sums['spent'][$currencyId]['amount'] = bcadd($sums['spent'][$currencyId]['amount'], $spent['spent']);
}
@@ -297,23 +296,22 @@ class IndexController extends Controller
foreach ($budget['budgeted'] as $budgeted) {
$currencyId = $budgeted['currency_id'];
$sums['budgeted'][$currencyId]
- ??=
- [
- 'amount' => '0',
- 'currency_id' => $budgeted['currency_id'],
- 'currency_symbol' => $budgeted['currency_symbol'],
- 'currency_decimal_places' => $budgeted['currency_decimal_places'],
- ];
+ ??= [
+ 'amount' => '0',
+ 'currency_id' => $budgeted['currency_id'],
+ 'currency_symbol' => $budgeted['currency_symbol'],
+ 'currency_decimal_places' => $budgeted['currency_decimal_places'],
+ ];
$sums['budgeted'][$currencyId]['amount'] = bcadd($sums['budgeted'][$currencyId]['amount'], $budgeted['amount']);
// also calculate how much left from budgeted:
- $sums['left'][$currencyId] ??=
- [
- 'amount' => '0',
- 'currency_id' => $budgeted['currency_id'],
- 'currency_symbol' => $budgeted['currency_symbol'],
- 'currency_decimal_places' => $budgeted['currency_decimal_places'],
- ];
+ $sums['left'][$currencyId]
+ ??= [
+ 'amount' => '0',
+ 'currency_id' => $budgeted['currency_id'],
+ 'currency_symbol' => $budgeted['currency_symbol'],
+ 'currency_decimal_places' => $budgeted['currency_decimal_places'],
+ ];
}
}
// final calculation for 'left':
diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php
index 69d41adb64..9188ddf0bf 100644
--- a/app/Http/Controllers/Budget/ShowController.php
+++ b/app/Http/Controllers/Budget/ShowController.php
@@ -90,7 +90,7 @@ class ShowController extends Controller
/** @var Carbon $start */
$start ??= session('start');
/** @var Carbon $end */
- $end ??= session('end');
+ $end ??= session('end');
$subTitle = trans(
'firefly.without_budget_between',
['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]
diff --git a/app/Http/Controllers/Category/NoCategoryController.php b/app/Http/Controllers/Category/NoCategoryController.php
index 85e0ecf9b0..00eaa19cc6 100644
--- a/app/Http/Controllers/Category/NoCategoryController.php
+++ b/app/Http/Controllers/Category/NoCategoryController.php
@@ -86,7 +86,7 @@ class NoCategoryController extends Controller
/** @var Carbon $start */
$start ??= session('start');
/** @var Carbon $end */
- $end ??= session('end');
+ $end ??= session('end');
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$subTitle = trans(
diff --git a/app/Http/Controllers/Category/ShowController.php b/app/Http/Controllers/Category/ShowController.php
index f0a14d0bfe..2e78674a41 100644
--- a/app/Http/Controllers/Category/ShowController.php
+++ b/app/Http/Controllers/Category/ShowController.php
@@ -88,7 +88,7 @@ class ShowController extends Controller
/** @var Carbon $start */
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
- $end ??= session('end', today(config('app.timezone'))->endOfMonth());
+ $end ??= session('end', today(config('app.timezone'))->endOfMonth());
$subTitleIcon = 'fa-bookmark';
$page = (int)$request->get('page');
$attachments = $this->repository->getAttachments($category);
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index a782a0ad83..e58755eb82 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -237,7 +237,7 @@ class BudgetController extends Controller
// group by asset account ID:
foreach ($journals as $journal) {
$key = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -302,7 +302,7 @@ class BudgetController extends Controller
$chartData = [];
foreach ($journals as $journal) {
$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -367,7 +367,7 @@ class BudgetController extends Controller
/** @var array $journal */
foreach ($journals as $journal) {
$key = sprintf('%d-%d', $journal['destination_account_id'], $journal['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php
index 12160be621..25f87a46c3 100644
--- a/app/Http/Controllers/Chart/CategoryReportController.php
+++ b/app/Http/Controllers/Chart/CategoryReportController.php
@@ -86,7 +86,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -192,7 +192,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -228,7 +228,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -364,7 +364,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -400,7 +400,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
diff --git a/app/Http/Controllers/Chart/DoubleReportController.php b/app/Http/Controllers/Chart/DoubleReportController.php
index 80ea374d94..7e006af206 100644
--- a/app/Http/Controllers/Chart/DoubleReportController.php
+++ b/app/Http/Controllers/Chart/DoubleReportController.php
@@ -85,7 +85,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -120,7 +120,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -155,7 +155,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -323,7 +323,7 @@ class DoubleReportController extends Controller
// do something
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -341,7 +341,7 @@ class DoubleReportController extends Controller
// do something
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -383,7 +383,7 @@ class DoubleReportController extends Controller
// do something
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -401,7 +401,7 @@ class DoubleReportController extends Controller
// do something
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
diff --git a/app/Http/Controllers/Chart/ExpenseReportController.php b/app/Http/Controllers/Chart/ExpenseReportController.php
index a7009394b8..56d2f4c2a0 100644
--- a/app/Http/Controllers/Chart/ExpenseReportController.php
+++ b/app/Http/Controllers/Chart/ExpenseReportController.php
@@ -147,7 +147,7 @@ class ExpenseReportController extends Controller
while ($currentStart < $end) {
$currentEnd = clone $currentStart;
- $currentEnd = $currentEnd->$function(); /** @phpstan-ignore-line */
+ $currentEnd = $currentEnd->$function(); // @phpstan-ignore-line
// get expenses grouped by opposing name:
$expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd));
@@ -166,7 +166,7 @@ class ExpenseReportController extends Controller
$currentExpense = $expenses[$name] ?? '0';
// add to sum:
- $sumOfIncome[$exp->id] ??= '0';
+ $sumOfIncome[$exp->id] ??= '0';
$sumOfExpense[$exp->id] ??= '0';
$sumOfIncome[$exp->id] = bcadd($sumOfIncome[$exp->id], $currentIncome);
$sumOfExpense[$exp->id] = bcadd($sumOfExpense[$exp->id], $currentExpense);
diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php
index 956255553e..737519c4f5 100644
--- a/app/Http/Controllers/Chart/ReportController.php
+++ b/app/Http/Controllers/Chart/ReportController.php
@@ -182,7 +182,7 @@ class ReportController extends Controller
foreach ($journals as $journal) {
$period = $journal['date']->format($format);
$currencyId = (int)$journal['currency_id'];
- $data[$currencyId] ??= [
+ $data[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.php
index e01e5c7186..6eb24c40fd 100644
--- a/app/Http/Controllers/Chart/TagReportController.php
+++ b/app/Http/Controllers/Chart/TagReportController.php
@@ -87,7 +87,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -123,7 +123,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -159,7 +159,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -195,7 +195,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -231,7 +231,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -369,7 +369,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -405,7 +405,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
diff --git a/app/Http/Controllers/Chart/TransactionController.php b/app/Http/Controllers/Chart/TransactionController.php
index a4c0d3352b..5d73fcc2a0 100644
--- a/app/Http/Controllers/Chart/TransactionController.php
+++ b/app/Http/Controllers/Chart/TransactionController.php
@@ -78,7 +78,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$budget = $journal['budget_name'] ?? (string)trans('firefly.no_budget');
$title = sprintf('%s (%s)', $budget, $journal['currency_symbol']);
- $data[$title] ??= [
+ $data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -131,7 +131,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$category = $journal['category_name'] ?? (string)trans('firefly.no_category');
$title = sprintf('%s (%s)', $category, $journal['currency_symbol']);
- $data[$title] ??= [
+ $data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -184,7 +184,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$name = $journal['destination_account_name'];
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
- $data[$title] ??= [
+ $data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -237,7 +237,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$name = $journal['source_account_name'];
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
- $data[$title] ??= [
+ $data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 8b5236f4b5..876b4e1962 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -57,7 +57,7 @@ abstract class Controller extends BaseController
{
// is site a demo site?
$isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false));
- $isDemoSite = (bool) $isDemoSiteConfig->data;
+ $isDemoSite = (bool)$isDemoSiteConfig->data;
app('view')->share('IS_DEMO_SITE', $isDemoSite);
app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php
index f2b9934c14..c45380af83 100644
--- a/app/Http/Controllers/DebugController.php
+++ b/app/Http/Controllers/DebugController.php
@@ -42,6 +42,7 @@ use Illuminate\View\View;
use Monolog\Handler\RotatingFileHandler;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
+use const PHP_SAPI;
/**
* Class DebugController
@@ -127,7 +128,7 @@ class DebugController extends Controller
// get latest log file:
$logger = Log::driver();
// PHPstan doesn't recognize the method because of its polymorphic nature.
- $handlers = $logger->getHandlers(); /** @phpstan-ignore-line */
+ $handlers = $logger->getHandlers(); // @phpstan-ignore-line
$logContent = '';
foreach ($handlers as $handler) {
if ($handler instanceof RotatingFileHandler) {
@@ -172,7 +173,7 @@ class DebugController extends Controller
'db_version' => app('fireflyconfig')->get('db_version', 1)->data,
'php_version' => PHP_VERSION,
'php_os' => PHP_OS,
- 'interface' => \PHP_SAPI,
+ 'interface' => PHP_SAPI,
'bcscale' => bcscale(),
'display_errors' => ini_get('display_errors'),
'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')),
@@ -277,7 +278,7 @@ class DebugController extends Controller
$result = setlocale(LC_ALL, $code);
$localeAttempts[$code] = $result === $code;
}
- setlocale(LC_ALL, (string) $original);
+ setlocale(LC_ALL, (string)$original);
return [
'user_id' => auth()->user()->id,
diff --git a/app/Http/Controllers/Export/IndexController.php b/app/Http/Controllers/Export/IndexController.php
index c7e3cdbb45..bbcc5249dc 100644
--- a/app/Http/Controllers/Export/IndexController.php
+++ b/app/Http/Controllers/Export/IndexController.php
@@ -102,7 +102,7 @@ class IndexController extends Controller
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
- ->header('Content-Length', (string) strlen($result['transactions']));
+ ->header('Content-Length', (string)strlen($result['transactions']));
// return CSV file made from 'transactions' array.
return $response;
diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php
index b10f43dd89..aaf1d6f230 100644
--- a/app/Http/Controllers/JavascriptController.php
+++ b/app/Http/Controllers/JavascriptController.php
@@ -47,7 +47,7 @@ class JavascriptController extends Controller
/**
* Show info about accounts.
*
- * @param AccountRepositoryInterface $repository
+ * @param AccountRepositoryInterface $repository
*
* @return Response
* @throws ContainerExceptionInterface
@@ -101,8 +101,8 @@ class JavascriptController extends Controller
/**
* Show some common variables to be used in scripts.
*
- * @param Request $request
- * @param AccountRepositoryInterface $repository
+ * @param Request $request
+ * @param AccountRepositoryInterface $repository
*
* @return Response
* @throws FireflyException
diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php
index 3f684ffa43..5533aa02e0 100644
--- a/app/Http/Controllers/Json/BoxController.php
+++ b/app/Http/Controllers/Json/BoxController.php
@@ -86,12 +86,12 @@ class BoxController extends Controller
static function (AvailableBudget $availableBudget) use ($currency) { // @phpstan-ignore-line
if ($availableBudget->transaction_currency_id === $currency->id) {
app('log')->debug(sprintf(
- 'Will include AB #%d: from %s-%s amount %s',
- $availableBudget->id,
- $availableBudget->start_date->format('Y-m-d'),
- $availableBudget->end_date->format('Y-m-d'),
- $availableBudget->amount
- ));
+ 'Will include AB #%d: from %s-%s amount %s',
+ $availableBudget->id,
+ $availableBudget->start_date->format('Y-m-d'),
+ $availableBudget->end_date->format('Y-m-d'),
+ $availableBudget->amount
+ ));
return $availableBudget;
}
@@ -181,7 +181,7 @@ class BoxController extends Controller
$amount = $journal['amount'] ?? '0';
$incomes[$currencyId] ??= '0';
$incomes[$currencyId] = bcadd($incomes[$currencyId], app('steam')->positive($amount));
- $sums[$currencyId] ??= '0';
+ $sums[$currencyId] ??= '0';
$sums[$currencyId] = bcadd($sums[$currencyId], app('steam')->positive($amount));
}
@@ -196,7 +196,7 @@ class BoxController extends Controller
$currencyId = (int)$journal['currency_id'];
$expenses[$currencyId] ??= '0';
$expenses[$currencyId] = bcadd($expenses[$currencyId], $journal['amount'] ?? '0');
- $sums[$currencyId] ??= '0';
+ $sums[$currencyId] ??= '0';
$sums[$currencyId] = bcadd($sums[$currencyId], $journal['amount']);
}
diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.php
index cf3725491b..1c02784a40 100644
--- a/app/Http/Controllers/Json/IntroController.php
+++ b/app/Http/Controllers/Json/IntroController.php
@@ -46,7 +46,7 @@ class IntroController extends Controller
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
{
app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
- $specificPage ??= '';
+ $specificPage ??= '';
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (0 === count($specificSteps)) {
diff --git a/app/Http/Controllers/Json/RecurrenceController.php b/app/Http/Controllers/Json/RecurrenceController.php
index 40dfe3f987..0ac57139f8 100644
--- a/app/Http/Controllers/Json/RecurrenceController.php
+++ b/app/Http/Controllers/Json/RecurrenceController.php
@@ -80,7 +80,7 @@ class RecurrenceController extends Controller
$repetitions = (int)$request->get('reps');
$repetitionMoment = '';
- if(false === $start || false === $end || false === $firstDate || false === $endDate) {
+ if (false === $start || false === $end || false === $firstDate || false === $endDate) {
return response()->json();
}
@@ -157,7 +157,7 @@ class RecurrenceController extends Controller
} catch (InvalidFormatException $e) {
$date = Carbon::today(config('app.timezone'));
}
- if(false === $date) {
+ if (false === $date) {
return response()->json();
}
$date->startOfDay();
diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php
index cc5d9852cd..a526b3061b 100644
--- a/app/Http/Controllers/PreferencesController.php
+++ b/app/Http/Controllers/PreferencesController.php
@@ -98,8 +98,8 @@ class PreferencesController extends Controller
/** @var array<int, int> $accountIds */
$accountIds = $accounts->pluck('id')->toArray();
$viewRange = app('navigation')->getViewRange(false);
- $frontPageAccountsPref = app('preferences')->get('frontPageAccounts', $accountIds);
- $frontPageAccounts = $frontPageAccountsPref->data;
+ $frontPageAccountsPref = app('preferences')->get('frontPageAccounts', $accountIds);
+ $frontPageAccounts = $frontPageAccountsPref->data;
if (!is_array($frontPageAccounts)) {
$frontPageAccounts = $accountIds;
}
diff --git a/app/Http/Controllers/Report/BalanceController.php b/app/Http/Controllers/Report/BalanceController.php
index f4e96efd4f..617feffeab 100644
--- a/app/Http/Controllers/Report/BalanceController.php
+++ b/app/Http/Controllers/Report/BalanceController.php
@@ -104,7 +104,7 @@ class BalanceController extends Controller
foreach ($journals as $journal) {
$sourceAccount = $journal['source_account_id'];
$currencyId = $journal['currency_id'];
- $spent[$sourceAccount] ??= [
+ $spent[$sourceAccount] ??= [
'source_account_id' => $sourceAccount,
'currency_id' => $journal['currency_id'],
'currency_code' => $journal['currency_code'],
@@ -116,7 +116,7 @@ class BalanceController extends Controller
$spent[$sourceAccount]['spent'] = bcadd($spent[$sourceAccount]['spent'], $journal['amount']);
// also fix sum:
- $report['sums'][$budgetId][$currencyId] ??= [
+ $report['sums'][$budgetId][$currencyId] ??= [
'sum' => '0',
'currency_id' => $journal['currency_id'],
'currency_code' => $journal['currency_code'],
diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.php
index 49fd5730dd..7e05b96eee 100644
--- a/app/Http/Controllers/Report/BudgetController.php
+++ b/app/Http/Controllers/Report/BudgetController.php
@@ -130,7 +130,7 @@ class BudgetController extends Controller
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
- $report[$sourceAccountId]['currencies'][$currencyId] ??= [
+ $report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -167,7 +167,7 @@ class BudgetController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -240,7 +240,7 @@ class BudgetController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$budgetId]['currencies'][$currencyId] ??= [
+ $report[$budgetId]['currencies'][$currencyId] ??= [
'sum' => '0',
'sum_pct' => '0',
'currency_id' => $currency['currency_id'],
@@ -332,7 +332,7 @@ class BudgetController extends Controller
$count++;
$key = sprintf('%d-%d', $budget['id'], $currency['currency_id']);
$dateKey = $journal['date']->format($keyFormat);
- $report[$key] ??= [
+ $report[$key] ??= [
'id' => $budget['id'],
'name' => sprintf('%s (%s)', $budget['name'], $currency['currency_name']),
'sum' => '0',
diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php
index 0a8e0a68d8..fd1f86a862 100644
--- a/app/Http/Controllers/Report/CategoryController.php
+++ b/app/Http/Controllers/Report/CategoryController.php
@@ -107,13 +107,11 @@ class CategoryController extends Controller
];
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]
- ??=
-
- [
- 'spent' => '0',
- 'earned' => '0',
- 'sum' => '0',
- ];
+ ??= [
+ 'spent' => '0',
+ 'earned' => '0',
+ 'sum' => '0',
+ ];
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]['spent'] = bcadd(
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]['spent'],
$journal['amount']
@@ -134,22 +132,19 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$report[$destinationId]['currencies'][$currencyId]
- ??=
- [
- 'currency_id' => $currency['currency_id'],
- 'currency_symbol' => $currency['currency_symbol'],
- 'currency_name' => $currency['currency_name'],
- 'currency_decimal_places' => $currency['currency_decimal_places'],
- 'categories' => [],
- ];
+ ??= [
+ 'currency_id' => $currency['currency_id'],
+ 'currency_symbol' => $currency['currency_symbol'],
+ 'currency_name' => $currency['currency_name'],
+ 'currency_decimal_places' => $currency['currency_decimal_places'],
+ 'categories' => [],
+ ];
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]
- ??=
-
- [
- 'spent' => '0',
- 'earned' => '0',
- 'sum' => '0',
- ];
+ ??= [
+ 'spent' => '0',
+ 'earned' => '0',
+ 'sum' => '0',
+ ];
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]['earned'] = bcadd(
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]['earned'],
$journal['amount']
@@ -205,7 +200,7 @@ class CategoryController extends Controller
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
- $report[$sourceAccountId]['currencies'][$currencyId] ??= [
+ $report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -243,7 +238,7 @@ class CategoryController extends Controller
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$destinationAccountId = $journal['destination_account_id'];
- $report[$destinationAccountId]['currencies'][$currencyId] ??= [
+ $report[$destinationAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -287,7 +282,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -415,7 +410,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$categoryId]['currencies'][$currencyId] ??= [
+ $report[$categoryId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -456,7 +451,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$categoryId]['currencies'][$currencyId] ??= [
+ $report[$categoryId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
diff --git a/app/Http/Controllers/Report/DoubleController.php b/app/Http/Controllers/Report/DoubleController.php
index 932dcf1a74..ee0835e66c 100644
--- a/app/Http/Controllers/Report/DoubleController.php
+++ b/app/Http/Controllers/Report/DoubleController.php
@@ -141,7 +141,7 @@ class DoubleController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
diff --git a/app/Http/Controllers/Report/OperationsController.php b/app/Http/Controllers/Report/OperationsController.php
index 68c6d45a74..556c794679 100644
--- a/app/Http/Controllers/Report/OperationsController.php
+++ b/app/Http/Controllers/Report/OperationsController.php
@@ -162,7 +162,7 @@ class OperationsController extends Controller
/** @var int $currencyId */
foreach ($keys as $currencyId) {
$currencyInfo = $incomes['sums'][$currencyId] ?? $expenses['sums'][$currencyId];
- $sums[$currencyId] ??= [
+ $sums[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_name' => $currencyInfo['currency_name'],
'currency_code' => $currencyInfo['currency_code'],
diff --git a/app/Http/Controllers/Report/TagController.php b/app/Http/Controllers/Report/TagController.php
index 735e8bf833..72567c3674 100644
--- a/app/Http/Controllers/Report/TagController.php
+++ b/app/Http/Controllers/Report/TagController.php
@@ -100,13 +100,11 @@ class TagController extends Controller
];
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]
- ??=
-
- [
- 'spent' => '0',
- 'earned' => '0',
- 'sum' => '0',
- ];
+ ??= [
+ 'spent' => '0',
+ 'earned' => '0',
+ 'sum' => '0',
+ ];
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]['spent'] = bcadd(
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]['spent'],
$journal['amount']
@@ -127,22 +125,19 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$report[$destinationId]['currencies'][$currencyId]
- ??=
- [
- 'currency_id' => $currency['currency_id'],
- 'currency_symbol' => $currency['currency_symbol'],
- 'currency_name' => $currency['currency_name'],
- 'currency_decimal_places' => $currency['currency_decimal_places'],
- 'tags' => [],
- ];
+ ??= [
+ 'currency_id' => $currency['currency_id'],
+ 'currency_symbol' => $currency['currency_symbol'],
+ 'currency_name' => $currency['currency_name'],
+ 'currency_decimal_places' => $currency['currency_decimal_places'],
+ 'tags' => [],
+ ];
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]
- ??=
-
- [
- 'spent' => '0',
- 'earned' => '0',
- 'sum' => '0',
- ];
+ ??= [
+ 'spent' => '0',
+ 'earned' => '0',
+ 'sum' => '0',
+ ];
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]['earned'] = bcadd(
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]['earned'],
$journal['amount']
@@ -198,7 +193,7 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
- $report[$sourceAccountId]['currencies'][$currencyId] ??= [
+ $report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -236,7 +231,7 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
$destinationAccountId = $journal['destination_account_id'];
- $report[$destinationAccountId]['currencies'][$currencyId] ??= [
+ $report[$destinationAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -280,7 +275,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -408,7 +403,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$tagId]['currencies'][$currencyId] ??= [
+ $report[$tagId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -449,7 +444,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$tagId]['currencies'][$currencyId] ??= [
+ $report[$tagId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index 39a90fe943..fa129a000c 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -49,7 +49,8 @@ use Psr\Container\NotFoundExceptionInterface;
class ReportController extends Controller
{
use RenderPartialViews;
- protected ReportHelperInterface $helper;
+
+ protected ReportHelperInterface $helper;
private BudgetRepositoryInterface $repository;
/**
@@ -328,7 +329,7 @@ class ReportController extends Controller
* @throws FireflyException
*
*/
- public function postIndex(ReportFormRequest $request): RedirectResponse|Redirector|View
+ public function postIndex(ReportFormRequest $request): RedirectResponse | Redirector | View
{
// report type:
$reportType = $request->get('report_type');
diff --git a/app/Http/Controllers/Rule/SelectController.php b/app/Http/Controllers/Rule/SelectController.php
index 64f675da48..2d77544620 100644
--- a/app/Http/Controllers/Rule/SelectController.php
+++ b/app/Http/Controllers/Rule/SelectController.php
@@ -109,7 +109,7 @@ class SelectController extends Controller
*
* @return Factory|View|RedirectResponse
*/
- public function selectTransactions(Rule $rule): Factory|View|RedirectResponse
+ public function selectTransactions(Rule $rule): Factory | View | RedirectResponse
{
if (false === $rule->active) {
session()->flash('warning', trans('firefly.cannot_fire_inactive_rules'));
@@ -136,7 +136,7 @@ class SelectController extends Controller
public function testTriggers(TestRuleFormRequest $request): JsonResponse
{
// build fake rule
- $rule = new Rule();
+ $rule = new Rule();
/** @var \Illuminate\Database\Eloquent\Collection<int, RuleTrigger> $triggers */
$triggers = new Collection();
$rule->strict = '1' === $request->get('strict');
diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php
index 80c312d46b..e5eccf6b11 100644
--- a/app/Http/Controllers/System/InstallController.php
+++ b/app/Http/Controllers/System/InstallController.php
@@ -179,7 +179,7 @@ class InstallController extends Controller
return;
}
- file_put_contents($publicKey, (string) $key->getPublicKey());
+ file_put_contents($publicKey, (string)$key->getPublicKey());
file_put_contents($privateKey, $key->toString('PKCS1'));
}
}
diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php
index 357aac9813..7bc69c140f 100644
--- a/app/Http/Controllers/TagController.php
+++ b/app/Http/Controllers/TagController.php
@@ -243,8 +243,8 @@ class TagController extends Controller
$subTitleIcon = 'fa-tag';
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
- $start ??= session('start');
- $end ??= session('end');
+ $start ??= session('start');
+ $end ??= session('end');
$location = $this->repository->getLocation($tag);
$attachments = $this->repository->getAttachments($tag);
$subTitle = trans(
diff --git a/app/Http/Controllers/Transaction/DeleteController.php b/app/Http/Controllers/Transaction/DeleteController.php
index 9088adbbf5..9c039827d7 100644
--- a/app/Http/Controllers/Transaction/DeleteController.php
+++ b/app/Http/Controllers/Transaction/DeleteController.php
@@ -101,7 +101,7 @@ class DeleteController extends Controller
*
* @return RedirectResponse|Redirector
*/
- public function destroy(TransactionGroup $group): RedirectResponse|Redirector
+ public function destroy(TransactionGroup $group): RedirectResponse | Redirector
{
app('log')->debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
if (!$this->isEditableGroup($group)) {
diff --git a/app/Http/Controllers/Transaction/ShowController.php b/app/Http/Controllers/Transaction/ShowController.php
index 27fccefa86..f4c1746566 100644
--- a/app/Http/Controllers/Transaction/ShowController.php
+++ b/app/Http/Controllers/Transaction/ShowController.php
@@ -32,7 +32,6 @@ use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface
use FireflyIII\Transformers\TransactionGroupTransformer;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;
-use Illuminate\Http\Request;
use Illuminate\View\View;
use Symfony\Component\HttpFoundation\ParameterBag;
@@ -81,7 +80,7 @@ class ShowController extends Controller
* @return Factory|View
* @throws FireflyException
*/
- public function show( TransactionGroup $transactionGroup)
+ public function show(TransactionGroup $transactionGroup)
{
/** @var TransactionJournal|null $first */
$first = $transactionGroup->transactionJournals()->first(['transaction_journals.*']);
@@ -162,9 +161,9 @@ class ShowController extends Controller
$amounts[$symbol]['amount'] = bcadd($amounts[$symbol]['amount'], $transaction['amount']);
if (null !== $transaction['foreign_amount'] && '' !== $transaction['foreign_amount']
&& bccomp(
- '0',
- $transaction['foreign_amount']
- ) !== 0) {
+ '0',
+ $transaction['foreign_amount']
+ ) !== 0) {
// same for foreign currency:
$foreignSymbol = $transaction['foreign_currency_symbol'];
if (!array_key_exists($foreignSymbol, $amounts)) {
diff --git a/app/Http/Controllers/Webhooks/IndexController.php b/app/Http/Controllers/Webhooks/IndexController.php
index a5a868fd31..886828e891 100644
--- a/app/Http/Controllers/Webhooks/IndexController.php
+++ b/app/Http/Controllers/Webhooks/IndexController.php
@@ -26,7 +26,6 @@ namespace FireflyIII\Http\Controllers\Webhooks;
use FireflyIII\Http\Controllers\Controller;
use Illuminate\Contracts\View\Factory;
-use Illuminate\Http\Request;
use Illuminate\View\View;
/**
diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php
index 6206520be5..78d56c5a99 100644
--- a/app/Http/Middleware/Range.php
+++ b/app/Http/Middleware/Range.php
@@ -69,13 +69,13 @@ class Range
// ignore preference. set the range to be the current month:
if (!app('session')->has('start') && !app('session')->has('end')) {
$viewRange = app('preferences')->get('viewRange', '1M')->data;
- if(is_array($viewRange)) {
+ if (is_array($viewRange)) {
$viewRange = '1M';
}
- $today = today(config('app.timezone'));
- $start = app('navigation')->updateStartDate((string) $viewRange, $today);
- $end = app('navigation')->updateEndDate((string) $viewRange, $start);
+ $today = today(config('app.timezone'));
+ $start = app('navigation')->updateStartDate((string)$viewRange, $today);
+ $end = app('navigation')->updateEndDate((string)$viewRange, $start);
app('session')->put('start', $start);
app('session')->put('end', $end);
diff --git a/app/Jobs/DownloadExchangeRates.php b/app/Jobs/DownloadExchangeRates.php
index 24a7da19e9..ae0d3ebc9a 100644
--- a/app/Jobs/DownloadExchangeRates.php
+++ b/app/Jobs/DownloadExchangeRates.php
@@ -121,7 +121,7 @@ class DownloadExchangeRates implements ShouldQueue
return;
}
$date = Carbon::createFromFormat('Y-m-d', $json['date'], config('app.timezone'));
- if(false === $date) {
+ if (false === $date) {
return;
}
$this->saveRates($currency, $date, $json['rates']);
diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php
index 47ad86903b..9d48ce949e 100644
--- a/app/Jobs/MailError.php
+++ b/app/Jobs/MailError.php
@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Jobs;
use Exception;
-use FireflyIII\Exceptions\FireflyException;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Message;
use Illuminate\Queue\InteractsWithQueue;
@@ -90,7 +89,7 @@ class MailError extends Job implements ShouldQueue
}
}
);
- } catch (Exception | TransportException $e) { /** @phpstan-ignore-line */
+ } catch (Exception | TransportException $e) { // @phpstan-ignore-line
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');
diff --git a/app/Mail/AccessTokenCreatedMail.php b/app/Mail/AccessTokenCreatedMail.php
index 185300fa13..6a4f1db4bf 100644
--- a/app/Mail/AccessTokenCreatedMail.php
+++ b/app/Mail/AccessTokenCreatedMail.php
@@ -40,9 +40,7 @@ class AccessTokenCreatedMail extends Mailable
/**
* AccessTokenCreatedMail constructor.
*/
- public function __construct()
- {
- }
+ public function __construct() {}
/**
* Build the message.
diff --git a/app/Mail/AdminTestMail.php b/app/Mail/AdminTestMail.php
index 502f015361..e0861e5999 100644
--- a/app/Mail/AdminTestMail.php
+++ b/app/Mail/AdminTestMail.php
@@ -44,9 +44,7 @@ class AdminTestMail extends Mailable
/**
* AdminTestMail constructor.
*/
- public function __construct()
- {
- }
+ public function __construct() {}
/**
* Build the message.
diff --git a/app/Mail/InvitationMail.php b/app/Mail/InvitationMail.php
index 78d84086b1..f26184547b 100644
--- a/app/Mail/InvitationMail.php
+++ b/app/Mail/InvitationMail.php
@@ -53,7 +53,7 @@ class InvitationMail extends Mailable
$this->invitee = $invitee;
$this->admin = $admin;
$this->url = $url;
- $this->host = (string) parse_url($url, PHP_URL_HOST);
+ $this->host = (string)parse_url($url, PHP_URL_HOST);
}
/**
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 52c8d1f66d..e55bd5a772 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -49,13 +49,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
- * @property int $account_type_id
+ * @property int $account_type_id
* @property string $name
* @property string $virtual_balance
* @property string|null $iban
* @property bool $active
* @property bool $encrypted
- * @property int $order
+ * @property int $order
* @property-read Collection|AccountMeta[] $accountMeta
* @property-read int|null $account_meta_count
* @property AccountType $accountType
@@ -103,7 +103,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Location $location
* @property string $liability_direction
* @property string $current_debt
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static EloquentBuilder|Account whereUserGroupId($value)
* @property-read UserGroup|null $userGroup
* @mixin Eloquent
@@ -127,7 +127,7 @@ class Account extends Model
protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
- protected $hidden = ['encrypted'];
+ protected $hidden = ['encrypted'];
private bool $joinedAccountTypes = false;
/**
@@ -292,16 +292,15 @@ class Account extends Model
}
/**
- * Get the virtual balance
- *
* @return Attribute
*/
- protected function virtualBalance(): Attribute
+ protected function accountId(): Attribute
{
return Attribute::make(
- get: static fn($value) => (string)$value,
+ get: static fn($value) => (int)$value,
);
}
+
/**
* Get the user ID
*
@@ -317,7 +316,7 @@ class Account extends Model
/**
* @return Attribute
*/
- protected function accountId(): Attribute
+ protected function order(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -325,12 +324,14 @@ class Account extends Model
}
/**
+ * Get the virtual balance
+ *
* @return Attribute
*/
- protected function order(): Attribute
+ protected function virtualBalance(): Attribute
{
return Attribute::make(
- get: static fn($value) => (int)$value,
+ get: static fn($value) => (string)$value,
);
}
diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php
index c4df9fe153..95f309ad8b 100644
--- a/app/Models/AccountMeta.php
+++ b/app/Models/AccountMeta.php
@@ -36,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $account_id
+ * @property int $account_id
* @property string $name
* @property mixed $data
* @property-read Account $account
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index 9472e83238..a22246ebb5 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -45,8 +45,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
- * @property int $attachable_id
+ * @property int $user_id
+ * @property int $attachable_id
* @property string $attachable_type
* @property bool $file_exists
* @property string $md5
@@ -81,7 +81,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|Attachment whereUserId($value)
* @method static Builder|Attachment withTrashed()
* @method static Builder|Attachment withoutTrashed()
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Attachment whereUserGroupId($value)
* @mixin Eloquent
*/
diff --git a/app/Models/AuditLogEntry.php b/app/Models/AuditLogEntry.php
index 2986489b4c..e48d0ecaf6 100644
--- a/app/Models/AuditLogEntry.php
+++ b/app/Models/AuditLogEntry.php
@@ -48,9 +48,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $auditable_id
+ * @property int $auditable_id
* @property string $auditable_type
- * @property int $changer_id
+ * @property int $changer_id
* @property string $changer_type
* @property string $action
* @property array|null $before
diff --git a/app/Models/AutoBudget.php b/app/Models/AutoBudget.php
index e3926eda3b..ed02be17fe 100644
--- a/app/Models/AutoBudget.php
+++ b/app/Models/AutoBudget.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Models;
+use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
@@ -31,7 +32,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
-use Carbon\Carbon;
/**
* FireflyIII\Models\AutoBudget
@@ -40,8 +40,8 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $budget_id
- * @property int $transaction_currency_id
+ * @property int $budget_id
+ * @property int $transaction_currency_id
* @property int|string $auto_budget_type
* @property string $amount
* @property string $period
@@ -96,7 +96,7 @@ class AutoBudget extends Model
protected function amount(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (string)$value,
);
}
diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php
index 6a1552019c..182dd22c3e 100644
--- a/app/Models/AvailableBudget.php
+++ b/app/Models/AvailableBudget.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Models;
+use Carbon\Carbon;
use Eloquent;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
@@ -32,7 +33,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
-use Carbon\Carbon;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -42,8 +42,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
- * @property int $transaction_currency_id
+ * @property int $user_id
+ * @property int $transaction_currency_id
* @property string $amount
* @property Carbon $start_date
* @property Carbon $end_date
@@ -64,7 +64,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget whereUserId($value)
* @method static Builder|AvailableBudget withTrashed()
* @method static Builder|AvailableBudget withoutTrashed()
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget whereUserGroupId($value)
* @mixin Eloquent
*/
@@ -131,9 +131,10 @@ class AvailableBudget extends Model
protected function amount(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (string)$value,
);
}
+
/**
* @return Attribute
*/
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index 043b85b7e0..73bf79a971 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -242,51 +242,51 @@ class Bill extends Model
protected function amountMax(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (string)$value,
);
}
/**
- * Get the skip
+ * Get the min amount
*
* @return Attribute
*/
- protected function skip(): Attribute
+ protected function amountMin(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (int)$value,
+ get: static fn($value) => (string)$value,
);
}
/**
- * Get the min amount
- *
* @return Attribute
*/
- protected function amountMin(): Attribute
+ protected function order(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (int)$value,
);
}
/**
+ * Get the skip
+ *
* @return Attribute
*/
- protected function transactionCurrencyId(): Attribute
+ protected function skip(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (int)$value,
+ get: static fn($value) => (int)$value,
);
}
/**
* @return Attribute
*/
- protected function order(): Attribute
+ protected function transactionCurrencyId(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (int)$value,
+ get: static fn($value) => (int)$value,
);
}
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index 94d092cf25..88168dc69e 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -46,11 +46,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
+ * @property int $user_id
* @property string $name
* @property bool $active
* @property bool $encrypted
- * @property int $order
+ * @property int $order
* @property-read Collection|Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read Collection|AutoBudget[] $autoBudgets
@@ -78,7 +78,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Budget withTrashed()
* @method static Builder|Budget withoutTrashed()
* @property string $email
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Budget whereUserGroupId($value)
* @property-read Collection|Note[] $notes
* @property-read int|null $notes_count
@@ -181,6 +181,7 @@ class Budget extends Model
{
return $this->belongsToMany(Transaction::class, 'budget_transaction', 'budget_id');
}
+
/**
* @return Attribute
*/
diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php
index de8b255d0b..a228f7cd9c 100644
--- a/app/Models/BudgetLimit.php
+++ b/app/Models/BudgetLimit.php
@@ -41,8 +41,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $budget_id
- * @property int $transaction_currency_id
+ * @property int $budget_id
+ * @property int $transaction_currency_id
* @property Carbon $start_date
* @property Carbon|null $end_date
* @property string $amount
@@ -134,7 +134,7 @@ class BudgetLimit extends Model
protected function amount(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (string)$value,
);
}
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 38744525af..76065276e0 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Collection;
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Category
*
@@ -43,7 +44,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
+ * @property int $user_id
* @property string $name
* @property Carbon $lastActivity
* @property bool $encrypted
@@ -69,7 +70,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Category whereUserId($value)
* @method static Builder|Category withTrashed()
* @method static Builder|Category withoutTrashed()
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Category whereUserGroupId($value)
* @mixin Eloquent
*/
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index 1e6adde23c..2613a32a89 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -25,10 +25,11 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Configuration
*
diff --git a/app/Models/CurrencyExchangeRate.php b/app/Models/CurrencyExchangeRate.php
index 132494fd7d..86b317bf97 100644
--- a/app/Models/CurrencyExchangeRate.php
+++ b/app/Models/CurrencyExchangeRate.php
@@ -22,8 +22,10 @@
declare(strict_types=1);
namespace FireflyIII\Models;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
+use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
@@ -31,7 +33,6 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
-use Carbon\Carbon;
/**
* Class CurrencyExchangeRate
@@ -40,9 +41,9 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
- * @property int $user_id
- * @property int $from_currency_id
- * @property int $to_currency_id
+ * @property int $user_id
+ * @property int $from_currency_id
+ * @property int $to_currency_id
* @property Carbon $date
* @property string $rate
* @property string $user_rate
@@ -62,7 +63,7 @@ use Carbon\Carbon;
* @method static Builder|CurrencyExchangeRate whereUpdatedAt($value)
* @method static Builder|CurrencyExchangeRate whereUserId($value)
* @method static Builder|CurrencyExchangeRate whereUserRate($value)
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static Builder|CurrencyExchangeRate whereUserGroupId($value)
* @method static Builder|CurrencyExchangeRate onlyTrashed()
* @method static Builder|CurrencyExchangeRate withTrashed()
@@ -114,27 +115,27 @@ class CurrencyExchangeRate extends Model
/**
* @return Attribute
*/
- protected function rate(): Attribute
+ protected function fromCurrencyId(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (int)$value,
);
}
/**
* @return Attribute
*/
- protected function userRate(): Attribute
+ protected function rate(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (string)$value,
);
}
/**
* @return Attribute
*/
- protected function fromCurrencyId(): Attribute
+ protected function toCurrencyId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -144,10 +145,10 @@ class CurrencyExchangeRate extends Model
/**
* @return Attribute
*/
- protected function toCurrencyId(): Attribute
+ protected function userRate(): Attribute
{
return Attribute::make(
- get: static fn($value) => (int)$value,
+ get: static fn($value) => (string)$value,
);
}
diff --git a/app/Models/GroupMembership.php b/app/Models/GroupMembership.php
index d2e9dd8394..9e1a3852b8 100644
--- a/app/Models/GroupMembership.php
+++ b/app/Models/GroupMembership.php
@@ -26,13 +26,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* Class GroupMembership
*
@@ -40,9 +41,9 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
- * @property int $user_id
- * @property int $user_group_id
- * @property int $user_role_id
+ * @property int $user_id
+ * @property int $user_group_id
+ * @property int $user_role_id
* @property-read User $user
* @property-read UserGroup $userGroup
* @property-read UserRole $userRole
diff --git a/app/Models/InvitedUser.php b/app/Models/InvitedUser.php
index 694bf9d392..e3acc26f8a 100644
--- a/app/Models/InvitedUser.php
+++ b/app/Models/InvitedUser.php
@@ -26,13 +26,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* Class InvitedUser
*
@@ -43,7 +44,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $user_id
+ * @property int $user_id
* @property string $email
* @property string $invite_code
* @property Carbon $expires
diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php
index 25cc93e8d7..3acbfdbf27 100644
--- a/app/Models/LinkType.php
+++ b/app/Models/LinkType.php
@@ -25,13 +25,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\LinkType
*
diff --git a/app/Models/Location.php b/app/Models/Location.php
index 52a4d6c9fd..c67085f2de 100644
--- a/app/Models/Location.php
+++ b/app/Models/Location.php
@@ -26,13 +26,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Location
*
@@ -40,7 +41,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $locatable_id
+ * @property int $locatable_id
* @property string $locatable_type
* @property float|null $latitude
* @property float|null $longitude
diff --git a/app/Models/Note.php b/app/Models/Note.php
index 8e0b5aaaf6..f4ef3f46e8 100644
--- a/app/Models/Note.php
+++ b/app/Models/Note.php
@@ -25,12 +25,13 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Note
*
@@ -38,7 +39,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $noteable_id
+ * @property int $noteable_id
* @property string $noteable_type
* @property string|null $title
* @property string|null $text
diff --git a/app/Models/ObjectGroup.php b/app/Models/ObjectGroup.php
index 0781142153..8d0f610ec8 100644
--- a/app/Models/ObjectGroup.php
+++ b/app/Models/ObjectGroup.php
@@ -26,6 +26,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
@@ -35,17 +36,17 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\ObjectGroup
*
* @property int $id
- * @property int $user_id
+ * @property int $user_id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property string $title
- * @property int $order
+ * @property int $order
* @property-read Collection|Account[] $accounts
* @property-read int|null $accounts_count
* @property-read Collection|Bill[] $bills
@@ -63,7 +64,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static Builder|ObjectGroup whereTitle($value)
* @method static Builder|ObjectGroup whereUpdatedAt($value)
* @method static Builder|ObjectGroup whereUserId($value)
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static Builder|ObjectGroup whereUserGroupId($value)
* @mixin Eloquent
*/
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index cd7e7a7f9f..45e0b24088 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -23,7 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Models;
+use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
@@ -33,9 +35,8 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
-use Carbon\Carbon;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\PiggyBank
*
@@ -43,12 +44,12 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $account_id
+ * @property int $account_id
* @property string $name
* @property string $targetamount
* @property Carbon|null $startdate
* @property Carbon|null $targetdate
- * @property int $order
+ * @property int $order
* @property bool $active
* @property bool $encrypted
* @property-read Account $account
@@ -183,21 +184,19 @@ class PiggyBank extends Model
}
/**
- * Get the max amount
- *
* @return Attribute
*/
- protected function targetamount(): Attribute
+ protected function accountId(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (int)$value,
);
}
/**
* @return Attribute
*/
- protected function accountId(): Attribute
+ protected function order(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -205,12 +204,14 @@ class PiggyBank extends Model
}
/**
+ * Get the max amount
+ *
* @return Attribute
*/
- protected function order(): Attribute
+ protected function targetamount(): Attribute
{
return Attribute::make(
- get: static fn($value) => (int)$value,
+ get: static fn($value) => (string)$value,
);
}
diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php
index 912b11777e..67cfd2fff3 100644
--- a/app/Models/PiggyBankEvent.php
+++ b/app/Models/PiggyBankEvent.php
@@ -23,20 +23,21 @@ declare(strict_types=1);
namespace FireflyIII\Models;
+use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
-use Carbon\Carbon;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\PiggyBankEvent
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $piggy_bank_id
+ * @property int $piggy_bank_id
* @property int|null $transaction_journal_id
* @property Carbon $date
* @property string $amount
@@ -102,7 +103,7 @@ class PiggyBankEvent extends Model
protected function amount(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (string)$value,
);
}
diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php
index b8fec231a4..8e6568f7b5 100644
--- a/app/Models/PiggyBankRepetition.php
+++ b/app/Models/PiggyBankRepetition.php
@@ -25,18 +25,19 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\PiggyBankRepetition
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $piggy_bank_id
+ * @property int $piggy_bank_id
* @property Carbon|null $startdate
* @property Carbon|null $targetdate
* @property string $currentamount
@@ -130,7 +131,7 @@ class PiggyBankRepetition extends Model
protected function currentamount(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (string)$value,
);
}
diff --git a/app/Models/Preference.php b/app/Models/Preference.php
index fb1c31e8b6..f249f4ae1f 100644
--- a/app/Models/Preference.php
+++ b/app/Models/Preference.php
@@ -25,20 +25,21 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Preference
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $user_id
+ * @property int $user_id
* @property string $name
* @property int|string|array|null $data
* @property-read User $user
@@ -94,7 +95,7 @@ class Preference extends Model
$preference = new self();
$preference->name = $value;
$preference->data = $default[$value];
- $preference->user_id = (int) $user->id;
+ $preference->user_id = (int)$user->id;
$preference->save();
return $preference;
diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.php
index f7da8db766..678c9d984b 100644
--- a/app/Models/Recurrence.php
+++ b/app/Models/Recurrence.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Casts\Attribute;
@@ -36,7 +37,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Recurrence
*
@@ -44,8 +45,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
- * @property int $transaction_type_id
+ * @property int $user_id
+ * @property int $transaction_type_id
* @property string $title
* @property string $description
* @property Carbon|null $first_date
@@ -87,7 +88,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Recurrence whereUserId($value)
* @method static Builder|Recurrence withTrashed()
* @method static Builder|Recurrence withoutTrashed()
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Recurrence whereUserGroupId($value)
* @mixin Eloquent
*/
diff --git a/app/Models/RecurrenceMeta.php b/app/Models/RecurrenceMeta.php
index a69bfc7687..7d7f333d97 100644
--- a/app/Models/RecurrenceMeta.php
+++ b/app/Models/RecurrenceMeta.php
@@ -25,12 +25,13 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\RecurrenceMeta
*
@@ -38,7 +39,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $recurrence_id
+ * @property int $recurrence_id
* @property string $name
* @property mixed $value
* @property-read Recurrence $recurrence
diff --git a/app/Models/RecurrenceTransaction.php b/app/Models/RecurrenceTransaction.php
index 9b80e576e3..fce3ad652f 100644
--- a/app/Models/RecurrenceTransaction.php
+++ b/app/Models/RecurrenceTransaction.php
@@ -23,7 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Models;
+use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
@@ -31,8 +33,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
-use Carbon\Carbon;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\RecurrenceTransaction
*
@@ -40,11 +41,11 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $recurrence_id
- * @property int $transaction_currency_id
+ * @property int $recurrence_id
+ * @property int $transaction_currency_id
* @property int|string|null $foreign_currency_id
- * @property int $source_id
- * @property int $destination_id
+ * @property int $source_id
+ * @property int $destination_id
* @property string $amount
* @property string $foreign_amount
* @property string $description
@@ -170,35 +171,35 @@ class RecurrenceTransaction extends Model
protected function amount(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (string)$value,
);
}
/**
* @return Attribute
*/
- protected function foreignAmount(): Attribute
+ protected function destinationId(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (int)$value,
);
-
}
/**
* @return Attribute
*/
- protected function recurrenceId(): Attribute
+ protected function foreignAmount(): Attribute
{
return Attribute::make(
- get: static fn($value) => (int)$value,
+ get: static fn($value) => (string)$value,
);
+
}
/**
* @return Attribute
*/
- protected function transactionCurrencyId(): Attribute
+ protected function recurrenceId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -218,7 +219,7 @@ class RecurrenceTransaction extends Model
/**
* @return Attribute
*/
- protected function destinationId(): Attribute
+ protected function transactionCurrencyId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
diff --git a/app/Models/RecurrenceTransactionMeta.php b/app/Models/RecurrenceTransactionMeta.php
index 9cc8ef3a9c..82c48fb642 100644
--- a/app/Models/RecurrenceTransactionMeta.php
+++ b/app/Models/RecurrenceTransactionMeta.php
@@ -25,12 +25,13 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\RecurrenceTransactionMeta
*
diff --git a/app/Models/Role.php b/app/Models/Role.php
index 03698a3ad8..b417d10001 100644
--- a/app/Models/Role.php
+++ b/app/Models/Role.php
@@ -23,9 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Models;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index d7be370bd1..d3f4aeef49 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Casts\Attribute;
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Rule
*
@@ -43,11 +44,11 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
- * @property int $rule_group_id
+ * @property int $user_id
+ * @property int $rule_group_id
* @property string $title
* @property string|null $description
- * @property int $order
+ * @property int $order
* @property bool $active
* @property bool $stop_processing
* @property bool $strict
@@ -76,7 +77,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Rule whereUserId($value)
* @method static Builder|Rule withTrashed()
* @method static Builder|Rule withoutTrashed()
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Rule whereUserGroupId($value)
* @property-read UserGroup|null $userGroup
* @mixin Eloquent
@@ -178,7 +179,7 @@ class Rule extends Model
/**
* @return Attribute
*/
- protected function ruleGroupId(): Attribute
+ protected function order(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -188,7 +189,7 @@ class Rule extends Model
/**
* @return Attribute
*/
- protected function order(): Attribute
+ protected function ruleGroupId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
diff --git a/app/Models/RuleAction.php b/app/Models/RuleAction.php
index 97ca5ea0d3..217462bfa4 100644
--- a/app/Models/RuleAction.php
+++ b/app/Models/RuleAction.php
@@ -25,21 +25,22 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\RuleAction
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $rule_id
+ * @property int $rule_id
* @property string|null $action_type
* @property string|null $action_value
- * @property int $order
+ * @property int $order
* @property bool $active
* @property bool $stop_processing
* @property-read Rule $rule
@@ -84,7 +85,7 @@ class RuleAction extends Model
/**
* @return Attribute
*/
- protected function ruleId(): Attribute
+ protected function order(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -94,7 +95,7 @@ class RuleAction extends Model
/**
* @return Attribute
*/
- protected function order(): Attribute
+ protected function ruleId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php
index 10e99e8119..6d6fe9026d 100644
--- a/app/Models/RuleGroup.php
+++ b/app/Models/RuleGroup.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Casts\Attribute;
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\RuleGroup
*
@@ -43,10 +44,10 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
+ * @property int $user_id
* @property string|null $title
* @property string|null $description
- * @property int $order
+ * @property int $order
* @property bool $active
* @property bool $stop_processing
* @property Collection|Rule[] $rules
@@ -68,7 +69,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereUserId($value)
* @method static Builder|RuleGroup withTrashed()
* @method static Builder|RuleGroup withoutTrashed()
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereUserGroupId($value)
* @mixin Eloquent
*/
diff --git a/app/Models/RuleTrigger.php b/app/Models/RuleTrigger.php
index 2422a8a270..8194592e41 100644
--- a/app/Models/RuleTrigger.php
+++ b/app/Models/RuleTrigger.php
@@ -25,21 +25,22 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\RuleTrigger
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $rule_id
+ * @property int $rule_id
* @property string|null $trigger_type
* @property string|null $trigger_value
- * @property int $order
+ * @property int $order
* @property bool $active
* @property bool $stop_processing
* @property-read Rule $rule
@@ -84,7 +85,7 @@ class RuleTrigger extends Model
/**
* @return Attribute
*/
- protected function ruleId(): Attribute
+ protected function order(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -94,7 +95,7 @@ class RuleTrigger extends Model
/**
* @return Attribute
*/
- protected function order(): Attribute
+ protected function ruleId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index 2f4c300e28..9b5d35f1d8 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Collection;
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Tag
*
@@ -43,7 +44,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
+ * @property int $user_id
* @property string $tag
* @property string $tagMode
* @property Carbon|null $date
@@ -76,7 +77,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Tag whereZoomLevel($value)
* @method static Builder|Tag withTrashed()
* @method static Builder|Tag withoutTrashed()
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Tag whereUserGroupId($value)
* @mixin Eloquent
*/
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 414ee65541..88f78c51dc 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
@@ -33,7 +34,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Transaction
*
@@ -42,12 +43,12 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property bool $reconciled
- * @property int $account_id
- * @property int $transaction_journal_id
+ * @property int $account_id
+ * @property int $transaction_journal_id
* @property string|null $description
* @property int|null $transaction_currency_id
- * @property string|int|null $modified
- * @property string|int|null $modified_foreign
+ * @property string|int|null $modified
+ * @property string|int|null $modified_foreign
* @property string $date
* @property string $max_date
* @property string $amount
@@ -254,38 +255,39 @@ class Transaction extends Model
}
/**
- * Get the amount
- *
* @return Attribute
*/
- protected function amount(): Attribute
+ protected function accountId(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (int)$value,
);
}
/**
- * Get the foreign amount
+ * Get the amount
*
* @return Attribute
*/
- protected function foreignAmount(): Attribute
+ protected function amount(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (string)$value,
+ get: static fn($value) => (string)$value,
);
}
/**
+ * Get the foreign amount
+ *
* @return Attribute
*/
- protected function accountId(): Attribute
+ protected function foreignAmount(): Attribute
{
return Attribute::make(
- get: static fn($value) => (int)$value,
+ get: static fn($value) => (string)$value,
);
}
+
/**
* @return Attribute
*/
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index ca84cce988..cfbd363700 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -84,7 +84,7 @@ class TransactionCurrency extends Model
public ?bool $userDefault;
public ?bool $userEnabled;
- protected $casts
+ protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php
index 10333f8ac3..5cf4a599f6 100644
--- a/app/Models/TransactionGroup.php
+++ b/app/Models/TransactionGroup.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Collection;
@@ -34,7 +35,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\TransactionGroup
*
@@ -42,7 +43,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
+ * @property int $user_id
* @property string|null $title
* @property-read Collection|TransactionJournal[] $transactionJournals
* @property-read int|null $transaction_journals_count
@@ -59,7 +60,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|TransactionGroup whereUserId($value)
* @method static Builder|TransactionGroup withTrashed()
* @method static Builder|TransactionGroup withoutTrashed()
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|TransactionGroup whereUserGroupId($value)
* @property-read UserGroup|null $userGroup
* @mixin Eloquent
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 54c8851c06..0a85d38b6e 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
@@ -39,7 +40,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\TransactionJournal
*
@@ -47,8 +48,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
- * @property int $transaction_type_id
+ * @property int $user_id
+ * @property int $transaction_type_id
* @property int|string|null $transaction_group_id
* @property int|string|null $bill_id
* @property int|string|null $transaction_currency_id
@@ -117,7 +118,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property-read Collection|Location[] $locations
* @property-read int|null $locations_count
* @property int|string $the_count
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static EloquentBuilder|TransactionJournal whereUserGroupId($value)
* @property-read Collection<int, AuditLogEntry> $auditLogEntries
* @property-read int|null $audit_log_entries_count
@@ -398,16 +399,17 @@ class TransactionJournal extends Model
/**
* @return Attribute
*/
- protected function transactionTypeId(): Attribute
+ protected function order(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
);
}
+
/**
* @return Attribute
*/
- protected function order(): Attribute
+ protected function transactionTypeId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php
index 2c64cbf33d..6f5dfe0f91 100644
--- a/app/Models/TransactionJournalLink.php
+++ b/app/Models/TransactionJournalLink.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
@@ -32,14 +33,14 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\TransactionJournalLink
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $link_type_id
+ * @property int $link_type_id
* @property int $source_id
* @property int $destination_id
* @property string|null $comment
@@ -131,10 +132,11 @@ class TransactionJournalLink extends Model
{
return $this->belongsTo(TransactionJournal::class, 'source_id');
}
+
/**
* @return Attribute
*/
- protected function linkTypeId(): Attribute
+ protected function destinationId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -144,16 +146,17 @@ class TransactionJournalLink extends Model
/**
* @return Attribute
*/
- protected function sourceId(): Attribute
+ protected function linkTypeId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
);
}
+
/**
* @return Attribute
*/
- protected function destinationId(): Attribute
+ protected function sourceId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php
index 5e32f575a5..03b209d2a3 100644
--- a/app/Models/TransactionJournalMeta.php
+++ b/app/Models/TransactionJournalMeta.php
@@ -25,19 +25,20 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\TransactionJournalMeta
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
- * @property int $transaction_journal_id
+ * @property int $transaction_journal_id
* @property string $name
* @property mixed $data
* @property string $hash
@@ -95,7 +96,7 @@ class TransactionJournalMeta extends Model
{
$data = json_encode($value);
$this->attributes['data'] = $data;
- $this->attributes['hash'] = hash('sha256', (string) $data);
+ $this->attributes['hash'] = hash('sha256', (string)$data);
}
/**
@@ -105,6 +106,7 @@ class TransactionJournalMeta extends Model
{
return $this->belongsTo(TransactionJournal::class);
}
+
/**
* @return Attribute
*/
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index 0258506beb..64c9414ef9 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -25,13 +25,14 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\TransactionType
*
diff --git a/app/Models/UserGroup.php b/app/Models/UserGroup.php
index 3d70f959ba..bff29b6ab0 100644
--- a/app/Models/UserGroup.php
+++ b/app/Models/UserGroup.php
@@ -27,6 +27,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\Enums\UserRoleEnum;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* Class UserGroup
*
diff --git a/app/Models/UserRole.php b/app/Models/UserRole.php
index 9054cbbd70..7c902a3c61 100644
--- a/app/Models/UserRole.php
+++ b/app/Models/UserRole.php
@@ -26,11 +26,12 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* Class UserRole
*
diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php
index a8e2e6ba9a..9d060a42cd 100644
--- a/app/Models/Webhook.php
+++ b/app/Models/Webhook.php
@@ -28,6 +28,7 @@ use Eloquent;
use FireflyIII\Enums\WebhookDelivery;
use FireflyIII\Enums\WebhookResponse;
use FireflyIII\Enums\WebhookTrigger;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
@@ -37,7 +38,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\Webhook
*
@@ -45,7 +46,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
- * @property int $user_id
+ * @property int $user_id
* @property bool $active
* @property int $trigger
* @property int $response
@@ -74,7 +75,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property string $secret
* @method static Builder|Webhook whereSecret($value)
* @method static Builder|Webhook whereTitle($value)
- * @property int $user_group_id
+ * @property int $user_group_id
* @method static Builder|Webhook whereUserGroupId($value)
* @mixin Eloquent
*/
diff --git a/app/Models/WebhookAttempt.php b/app/Models/WebhookAttempt.php
index 666ef81f5f..c591bd469e 100644
--- a/app/Models/WebhookAttempt.php
+++ b/app/Models/WebhookAttempt.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
@@ -32,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* Class WebhookAttempt
*
@@ -40,7 +41,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
- * @property int $webhook_message_id
+ * @property int $webhook_message_id
* @property int|string $status_code
* @property string|null $logs
* @property string|null $response
diff --git a/app/Models/WebhookMessage.php b/app/Models/WebhookMessage.php
index 4abf57bf24..20c88b0da1 100644
--- a/app/Models/WebhookMessage.php
+++ b/app/Models/WebhookMessage.php
@@ -23,7 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Models;
+use Carbon\Carbon;
use Eloquent;
+use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
@@ -31,9 +33,8 @@ use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
-use Carbon\Carbon;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
+
/**
* FireflyIII\Models\WebhookMessage
*
@@ -41,7 +42,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
- * @property int $webhook_id
+ * @property int $webhook_id
* @property bool $sent
* @property bool $errored
* @property int $attempts
@@ -127,7 +128,7 @@ class WebhookMessage extends Model
protected function sent(): Attribute
{
return Attribute::make(
- get: static fn ($value) => (bool)$value,
+ get: static fn($value) => (bool)$value,
);
}
diff --git a/app/Notifications/User/NewAccessToken.php b/app/Notifications/User/NewAccessToken.php
index ed0ab00dc0..6ee9e4ce80 100644
--- a/app/Notifications/User/NewAccessToken.php
+++ b/app/Notifications/User/NewAccessToken.php
@@ -43,9 +43,7 @@ class NewAccessToken extends Notification
*
* @return void
*/
- public function __construct()
- {
- }
+ public function __construct() {}
/**
* Get the array representation of the notification.
diff --git a/app/Notifications/User/UserRegistration.php b/app/Notifications/User/UserRegistration.php
index 3654e6fb97..526065bec6 100644
--- a/app/Notifications/User/UserRegistration.php
+++ b/app/Notifications/User/UserRegistration.php
@@ -40,9 +40,7 @@ class UserRegistration extends Notification
*
* @return void
*/
- public function __construct()
- {
- }
+ public function __construct() {}
/**
* Get the array representation of the notification.
diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.php
index a9f799e60d..3f18539064 100644
--- a/app/Providers/AccountServiceProvider.php
+++ b/app/Providers/AccountServiceProvider.php
@@ -42,9 +42,7 @@ class AccountServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/AdminServiceProvider.php b/app/Providers/AdminServiceProvider.php
index d882159e4e..307efca1ff 100644
--- a/app/Providers/AdminServiceProvider.php
+++ b/app/Providers/AdminServiceProvider.php
@@ -36,9 +36,7 @@ class AdminServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/AttachmentServiceProvider.php b/app/Providers/AttachmentServiceProvider.php
index 56d0574b14..6947d5d8a1 100644
--- a/app/Providers/AttachmentServiceProvider.php
+++ b/app/Providers/AttachmentServiceProvider.php
@@ -36,9 +36,7 @@ class AttachmentServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/BillServiceProvider.php b/app/Providers/BillServiceProvider.php
index 2c903fac5a..409b3ba4a7 100644
--- a/app/Providers/BillServiceProvider.php
+++ b/app/Providers/BillServiceProvider.php
@@ -38,9 +38,7 @@ class BillServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/BudgetServiceProvider.php b/app/Providers/BudgetServiceProvider.php
index 6f7b2ab1d0..c48674fd7f 100644
--- a/app/Providers/BudgetServiceProvider.php
+++ b/app/Providers/BudgetServiceProvider.php
@@ -50,9 +50,7 @@ class BudgetServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/CategoryServiceProvider.php b/app/Providers/CategoryServiceProvider.php
index c5c27b54b7..d8bc20a299 100644
--- a/app/Providers/CategoryServiceProvider.php
+++ b/app/Providers/CategoryServiceProvider.php
@@ -40,9 +40,7 @@ class CategoryServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php
index 7fbad5ddb6..6643cfa4c4 100644
--- a/app/Providers/CurrencyServiceProvider.php
+++ b/app/Providers/CurrencyServiceProvider.php
@@ -38,9 +38,7 @@ class CurrencyServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php
index 0dee21d3b6..50235ad37e 100644
--- a/app/Providers/JournalServiceProvider.php
+++ b/app/Providers/JournalServiceProvider.php
@@ -46,9 +46,7 @@ class JournalServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.php
index 0fecc55bd2..309650aaf8 100644
--- a/app/Providers/PiggyBankServiceProvider.php
+++ b/app/Providers/PiggyBankServiceProvider.php
@@ -38,9 +38,7 @@ class PiggyBankServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/RecurringServiceProvider.php b/app/Providers/RecurringServiceProvider.php
index 01c929165d..884dc1f036 100644
--- a/app/Providers/RecurringServiceProvider.php
+++ b/app/Providers/RecurringServiceProvider.php
@@ -36,9 +36,7 @@ class RecurringServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/RuleGroupServiceProvider.php b/app/Providers/RuleGroupServiceProvider.php
index b63226cac3..e43ee595e2 100644
--- a/app/Providers/RuleGroupServiceProvider.php
+++ b/app/Providers/RuleGroupServiceProvider.php
@@ -36,9 +36,7 @@ class RuleGroupServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/RuleServiceProvider.php b/app/Providers/RuleServiceProvider.php
index 47545abdc1..9073b9cc7d 100644
--- a/app/Providers/RuleServiceProvider.php
+++ b/app/Providers/RuleServiceProvider.php
@@ -36,9 +36,7 @@ class RuleServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php
index 6d63d0afe8..0bb2b1056b 100644
--- a/app/Providers/SearchServiceProvider.php
+++ b/app/Providers/SearchServiceProvider.php
@@ -36,9 +36,7 @@ class SearchServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.php
index ecbea3ff80..ae29a28caa 100644
--- a/app/Providers/TagServiceProvider.php
+++ b/app/Providers/TagServiceProvider.php
@@ -38,9 +38,7 @@ class TagServiceProvider extends ServiceProvider
/**
* Bootstrap the application services.
*/
- public function boot(): void
- {
- }
+ public function boot(): void {}
/**
* Register the application services.
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 16130185a2..d41fbe3bc6 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -116,7 +116,7 @@ class AccountRepository implements AccountRepositoryInterface
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('accounts.active', true)
->where(
- static function (EloquentBuilder $q1) use ($number) { /** @phpstan-ignore-line */
+ static function (EloquentBuilder $q1) use ($number) { // @phpstan-ignore-line
$json = json_encode($number);
$q1->where('account_meta.name', '=', 'account_number');
$q1->where('account_meta.data', '=', $json);
@@ -433,7 +433,7 @@ class AccountRepository implements AccountRepositoryInterface
$name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]);
/** @var AccountType $type */
- $type = AccountType::where('type', AccountType::RECONCILIATION)->first();
+ $type = AccountType::where('type', AccountType::RECONCILIATION)->first();
/** @var Account|null $current */
$current = $this->user->accounts()->where('account_type_id', $type->id)
diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php
index 8d9ecba952..3c2b7d8d92 100644
--- a/app/Repositories/Account/AccountRepositoryInterface.php
+++ b/app/Repositories/Account/AccountRepositoryInterface.php
@@ -123,8 +123,8 @@ interface AccountRepositoryInterface
public function getAccountsById(array $accountIds): Collection;
/**
- * @param array<int, int|string> $types
- * @param array|null $sort
+ * @param array<int, int|string> $types
+ * @param array|null $sort
*
* @return Collection
*/
diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php
index e9bf688513..45df92a6cb 100644
--- a/app/Repositories/Account/AccountTasker.php
+++ b/app/Repositories/Account/AccountTasker.php
@@ -174,8 +174,8 @@ class AccountTasker implements AccountTaskerInterface
$sourceId = (int)$journal['destination_account_id'];
$currencyId = (int)$journal['currency_id'];
$key = sprintf('%s-%s', $sourceId, $currencyId);
- $currencies[$currencyId] ??= $currencyRepos->find($currencyId);
- $report['accounts'][$key] ??= [
+ $currencies[$currencyId] ??= $currencyRepos->find($currencyId);
+ $report['accounts'][$key] ??= [
'id' => $sourceId,
'name' => $journal['destination_account_name'],
'sum' => '0',
@@ -200,7 +200,7 @@ class AccountTasker implements AccountTaskerInterface
$report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string)$report['accounts'][$key]['count']);
}
$currencyId = $report['accounts'][$key]['currency_id'];
- $report['sums'][$currencyId] ??= [
+ $report['sums'][$currencyId] ??= [
'sum' => '0',
'currency_id' => $report['accounts'][$key]['currency_id'],
'currency_name' => $report['accounts'][$key]['currency_name'],
@@ -272,7 +272,7 @@ class AccountTasker implements AccountTaskerInterface
$currencyId = (int)$journal['currency_id'];
$key = sprintf('%s-%s', $sourceId, $currencyId);
if (!array_key_exists($key, $report['accounts'])) {
- $currencies[$currencyId] ??= $currencyRepos->find($currencyId);
+ $currencies[$currencyId] ??= $currencyRepos->find($currencyId);
$report['accounts'][$key] = [
'id' => $sourceId,
'name' => $journal['source_account_name'],
@@ -296,7 +296,7 @@ class AccountTasker implements AccountTaskerInterface
$report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string)$report['accounts'][$key]['count']);
}
$currencyId = $report['accounts'][$key]['currency_id'];
- $report['sums'][$currencyId] ??= [
+ $report['sums'][$currencyId] ??= [
'sum' => '0',
'currency_id' => $report['accounts'][$key]['currency_id'],
'currency_name' => $report['accounts'][$key]['currency_name'],
diff --git a/app/Repositories/Account/OperationsRepository.php b/app/Repositories/Account/OperationsRepository.php
index 48234fa576..6fa75b60bc 100644
--- a/app/Repositories/Account/OperationsRepository.php
+++ b/app/Repositories/Account/OperationsRepository.php
@@ -264,7 +264,7 @@ class OperationsRepository implements OperationsRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -272,12 +272,12 @@ class OperationsRepository implements OperationsRepositoryInterface
'currency_code' => $journal['currency_code'],
'currency_decimal_places' => $journal['currency_decimal_places'],
];
- $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->$direction($journal['amount']));/** @phpstan-ignore-line */
+ $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->$direction($journal['amount'])); // @phpstan-ignore-line
// also do foreign amount:
$foreignId = (int)$journal['foreign_currency_id'];
if (0 !== $foreignId) {
- $array[$foreignId] ??= [
+ $array[$foreignId] ??= [
'sum' => '0',
'currency_id' => $foreignId,
'currency_name' => $journal['foreign_currency_name'],
@@ -324,7 +324,7 @@ class OperationsRepository implements OperationsRepositoryInterface
foreach ($journals as $journal) {
$key = sprintf('%s-%s', $journal[$idKey], $journal['currency_id']);
- $array[$key] ??= [
+ $array[$key] ??= [
'id' => $journal[$idKey],
'name' => $journal[$nameKey],
'sum' => '0',
@@ -339,7 +339,7 @@ class OperationsRepository implements OperationsRepositoryInterface
// also do foreign amount:
if (0 !== (int)$journal['foreign_currency_id']) {
$key = sprintf('%s-%s', $journal[$idKey], $journal['foreign_currency_id']);
- $array[$key] ??= [
+ $array[$key] ??= [
'id' => $journal[$idKey],
'name' => $journal[$nameKey],
'sum' => '0',
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index 7cd663ab34..a6b137d86b 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -311,7 +311,7 @@ class BillRepository implements BillRepositoryInterface
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
$currencyId = (int)$journal->transaction_currency_id;
$currency = $journal->transactionCurrency;
- $result[$currencyId] ??= [
+ $result[$currencyId] ??= [
'sum' => '0',
'count' => 0,
'avg' => '0',
@@ -373,12 +373,12 @@ class BillRepository implements BillRepositoryInterface
return $bill->transactionJournals()
->before($end)->after($start)->get(
- [
+ [
'transaction_journals.id',
'transaction_journals.date',
'transaction_journals.transaction_group_id',
]
- );
+ );
}
/**
@@ -416,7 +416,7 @@ class BillRepository implements BillRepositoryInterface
$array = [];
/** @var Rule $rule */
foreach ($rules as $rule) {
- $array[$rule->action_value] ??= [];
+ $array[$rule->action_value] ??= [];
$array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title, 'active' => $rule->active];
}
$return = [];
@@ -456,7 +456,7 @@ class BillRepository implements BillRepositoryInterface
}
$currencyId = (int)$journal->transaction_currency_id;
$currency = $journal->transactionCurrency;
- $result[$currencyId] ??= [
+ $result[$currencyId] ??= [
'sum' => '0',
'count' => 0,
'avg' => '0',
@@ -676,7 +676,7 @@ class BillRepository implements BillRepositoryInterface
if ($total > 0) {
$currency = $bill->transactionCurrency;
$average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2');
- $return[$currency->id] ??= [
+ $return[$currency->id] ??= [
'id' => (string)$currency->id,
'name' => $currency->name,
'symbol' => $currency->symbol,
diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php
index 69f130ad5d..7a4d4e6f10 100644
--- a/app/Repositories/Budget/AvailableBudgetRepository.php
+++ b/app/Repositories/Budget/AvailableBudgetRepository.php
@@ -133,7 +133,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
*/
public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string
{
- $amount = '0';
+ $amount = '0';
/** @var AvailableBudget|null $availableBudget */
$availableBudget = $this->user->availableBudgets()
->where('transaction_currency_id', $currency->id)
diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php
index 0446dff6dc..eed2f8167b 100644
--- a/app/Repositories/Budget/BudgetLimitRepository.php
+++ b/app/Repositories/Budget/BudgetLimitRepository.php
@@ -60,32 +60,32 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
// same complex where query as below.
->where(
- static function (Builder $q5) use ($start, $end) {
- $q5->where(
- static function (Builder $q1) use ($start, $end) {
- $q1->where(
- static function (Builder $q2) use ($start, $end) {
- $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d'));
- $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d'));
- }
- )
- ->orWhere(
- static function (Builder $q3) use ($start, $end) {
- $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d'));
- $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d'));
- }
- );
- }
- )
- ->orWhere(
- static function (Builder $q4) use ($start, $end) {
- // or start is before start AND end is after end.
- $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d'));
- $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d'));
- }
- );
+ static function (Builder $q5) use ($start, $end) {
+ $q5->where(
+ static function (Builder $q1) use ($start, $end) {
+ $q1->where(
+ static function (Builder $q2) use ($start, $end) {
+ $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d'));
+ $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d'));
}
)
+ ->orWhere(
+ static function (Builder $q3) use ($start, $end) {
+ $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d'));
+ $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d'));
+ }
+ );
+ }
+ )
+ ->orWhere(
+ static function (Builder $q4) use ($start, $end) {
+ // or start is before start AND end is after end.
+ $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d'));
+ $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d'));
+ }
+ );
+ }
+ )
->where('budget_limits.transaction_currency_id', $currency->id)
->whereNull('budgets.deleted_at')
->where('budgets.active', true)
@@ -252,11 +252,11 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
)
// budget limit start within period
->orWhere(
- static function (Builder $q3) use ($start, $end) {
- $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d 00:00:00'));
- $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d 23:59:59'));
- }
- );
+ static function (Builder $q3) use ($start, $end) {
+ $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d 00:00:00'));
+ $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d 23:59:59'));
+ }
+ );
}
)
->orWhere(
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index fb2089c696..ceb7a89a71 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -694,7 +694,7 @@ class BudgetRepository implements BudgetRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'id' => (string)$currencyId,
'name' => $journal['currency_name'],
'symbol' => $journal['currency_symbol'],
@@ -707,7 +707,7 @@ class BudgetRepository implements BudgetRepositoryInterface
// also do foreign amount:
$foreignId = (int)$journal['foreign_currency_id'];
if (0 !== $foreignId) {
- $array[$foreignId] ??= [
+ $array[$foreignId] ??= [
'id' => (string)$foreignId,
'name' => $journal['foreign_currency_name'],
'symbol' => $journal['foreign_currency_symbol'],
@@ -757,7 +757,7 @@ class BudgetRepository implements BudgetRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'id' => (string)$currencyId,
'name' => $journal['currency_name'],
'symbol' => $journal['currency_symbol'],
@@ -770,7 +770,7 @@ class BudgetRepository implements BudgetRepositoryInterface
// also do foreign amount:
$foreignId = (int)$journal['foreign_currency_id'];
if (0 !== $foreignId) {
- $array[$foreignId] ??= [
+ $array[$foreignId] ??= [
'id' => (string)$foreignId,
'name' => $journal['foreign_currency_name'],
'symbol' => $journal['foreign_currency_symbol'],
diff --git a/app/Repositories/Budget/NoBudgetRepository.php b/app/Repositories/Budget/NoBudgetRepository.php
index 85e02554cd..69ee28cfc0 100644
--- a/app/Repositories/Budget/NoBudgetRepository.php
+++ b/app/Repositories/Budget/NoBudgetRepository.php
@@ -178,7 +178,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php
index 8f810026e9..893eca39c3 100644
--- a/app/Repositories/Budget/OperationsRepository.php
+++ b/app/Repositories/Budget/OperationsRepository.php
@@ -105,7 +105,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$currencyId = (int)$journal['currency_id'];
$key = sprintf('%d-%d', $budgetId, $currencyId);
- $data[$key] ??= [
+ $data[$key] ??= [
'id' => $budgetId,
'name' => sprintf('%s (%s)', $budgetName, $journal['currency_name']),
'sum' => '0',
@@ -298,7 +298,7 @@ class OperationsRepository implements OperationsRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -311,7 +311,7 @@ class OperationsRepository implements OperationsRepositoryInterface
// also do foreign amount:
$foreignId = (int)$journal['foreign_currency_id'];
if (0 !== $foreignId) {
- $array[$foreignId] ??= [
+ $array[$foreignId] ??= [
'sum' => '0',
'currency_id' => $foreignId,
'currency_name' => $journal['foreign_currency_name'],
diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php
index d3d67b281a..6a05ef73bb 100644
--- a/app/Repositories/Category/CategoryRepository.php
+++ b/app/Repositories/Category/CategoryRepository.php
@@ -306,7 +306,7 @@ class CategoryRepository implements CategoryRepositoryInterface
static function (Attachment $attachment) use ($disk) {
$notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName());
- $attachment->notes_text = null !== $notes ? $notes->text : '';
+ $attachment->notes_text = null !== $notes ? $notes->text : '';
return $attachment;
}
diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php
index 5f1f8c9edb..533b3d93dd 100644
--- a/app/Repositories/Category/NoCategoryRepository.php
+++ b/app/Repositories/Category/NoCategoryRepository.php
@@ -175,7 +175,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -212,7 +212,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -243,7 +243,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
diff --git a/app/Repositories/Category/OperationsRepository.php b/app/Repositories/Category/OperationsRepository.php
index 1dc27f62be..f33dde6db6 100644
--- a/app/Repositories/Category/OperationsRepository.php
+++ b/app/Repositories/Category/OperationsRepository.php
@@ -371,7 +371,7 @@ class OperationsRepository implements OperationsRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
@@ -414,7 +414,7 @@ class OperationsRepository implements OperationsRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
@@ -457,7 +457,7 @@ class OperationsRepository implements OperationsRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php
index b8dc2c2c84..186cc4189b 100644
--- a/app/Repositories/Journal/JournalCLIRepository.php
+++ b/app/Repositories/Journal/JournalCLIRepository.php
@@ -198,9 +198,9 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
*/
public function getSplitJournals(): Collection
{
- $query = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
- ->groupBy('transaction_journals.id');
- $result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); /** @phpstan-ignore-line */
+ $query = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
+ ->groupBy('transaction_journals.id');
+ $result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line
$journalIds = [];
/** @var stdClass $row */
foreach ($result as $row) {
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php
index 8976aa4bc5..0f647ff5db 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepository.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php
@@ -125,7 +125,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
static function (Attachment $attachment) use ($disk) {
$notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName());
- $attachment->notes_text = null !== $notes ? $notes->text : '';
+ $attachment->notes_text = null !== $notes ? $notes->text : '';
return $attachment;
}
diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php
index 052a129688..4a67a0cae5 100644
--- a/app/Repositories/Recurring/RecurringRepository.php
+++ b/app/Repositories/Recurring/RecurringRepository.php
@@ -534,9 +534,9 @@ class RecurringRepository implements RecurringRepositoryInterface
}
if ('yearly' === $repetition->repetition_type) {
//
- $today = today(config('app.timezone'))->endOfYear();
- $repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
- if(false === $repDate) {
+ $today = today(config('app.timezone'))->endOfYear();
+ $repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
+ if (false === $repDate) {
$repDate = clone $today;
}
$diffInYears = $today->diffInYears($repDate);
diff --git a/app/Repositories/Tag/OperationsRepository.php b/app/Repositories/Tag/OperationsRepository.php
index 46a31499ac..f4b66aed92 100644
--- a/app/Repositories/Tag/OperationsRepository.php
+++ b/app/Repositories/Tag/OperationsRepository.php
@@ -196,7 +196,7 @@ class OperationsRepository implements OperationsRepositoryInterface
}
$listedJournals[] = $journalId;
- $array[$currencyId]['tags'][$tagId] ??= [
+ $array[$currencyId]['tags'][$tagId] ??= [
'id' => $tagId,
'name' => $tagName,
'transaction_journals' => [],
diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php
index 27c766fd2b..6b72491531 100644
--- a/app/Repositories/Tag/TagRepository.php
+++ b/app/Repositories/Tag/TagRepository.php
@@ -374,6 +374,26 @@ class TagRepository implements TagRepositoryInterface
return $sums;
}
+ /**
+ * @inheritDoc
+ */
+ public function tagEndsWith(string $query): Collection
+ {
+ $search = sprintf('%%%s', $query);
+
+ return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function tagStartsWith(string $query): Collection
+ {
+ $search = sprintf('%s%%', $query);
+
+ return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
+ }
+
/**
* @param Tag $tag
* @param Carbon $start
@@ -454,24 +474,4 @@ class TagRepository implements TagRepositoryInterface
/** @var Location|null */
return $tag->locations()->first();
}
-
- /**
- * @inheritDoc
- */
- public function tagStartsWith(string $query): Collection
- {
- $search = sprintf('%s%%', $query);
-
- return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
- }
-
- /**
- * @inheritDoc
- */
- public function tagEndsWith(string $query): Collection
- {
- $search = sprintf('%%%s', $query);
-
- return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
- }
}
diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php
index 0bbaaad862..6e667964d8 100644
--- a/app/Repositories/Tag/TagRepositoryInterface.php
+++ b/app/Repositories/Tag/TagRepositoryInterface.php
@@ -153,24 +153,6 @@ interface TagRepositoryInterface
*/
public function searchTag(string $query): Collection;
- /**
- * Find one or more tags that start with the string in the query
- *
- * @param string $query
- *
- * @return Collection
- */
- public function tagStartsWith(string $query): Collection;
-
- /**
- * Find one or more tags that start with the string in the query
- *
- * @param string $query
- *
- * @return Collection
- */
- public function tagEndsWith(string $query): Collection;
-
/**
* Search the users tags.
*
@@ -206,6 +188,24 @@ interface TagRepositoryInterface
*/
public function sumsOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): array;
+ /**
+ * Find one or more tags that start with the string in the query
+ *
+ * @param string $query
+ *
+ * @return Collection
+ */
+ public function tagEndsWith(string $query): Collection;
+
+ /**
+ * Find one or more tags that start with the string in the query
+ *
+ * @param string $query
+ *
+ * @return Collection
+ */
+ public function tagStartsWith(string $query): Collection;
+
/**
* @param Tag $tag
* @param Carbon $start
diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
index f0bbb61ed0..7bd677d8e7 100644
--- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php
+++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
@@ -176,7 +176,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
/** @var Attachment $attachment */
foreach ($set as $attachment) {
$journalId = $attachment->attachable_id;
- $result[$journalId] ??= [];
+ $result[$journalId] ??= [];
$current = $attachment->toArray();
$current['file_exists'] = true;
$current['notes'] = $repository->getNoteText($attachment);
diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php
index a720bf90dc..a12b5da7d1 100644
--- a/app/Repositories/UserGroup/UserGroupRepository.php
+++ b/app/Repositories/UserGroup/UserGroupRepository.php
@@ -130,7 +130,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface
while ($exists && $loop < 10) {
$existingGroup = $this->findByName($groupName);
if (null === $existingGroup) {
- $exists = false;
+ $exists = false;
/** @var UserGroup|null $existingGroup */
$existingGroup = $this->store(['user' => $user, 'title' => $groupName]);
}
diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php
index 287b4a977f..432107147a 100644
--- a/app/Repositories/UserGroups/Account/AccountRepository.php
+++ b/app/Repositories/UserGroups/Account/AccountRepository.php
@@ -40,6 +40,50 @@ class AccountRepository implements AccountRepositoryInterface
{
use UserGroupTrait;
+ /**
+ * @inheritDoc
+ */
+ public function findByAccountNumber(string $number, array $types): ?Account
+ {
+ $dbQuery = $this->userGroup
+ ->accounts()
+ ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
+ ->where('accounts.active', true)
+ ->where(
+ static function (EloquentBuilder $q1) use ($number) { // @phpstan-ignore-line
+ $json = json_encode($number);
+ $q1->where('account_meta.name', '=', 'account_number');
+ $q1->where('account_meta.data', '=', $json);
+ }
+ );
+
+ if (0 !== count($types)) {
+ $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
+ $dbQuery->whereIn('account_types.type', $types);
+ }
+ /** @var Account|null */
+ return $dbQuery->first(['accounts.*']);
+ }
+
+ /**
+ * @param string $iban
+ * @param array $types
+ *
+ * @return Account|null
+ */
+ public function findByIbanNull(string $iban, array $types): ?Account
+ {
+ $query = $this->userGroup->accounts()->where('iban', '!=', '')->whereNotNull('iban');
+
+ if (0 !== count($types)) {
+ $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
+ $query->whereIn('account_types.type', $types);
+ }
+
+ /** @var Account|null */
+ return $query->where('iban', $iban)->first(['accounts.*']);
+ }
+
/**
* @inheritDoc
*/
@@ -66,31 +110,6 @@ class AccountRepository implements AccountRepositoryInterface
return $account;
}
- /**
- * @inheritDoc
- */
- public function findByAccountNumber(string $number, array $types): ?Account
- {
- $dbQuery = $this->userGroup
- ->accounts()
- ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
- ->where('accounts.active', true)
- ->where(
- static function (EloquentBuilder $q1) use ($number) { /** @phpstan-ignore-line */
- $json = json_encode($number);
- $q1->where('account_meta.name', '=', 'account_number');
- $q1->where('account_meta.data', '=', $json);
- }
- );
-
- if (0 !== count($types)) {
- $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
- $dbQuery->whereIn('account_types.type', $types);
- }
- /** @var Account|null */
- return $dbQuery->first(['accounts.*']);
- }
-
/**
* @param Account $account
*
@@ -245,22 +264,4 @@ class AccountRepository implements AccountRepositoryInterface
return $dbQuery->take($limit)->get(['accounts.*']);
}
- /**
- * @param string $iban
- * @param array $types
- *
- * @return Account|null
- */
- public function findByIbanNull(string $iban, array $types): ?Account
- {
- $query = $this->userGroup->accounts()->where('iban', '!=', '')->whereNotNull('iban');
-
- if (0 !== count($types)) {
- $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
- $query->whereIn('account_types.type', $types);
- }
-
- /** @var Account|null */
- return $query->where('iban', $iban)->first(['accounts.*']);
- }
}
diff --git a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php
index 858f82acd7..60d17c1ff3 100644
--- a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php
@@ -37,19 +37,11 @@ use Illuminate\Support\Collection;
interface AccountRepositoryInterface
{
/**
- * @param UserGroup $userGroup
- *
- * @return void
- */
- public function setUserGroup(UserGroup $userGroup): void;
-
- /**
- * @param string $iban
- * @param array $types
+ * @param int $accountId
*
* @return Account|null
*/
- public function findByIbanNull(string $iban, array $types): ?Account;
+ public function find(int $accountId): ?Account;
/**
* @param string $number
@@ -60,18 +52,12 @@ interface AccountRepositoryInterface
public function findByAccountNumber(string $number, array $types): ?Account;
/**
- * @param User $user
- *
- * @return void
- */
- public function setUser(User $user): void;
-
- /**
- * @param int $accountId
+ * @param string $iban
+ * @param array $types
*
* @return Account|null
*/
- public function find(int $accountId): ?Account;
+ public function findByIbanNull(string $iban, array $types): ?Account;
/**
* @param string $name
@@ -129,5 +115,19 @@ interface AccountRepositoryInterface
*/
public function searchAccount(string $query, array $types, int $limit): Collection;
+ /**
+ * @param User $user
+ *
+ * @return void
+ */
+ public function setUser(User $user): void;
+
+ /**
+ * @param UserGroup $userGroup
+ *
+ * @return void
+ */
+ public function setUserGroup(UserGroup $userGroup): void;
+
}
diff --git a/app/Repositories/UserGroups/Bill/BillRepository.php b/app/Repositories/UserGroups/Bill/BillRepository.php
index e911c71009..5fe1f3f012 100644
--- a/app/Repositories/UserGroups/Bill/BillRepository.php
+++ b/app/Repositories/UserGroups/Bill/BillRepository.php
@@ -157,7 +157,7 @@ class BillRepository implements BillRepositoryInterface
$currencyId = $bill->transaction_currency_id;
$average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2');
$nativeAverage = $converter->convert($currency, $default, $start, $average);
- $return[$currencyId] ??= [
+ $return[$currencyId] ??= [
'currency_id' => (string)$currency->id,
'currency_name' => $currency->name,
'currency_symbol' => $currency->symbol,
diff --git a/app/Repositories/UserGroups/Bill/BillRepositoryInterface.php b/app/Repositories/UserGroups/Bill/BillRepositoryInterface.php
index 850aced525..6a5882bdf2 100644
--- a/app/Repositories/UserGroups/Bill/BillRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Bill/BillRepositoryInterface.php
@@ -35,13 +35,6 @@ use Illuminate\Support\Collection;
*/
interface BillRepositoryInterface
{
- /**
- * @param User $user
- *
- * @return void
- */
- public function setUser(User $user): void;
-
/**
* TODO duplicate of other repos
* Add correct order to bills.
@@ -84,6 +77,13 @@ interface BillRepositoryInterface
*/
public function nextDateMatch(Bill $bill, Carbon $date): Carbon;
+ /**
+ * @param User $user
+ *
+ * @return void
+ */
+ public function setUser(User $user): void;
+
/**
* Collect multi-currency of sum of bills already paid.
*
diff --git a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php
index 73862019b9..15d1d908ea 100644
--- a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php
+++ b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php
@@ -54,7 +54,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
/** @var AvailableBudget $availableBudget */
foreach ($availableBudgets as $availableBudget) {
$currencyId = $availableBudget->transaction_currency_id;
- $return[$currencyId] ??= [
+ $return[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_code' => $availableBudget->transactionCurrency->code,
'currency_symbol' => $availableBudget->transactionCurrency->symbol,
diff --git a/app/Repositories/UserGroups/Budget/AvailableBudgetRepositoryInterface.php b/app/Repositories/UserGroups/Budget/AvailableBudgetRepositoryInterface.php
index 9251e44a64..8008460342 100644
--- a/app/Repositories/UserGroups/Budget/AvailableBudgetRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Budget/AvailableBudgetRepositoryInterface.php
@@ -33,12 +33,6 @@ use FireflyIII\User;
*/
interface AvailableBudgetRepositoryInterface
{
- /**
- * @param User $user
- *
- * @return void
- */
- public function setUser(User $user): void;
/**
* @param Carbon $start
* @param Carbon $end
@@ -47,4 +41,11 @@ interface AvailableBudgetRepositoryInterface
*/
public function getAvailableBudgetWithCurrency(Carbon $start, Carbon $end): array;
+ /**
+ * @param User $user
+ *
+ * @return void
+ */
+ public function setUser(User $user): void;
+
}
diff --git a/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php b/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php
index 51a1733743..1230ea6a36 100644
--- a/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php
@@ -34,6 +34,11 @@ use Illuminate\Support\Collection;
*/
interface BudgetRepositoryInterface
{
+ /**
+ * @return Collection
+ */
+ public function getActiveBudgets(): Collection;
+
/**
* @param User $user
*
@@ -47,8 +52,4 @@ interface BudgetRepositoryInterface
* @return void
*/
public function setUserGroup(UserGroup $userGroup): void;
- /**
- * @return Collection
- */
- public function getActiveBudgets(): Collection;
}
diff --git a/app/Repositories/UserGroups/Budget/OperationsRepositoryInterface.php b/app/Repositories/UserGroups/Budget/OperationsRepositoryInterface.php
index 32cd90f0cf..6bc5fa5ade 100644
--- a/app/Repositories/UserGroups/Budget/OperationsRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Budget/OperationsRepositoryInterface.php
@@ -34,13 +34,6 @@ use Illuminate\Support\Collection;
*/
interface OperationsRepositoryInterface
{
- /**
- * @param User $user
- *
- * @return void
- */
- public function setUser(User $user): void;
-
/**
* This method returns a list of all the withdrawal transaction journals (as arrays) set in that period
* which have the specified budget set to them. It's grouped per currency, with as few details in the array
@@ -54,4 +47,11 @@ interface OperationsRepositoryInterface
* @return array
*/
public function listExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null): array;
+
+ /**
+ * @param User $user
+ *
+ * @return void
+ */
+ public function setUser(User $user): void;
}
diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php
index 4896597f0d..a1ca8278c9 100644
--- a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php
@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\UserGroups\Currency;
-use FireflyIII\Api\V1\Controllers\Data\Bulk\TransactionController;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\User;
@@ -33,12 +32,6 @@ use Illuminate\Support\Collection;
interface CurrencyRepositoryInterface
{
- /**
- * @param User $user
- *
- * @return void
- */
- public function setUser(User $user): void;
/**
* @param TransactionCurrency $currency
*
@@ -162,6 +155,13 @@ interface CurrencyRepositoryInterface
*/
public function searchCurrency(string $search, int $limit): Collection;
+ /**
+ * @param User $user
+ *
+ * @return void
+ */
+ public function setUser(User $user): void;
+
/**
* @param array $data
*
diff --git a/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php b/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php
index 9396610b22..5ecc648d1b 100644
--- a/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php
@@ -31,13 +31,6 @@ use Illuminate\Support\Collection;
*/
interface JournalRepositoryInterface
{
- /**
- * @param User $user
- *
- * @return void
- */
- public function setUser(User $user): void;
-
/**
* Search in journal descriptions.
*
@@ -47,4 +40,11 @@ interface JournalRepositoryInterface
* @return Collection
*/
public function searchJournalDescriptions(string $search, int $limit): Collection;
+
+ /**
+ * @param User $user
+ *
+ * @return void
+ */
+ public function setUser(User $user): void;
}
diff --git a/app/Rules/IsDateOrTime.php b/app/Rules/IsDateOrTime.php
index a88d643944..f3e3284efe 100644
--- a/app/Rules/IsDateOrTime.php
+++ b/app/Rules/IsDateOrTime.php
@@ -49,7 +49,6 @@ class IsDateOrTime implements ValidationRule
$value = (string)$value;
if ('' === $value) {
$fail('validation.date_or_time')->translate();
- ;
return;
}
if (10 === strlen($value)) {
@@ -60,13 +59,11 @@ class IsDateOrTime implements ValidationRule
app('log')->error(sprintf('"%s" is not a valid date: %s', $value, $e->getMessage()));
$fail('validation.date_or_time')->translate();
- ;
return;
} catch (InvalidFormatException $e) { // @phpstan-ignore-line
app('log')->error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
$fail('validation.date_or_time')->translate();
- ;
return;
}
@@ -79,13 +76,11 @@ class IsDateOrTime implements ValidationRule
app('log')->error(sprintf('"%s" is not a valid date or time: %s', $value, $e->getMessage()));
$fail('validation.date_or_time')->translate();
- ;
return;
} catch (InvalidFormatException $e) {
app('log')->error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
$fail('validation.date_or_time')->translate();
- ;
return;
}
}
diff --git a/app/Rules/IsValidAttachmentModel.php b/app/Rules/IsValidAttachmentModel.php
index 66044c2fae..f58ec2f95c 100644
--- a/app/Rules/IsValidAttachmentModel.php
+++ b/app/Rules/IsValidAttachmentModel.php
@@ -164,19 +164,6 @@ class IsValidAttachmentModel implements ValidationRule
return null !== $repository->find($value);
}
- /**
- * @param int $value
- *
- * @return bool
- */
- private function validateJournal(int $value): bool
- {
- $repository = app(JournalRepositoryInterface::class);
- $repository->setUser(auth()->user());
-
- return null !== $repository->find($value);
- }
-
/**
* @param int $value
*
@@ -218,4 +205,17 @@ class IsValidAttachmentModel implements ValidationRule
return null !== $repository->findTransaction($value);
}
+
+ /**
+ * @param int $value
+ *
+ * @return bool
+ */
+ private function validateJournal(int $value): bool
+ {
+ $repository = app(JournalRepositoryInterface::class);
+ $repository->setUser(auth()->user());
+
+ return null !== $repository->find($value);
+ }
}
diff --git a/app/Rules/IsValidBulkClause.php b/app/Rules/IsValidBulkClause.php
index cde93c21c9..e5aaf17e8a 100644
--- a/app/Rules/IsValidBulkClause.php
+++ b/app/Rules/IsValidBulkClause.php
@@ -61,7 +61,7 @@ class IsValidBulkClause implements ValidationRule
*
* @return void
*
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php
index 2ce9a4583b..c456ea5ca3 100644
--- a/app/Services/Internal/Support/AccountServiceTrait.php
+++ b/app/Services/Internal/Support/AccountServiceTrait.php
@@ -693,11 +693,11 @@ trait AccountServiceTrait
protected function createOBGroupV2(Account $account, string $openingBalance, Carbon $openingBalanceDate): TransactionGroup
{
app('log')->debug('Now going to create an OB group.');
- $language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
+ $language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
if (is_array($language)) {
$language = 'en_US';
}
- $language= (string)$language;
+ $language = (string)$language;
$sourceId = null;
$sourceName = null;
$destId = null;
diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php
index 3f1be9e18e..49ee1a0e57 100644
--- a/app/Services/Internal/Update/AccountUpdateService.php
+++ b/app/Services/Internal/Update/AccountUpdateService.php
@@ -338,7 +338,7 @@ class AccountUpdateService
return;
}
$array = $preference->data;
- if(!is_array($array)) {
+ if (!is_array($array)) {
$array = [$array];
}
app('log')->debug('Old array is: ', $array);
diff --git a/app/Services/Internal/Update/CategoryUpdateService.php b/app/Services/Internal/Update/CategoryUpdateService.php
index b64cde974a..10ae3ca6f3 100644
--- a/app/Services/Internal/Update/CategoryUpdateService.php
+++ b/app/Services/Internal/Update/CategoryUpdateService.php
@@ -47,7 +47,7 @@ class CategoryUpdateService
{
if (auth()->check()) {
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
$this->user = $user;
}
}
diff --git a/app/Services/Internal/Update/GroupUpdateService.php b/app/Services/Internal/Update/GroupUpdateService.php
index d4546ea22b..7ced30befc 100644
--- a/app/Services/Internal/Update/GroupUpdateService.php
+++ b/app/Services/Internal/Update/GroupUpdateService.php
@@ -135,7 +135,8 @@ class GroupUpdateService
TransactionGroup $transactionGroup,
TransactionJournal $journal,
array $data
- ): void {
+ ): void
+ {
app('log')->debug(sprintf('Now in %s', __METHOD__));
if (0 === count($data)) {
return;
diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php
index b02401cf79..5ab0375721 100644
--- a/app/Services/Internal/Update/JournalUpdateService.php
+++ b/app/Services/Internal/Update/JournalUpdateService.php
@@ -497,9 +497,9 @@ class JournalUpdateService
{
$type = $this->transactionJournal->transactionType->type;
if ((
- array_key_exists('bill_id', $this->data)
+ array_key_exists('bill_id', $this->data)
|| array_key_exists('bill_name', $this->data)
- )
+ )
&& TransactionType::WITHDRAWAL === $type
) {
$billId = (int)($this->data['bill_id'] ?? 0);
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index 1565549ff2..568387c61f 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -77,7 +77,7 @@ class Amount
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $symbol);
$fmt->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, $decimalPlaces);
$fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $decimalPlaces);
- $result = (string) $fmt->format((float)$rounded); // intentional float
+ $result = (string)$fmt->format((float)$rounded); // intentional float
if (true === $coloured) {
if (1 === bccomp($rounded, '0')) {
@@ -123,17 +123,6 @@ class Amount
return $this->getDefaultCurrencyByUserGroup($user->userGroup);
}
- /**
- * @param User $user
- *
- * @return TransactionCurrency
- * @deprecated use getDefaultCurrencyByUserGroup instead.
- */
- public function getDefaultCurrencyByUser(User $user): TransactionCurrency
- {
- return $this->getDefaultCurrencyByUserGroup($user->userGroup);
- }
-
/**
* @param UserGroup $userGroup
*
@@ -166,6 +155,17 @@ class Amount
return TransactionCurrency::where('code', 'EUR')->first();
}
+ /**
+ * @param User $user
+ *
+ * @return TransactionCurrency
+ * @deprecated use getDefaultCurrencyByUserGroup instead.
+ */
+ public function getDefaultCurrencyByUser(User $user): TransactionCurrency
+ {
+ return $this->getDefaultCurrencyByUserGroup($user->userGroup);
+ }
+
/**
* This method returns the correct format rules required by accounting.js,
* the library used to format amounts in charts.
diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php
index f61225d0fd..222d4de291 100644
--- a/app/Support/ExpandedForm.php
+++ b/app/Support/ExpandedForm.php
@@ -49,7 +49,7 @@ class ExpandedForm
*/
public function amountNoCurrency(string $name, $value = null, array $options = null): string
{
- $options ??= [];
+ $options ??= [];
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
@@ -83,8 +83,8 @@ class ExpandedForm
*/
public function checkbox(string $name, int $value = null, $checked = null, array $options = null): string
{
- $options ??= [];
- $value ??= 1;
+ $options ??= [];
+ $value ??= 1;
$options['checked'] = true === $checked;
if (app('session')->has('preFilled')) {
@@ -169,7 +169,7 @@ class ExpandedForm
*/
public function integer(string $name, $value = null, array $options = null): string
{
- $options ??= [];
+ $options ??= [];
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
@@ -226,7 +226,7 @@ class ExpandedForm
/** @var Eloquent $entry */
foreach ($set as $entry) {
// All Eloquent models have an ID
- $entryId = $entry->id; /** @phpstan-ignore-line */
+ $entryId = $entry->id; // @phpstan-ignore-line
$current = $entry->toArray();
$title = null;
foreach ($fields as $field) {
diff --git a/app/Support/Form/AccountForm.php b/app/Support/Form/AccountForm.php
index 4b7882f0ae..52c169f273 100644
--- a/app/Support/Form/AccountForm.php
+++ b/app/Support/Form/AccountForm.php
@@ -132,7 +132,7 @@ class AccountForm
*/
public function assetAccountCheckList(string $name, array $options = null): string
{
- $options ??= [];
+ $options ??= [];
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
diff --git a/app/Support/Form/FormSupport.php b/app/Support/Form/FormSupport.php
index 287e0bb295..7aa8825d3e 100644
--- a/app/Support/Form/FormSupport.php
+++ b/app/Support/Form/FormSupport.php
@@ -44,7 +44,7 @@ trait FormSupport
*/
public function select(string $name, array $list = null, $selected = null, array $options = null): string
{
- $list ??= [];
+ $list ??= [];
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
@@ -86,7 +86,7 @@ trait FormSupport
*/
protected function expandOptionArray(string $name, $label, array $options = null): array
{
- $options ??= [];
+ $options ??= [];
$name = str_replace('[]', '', $name);
$options['class'] = 'form-control';
$options['id'] = 'ffInput_' . $name;
diff --git a/app/Support/Form/PiggyBankForm.php b/app/Support/Form/PiggyBankForm.php
index bb33c9392e..f7b9ab5cea 100644
--- a/app/Support/Form/PiggyBankForm.php
+++ b/app/Support/Form/PiggyBankForm.php
@@ -71,7 +71,7 @@ class PiggyBankForm
$groupTitle = $group->title;
$groupOrder = $group->order;
}
- $subList[$groupOrder] ??= [
+ $subList[$groupOrder] ??= [
'group' => [
'title' => $groupTitle,
],
diff --git a/app/Support/Form/RuleForm.php b/app/Support/Form/RuleForm.php
index f38e7dba63..3353371b43 100644
--- a/app/Support/Form/RuleForm.php
+++ b/app/Support/Form/RuleForm.php
@@ -67,7 +67,7 @@ class RuleForm
*/
public function ruleGroupListWithEmpty(string $name, $value = null, array $options = null): string
{
- $options ??= [];
+ $options ??= [];
$options['class'] = 'form-control';
/** @var RuleGroupRepositoryInterface $groupRepos */
$groupRepos = app(RuleGroupRepositoryInterface::class);
diff --git a/app/Support/Http/Controllers/AugumentData.php b/app/Support/Http/Controllers/AugumentData.php
index 087eab6205..aa5493ef77 100644
--- a/app/Support/Http/Controllers/AugumentData.php
+++ b/app/Support/Http/Controllers/AugumentData.php
@@ -36,7 +36,6 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Support\CacheProperties;
-use FireflyIII\Support\Facades\Amount;
use Illuminate\Support\Collection;
/**
@@ -218,7 +217,7 @@ trait AugumentData
foreach ($set as $entry) {
$currency = $entry->transactionCurrency;
- if(null === $currency) {
+ if (null === $currency) {
$currency = app('amount')->getDefaultCurrency();
}
@@ -226,7 +225,7 @@ trait AugumentData
$currentStart = clone $entry->start_date;
$currentEnd = null === $entry->end_date ? null : clone $entry->end_date;
- if(null === $currentEnd) {
+ if (null === $currentEnd) {
$currentEnd = clone $currentStart;
$currentEnd->addMonth();
}
diff --git a/app/Support/Http/Controllers/CreateStuff.php b/app/Support/Http/Controllers/CreateStuff.php
index 8715acb9b6..14192fbd63 100644
--- a/app/Support/Http/Controllers/CreateStuff.php
+++ b/app/Support/Http/Controllers/CreateStuff.php
@@ -116,7 +116,7 @@ trait CreateStuff
Log::alert('NO OAuth keys were found. They have been created.');
- file_put_contents($publicKey, (string) $key->getPublicKey());
+ file_put_contents($publicKey, (string)$key->getPublicKey());
file_put_contents($privateKey, $key->toString('PKCS1'));
}
diff --git a/app/Support/Http/Controllers/ModelInformation.php b/app/Support/Http/Controllers/ModelInformation.php
index 2dd716f5bd..0491a8c741 100644
--- a/app/Support/Http/Controllers/ModelInformation.php
+++ b/app/Support/Http/Controllers/ModelInformation.php
@@ -80,9 +80,9 @@ trait ModelInformation
$repository = app(AccountRepositoryInterface::class);
// types of liability:
/** @var AccountType $debt */
- $debt = $repository->getAccountTypeByType(AccountType::DEBT);
+ $debt = $repository->getAccountTypeByType(AccountType::DEBT);
/** @var AccountType $loan */
- $loan = $repository->getAccountTypeByType(AccountType::LOAN);
+ $loan = $repository->getAccountTypeByType(AccountType::LOAN);
/** @var AccountType $mortgage */
$mortgage = $repository->getAccountTypeByType(AccountType::MORTGAGE);
$liabilityTypes = [
@@ -260,7 +260,7 @@ trait ModelInformation
'count' => $ii + 1,
'triggers' => $triggers,
];
- $string = view('rules.partials.trigger', $renderInfo)->render();
+ $string = view('rules.partials.trigger', $renderInfo)->render();
} catch (Throwable $e) {
app('log')->debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
app('log')->debug($e->getTraceAsString());
diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php
index 13e3518d20..38820f78fc 100644
--- a/app/Support/Http/Controllers/RenderPartialViews.php
+++ b/app/Support/Http/Controllers/RenderPartialViews.php
@@ -64,7 +64,7 @@ trait RenderPartialViews
$accountRepos = app(AccountRepositoryInterface::class);
$account = $accountRepos->find((int)$attributes['accountId']);
- if(null === $budget || null === $account) {
+ if (null === $budget || null === $account) {
throw new FireflyException('Could not render popup.report.balance-amount because budget or account is null.');
}
@@ -334,7 +334,7 @@ trait RenderPartialViews
if ('user_action' !== $entry->trigger_type) {
$count = ($index + 1);
try {
- $rootOperator = OperatorQuerySearch::getRootOperator((string) $entry->trigger_type);
+ $rootOperator = OperatorQuerySearch::getRootOperator((string)$entry->trigger_type);
if (str_starts_with($rootOperator, '-')) {
$rootOperator = substr($rootOperator, 1);
}
@@ -344,7 +344,7 @@ trait RenderPartialViews
'oldTrigger' => $rootOperator,
'oldValue' => $entry->trigger_value,
'oldChecked' => $entry->stop_processing,
- 'oldProhibited' => str_starts_with((string) $entry->trigger_type, '-'),
+ 'oldProhibited' => str_starts_with((string)$entry->trigger_type, '-'),
'count' => $count,
'triggers' => $triggers,
]
diff --git a/app/Support/Http/Controllers/RuleManagement.php b/app/Support/Http/Controllers/RuleManagement.php
index 32addd2f29..5d06fd0fd1 100644
--- a/app/Support/Http/Controllers/RuleManagement.php
+++ b/app/Support/Http/Controllers/RuleManagement.php
@@ -139,7 +139,7 @@ trait RuleManagement
$index = 0;
foreach ($submittedOperators as $operator) {
$rootOperator = OperatorQuerySearch::getRootOperator($operator['type']);
- $needsContext = (bool) config(sprintf('search.operators.%s.needs_context', $rootOperator));
+ $needsContext = (bool)config(sprintf('search.operators.%s.needs_context', $rootOperator));
try {
$renderedEntries[] = view(
'rules.partials.trigger',
diff --git a/app/Support/Models/ReturnsIntegerIdTrait.php b/app/Support/Models/ReturnsIntegerIdTrait.php
index 0b78b80da6..d84925c07f 100644
--- a/app/Support/Models/ReturnsIntegerIdTrait.php
+++ b/app/Support/Models/ReturnsIntegerIdTrait.php
@@ -26,13 +26,14 @@ namespace FireflyIII\Support\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
/**
-* Trait ReturnsIntegerIdTrait
+ * Trait ReturnsIntegerIdTrait
*/
trait ReturnsIntegerIdTrait
{
/**
* Get the ID
* @SuppressWarnings(PHPMD.ShortMethodName)
+ *
* @return Attribute
*/
protected function id(): Attribute
diff --git a/app/Support/Models/ReturnsIntegerUserIdTrait.php b/app/Support/Models/ReturnsIntegerUserIdTrait.php
index 0bc40fe293..08e4d30484 100644
--- a/app/Support/Models/ReturnsIntegerUserIdTrait.php
+++ b/app/Support/Models/ReturnsIntegerUserIdTrait.php
@@ -26,14 +26,16 @@ namespace FireflyIII\Support\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
/**
-* Trait ReturnsIntegerUserIdTrait
+ * Trait ReturnsIntegerUserIdTrait
*/
trait ReturnsIntegerUserIdTrait
{
/**
+ * Get the user group ID
+ *
* @return Attribute
*/
- protected function userId(): Attribute
+ protected function userGroupId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
@@ -41,11 +43,9 @@ trait ReturnsIntegerUserIdTrait
}
/**
- * Get the user group ID
- *
* @return Attribute
*/
- protected function userGroupId(): Attribute
+ protected function userId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index 712deef93d..aed2c5e088 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -89,10 +89,10 @@ class Navigation
if (!array_key_exists($repeatFreq, $functionMap)) {
Log::error(sprintf(
- 'The periodicity %s is unknown. Choose one of available periodicity: %s',
- $repeatFreq,
- implode(', ', array_keys($functionMap))
- ));
+ 'The periodicity %s is unknown. Choose one of available periodicity: %s',
+ $repeatFreq,
+ implode(', ', array_keys($functionMap))
+ ));
return $theDate;
}
@@ -352,12 +352,12 @@ class Navigation
public function diffInPeriods(string $period, int $skip, Carbon $beginning, Carbon $end): int
{
Log::debug(sprintf(
- 'diffInPeriods: %s (skip: %d), between %s and %s.',
- $period,
- $skip,
- $beginning->format('Y-m-d'),
- $end->format('Y-m-d')
- ));
+ 'diffInPeriods: %s (skip: %d), between %s and %s.',
+ $period,
+ $skip,
+ $beginning->format('Y-m-d'),
+ $end->format('Y-m-d')
+ ));
$map = [
'daily' => 'floatDiffInDays',
'weekly' => 'floatDiffInWeeks',
@@ -394,11 +394,11 @@ class Navigation
$parameter = $skip + 1;
$diff = ceil($diff / $parameter) * $parameter;
Log::debug(sprintf(
- 'diffInPeriods: skip is %d, so param is %d, and diff becomes %d',
- $skip,
- $parameter,
- $diff
- ));
+ 'diffInPeriods: skip is %d, so param is %d, and diff becomes %d',
+ $skip,
+ $parameter,
+ $diff
+ ));
}
return (int)$diff;
diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php
index 5e32150ac5..2cc76ef3bf 100644
--- a/app/Support/Preferences.php
+++ b/app/Support/Preferences.php
@@ -76,14 +76,14 @@ class Preferences
}
/**
- * @param User $user
- * @param string $name
+ * @param User $user
+ * @param string $name
* @param null|string|int|bool|array $default
*
* @return Preference|null
* @throws FireflyException
*/
- public function getForUser(User $user, string $name, string|int|bool|null|array $default = null): ?Preference
+ public function getForUser(User $user, string $name, string | int | bool | null | array $default = null): ?Preference
{
if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
@@ -168,7 +168,7 @@ class Preferences
}
if (null === $pref) {
$pref = new Preference();
- $pref->user_id = (int) $user->id;
+ $pref->user_id = (int)$user->id;
$pref->name = $name;
}
$pref->data = $value;
@@ -286,7 +286,7 @@ class Preferences
$lastActivity = implode(',', $lastActivity);
}
- return hash('sha256', (string) $lastActivity);
+ return hash('sha256', (string)$lastActivity);
}
/**
diff --git a/app/Support/Report/Budget/BudgetReportGenerator.php b/app/Support/Report/Budget/BudgetReportGenerator.php
index 3f18e5aaee..3ffc6ee0c3 100644
--- a/app/Support/Report/Budget/BudgetReportGenerator.php
+++ b/app/Support/Report/Budget/BudgetReportGenerator.php
@@ -285,8 +285,8 @@ class BudgetReportGenerator
// append other sums because they might be missing:
$this->report['sums'][$nbCurrencyId]['overspent'] ??= '0';
- $this->report['sums'][$nbCurrencyId]['left'] ??= '0';
- $this->report['sums'][$nbCurrencyId]['budgeted'] ??= '0';
+ $this->report['sums'][$nbCurrencyId]['left'] ??= '0';
+ $this->report['sums'][$nbCurrencyId]['budgeted'] ??= '0';
}
}
@@ -314,7 +314,7 @@ class BudgetReportGenerator
if (0 !== bccomp($budgeted, '0') && 0 !== bccomp($totalBudgeted, '0')) {
$budgetedPct = round((float)bcmul(bcdiv($budgeted, $totalBudgeted), '100'));
}
- $this->report['sums'][$currencyId]['budgeted'] ??= '0';
+ $this->report['sums'][$currencyId]['budgeted'] ??= '0';
$this->report['budgets'][$budgetId]['budget_limits'][$limitId]['spent_pct'] = $spentPct;
$this->report['budgets'][$budgetId]['budget_limits'][$limitId]['budgeted_pct'] = $budgetedPct;
}
diff --git a/app/Support/Repositories/UserGroup/UserGroupTrait.php b/app/Support/Repositories/UserGroup/UserGroupTrait.php
index 9c659a6a3e..30ca44bb27 100644
--- a/app/Support/Repositories/UserGroup/UserGroupTrait.php
+++ b/app/Support/Repositories/UserGroup/UserGroupTrait.php
@@ -68,8 +68,8 @@ trait UserGroupTrait
public function setUser(Authenticatable | User | null $user): void
{
if ($user instanceof User) {
- $this->user = $user;
- if(null === $user->userGroup) {
+ $this->user = $user;
+ if (null === $user->userGroup) {
throw new FireflyException(sprintf('User #%d has no user group.', $user->id));
}
$this->userGroup = $user->userGroup;
diff --git a/app/Support/Request/AppendsLocationData.php b/app/Support/Request/AppendsLocationData.php
index f4a48fc1b8..b6e21bf76f 100644
--- a/app/Support/Request/AppendsLocationData.php
+++ b/app/Support/Request/AppendsLocationData.php
@@ -239,9 +239,9 @@ trait AppendsLocationData
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
return (
- null === $this->get($longitudeKey)
- && null === $this->get($latitudeKey)
- && null === $this->get($zoomLevelKey))
+ null === $this->get($longitudeKey)
+ && null === $this->get($latitudeKey)
+ && null === $this->get($zoomLevelKey))
&& (
'PUT' === $this->method()
|| ('POST' === $this->method() && $this->routeIs('*.update'))
diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php
index c230c323df..59765c94c4 100644
--- a/app/Support/Request/ConvertsDataTypes.php
+++ b/app/Support/Request/ConvertsDataTypes.php
@@ -181,7 +181,7 @@ trait ConvertsDataTypes
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
- if (method_exists($this, 'validateUserGroup')) { /** @phpstan-ignore-line */
+ if (method_exists($this, 'validateUserGroup')) { // @phpstan-ignore-line
$userGroup = $this->validateUserGroup($this);
if (null !== $userGroup) {
$repository->setUserGroup($userGroup);
diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php
index d74d9b3ca1..2f2c838d27 100644
--- a/app/Support/Search/AccountSearch.php
+++ b/app/Support/Search/AccountSearch.php
@@ -77,7 +77,7 @@ class AccountSearch implements GenericSearchInterface
);
// meta data:
$searchQuery->orWhere(
- static function (Builder $q) use ($originalQuery) { /** @phpstan-ignore-line */
+ static function (Builder $q) use ($originalQuery) { // @phpstan-ignore-line
$json = json_encode($originalQuery, JSON_THROW_ON_ERROR);
$q->where('account_meta.name', '=', 'account_number');
$q->where('account_meta.data', 'LIKE', $json);
@@ -96,7 +96,7 @@ class AccountSearch implements GenericSearchInterface
case self::SEARCH_NUMBER:
// meta data:
$searchQuery->Where(
- static function (Builder $q) use ($originalQuery) { /** @phpstan-ignore-line */
+ static function (Builder $q) use ($originalQuery) { // @phpstan-ignore-line
$json = json_encode($originalQuery, JSON_THROW_ON_ERROR);
$q->where('account_meta.name', 'account_number');
$q->where('account_meta.data', $json);
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index 899e06690a..083c0e3d83 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -57,6 +57,8 @@ use Gdbots\QueryParser\QueryParser;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use LogicException;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
use TypeError;
/**
@@ -71,6 +73,8 @@ class OperatorQuerySearch implements SearchInterface
private CategoryRepositoryInterface $categoryRepository;
private GroupCollectorInterface $collector;
private CurrencyRepositoryInterface $currencyRepository;
+ private array $excludeTags;
+ private array $includeTags;
private array $invalidOperators;
private int $limit;
private Collection $operators;
@@ -81,9 +85,6 @@ class OperatorQuerySearch implements SearchInterface
private array $validOperators;
private array $words;
- private array $excludeTags;
- private array $includeTags;
-
/**
* OperatorQuerySearch constructor.
*
@@ -2165,6 +2166,44 @@ class OperatorQuerySearch implements SearchInterface
}
}
+ /**
+ * @return void
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
+ */
+ private function parseTagInstructions(): void
+ {
+ app('log')->debug('Now in parseTagInstructions()');
+ // if exclude tags, remove excluded tags.
+ if (count($this->excludeTags) > 0) {
+ app('log')->debug(sprintf('%d exclude tag(s)', count($this->excludeTags)));
+ $collection = new Collection;
+ foreach ($this->excludeTags as $tagId) {
+ $tag = $this->tagRepository->find($tagId);
+ if (null !== $tag) {
+ app('log')->debug(sprintf('Exclude tag "%s"', $tag->tag));
+ $collection->push($tag);
+ }
+ }
+ app('log')->debug(sprintf('Selecting all tags except %d excluded tag(s).', $collection->count()));
+ $this->collector->setWithoutSpecificTags($collection);
+ }
+ // if include tags, include them:
+ if (count($this->includeTags) > 0) {
+ app('log')->debug(sprintf('%d include tag(s)', count($this->includeTags)));
+ $collection = new Collection;
+ foreach ($this->includeTags as $tagId) {
+ $tag = $this->tagRepository->find($tagId);
+ if (null !== $tag) {
+ app('log')->debug(sprintf('Include tag "%s"', $tag->tag));
+ $collection->push($tag);
+ }
+ }
+ $this->collector->setTags($collection);
+ }
+
+ }
+
/**
* @inheritDoc
*/
@@ -2235,42 +2274,4 @@ class OperatorQuerySearch implements SearchInterface
$this->limit = $limit;
$this->collector->setLimit($this->limit);
}
-
- /**
- * @return void
- * @throws \Psr\Container\ContainerExceptionInterface
- * @throws \Psr\Container\NotFoundExceptionInterface
- */
- private function parseTagInstructions(): void
- {
- app('log')->debug('Now in parseTagInstructions()');
- // if exclude tags, remove excluded tags.
- if (count($this->excludeTags) > 0) {
- app('log')->debug(sprintf('%d exclude tag(s)', count($this->excludeTags)));
- $collection = new Collection;
- foreach ($this->excludeTags as $tagId) {
- $tag = $this->tagRepository->find($tagId);
- if (null !== $tag) {
- app('log')->debug(sprintf('Exclude tag "%s"', $tag->tag));
- $collection->push($tag);
- }
- }
- app('log')->debug(sprintf('Selecting all tags except %d excluded tag(s).', $collection->count()));
- $this->collector->setWithoutSpecificTags($collection);
- }
- // if include tags, include them:
- if (count($this->includeTags) > 0) {
- app('log')->debug(sprintf('%d include tag(s)', count($this->includeTags)));
- $collection = new Collection;
- foreach ($this->includeTags as $tagId) {
- $tag = $this->tagRepository->find($tagId);
- if (null !== $tag) {
- app('log')->debug(sprintf('Include tag "%s"', $tag->tag));
- $collection->push($tag);
- }
- }
- $this->collector->setTags($collection);
- }
-
- }
}
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index f434258188..f8baace830 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -153,11 +153,11 @@ class Steam
->whereNull('transaction_journals.deleted_at')
->get(
[ // @phpstan-ignore-line
- 'transaction_journals.date',
- 'transactions.transaction_currency_id',
- DB::raw('SUM(transactions.amount) AS modified'),
- 'transactions.foreign_currency_id',
- DB::raw('SUM(transactions.foreign_amount) AS modified_foreign'),
+ 'transaction_journals.date',
+ 'transactions.transaction_currency_id',
+ DB::raw('SUM(transactions.amount) AS modified'),
+ 'transactions.foreign_currency_id',
+ DB::raw('SUM(transactions.foreign_amount) AS modified_foreign'),
]
);
@@ -326,15 +326,15 @@ class Steam
$balances[$format] = $currentBalance;
app('log')->debug(sprintf(
- '%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s',
- $format,
- $currency->code,
- $rate,
- $currency->code,
- $transaction['amount'],
- $native->code,
- $convertedAmount
- ));
+ '%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s',
+ $format,
+ $currency->code,
+ $rate,
+ $currency->code,
+ $transaction['amount'],
+ $native->code,
+ $convertedAmount
+ ));
}
@@ -451,8 +451,8 @@ class Steam
$converter = new ExchangeRateConverter();
foreach ($new as $set) {
foreach ($set as $transaction) {
- $date = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date']);
- if(false === $date) {
+ $date = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date']);
+ if (false === $date) {
$date = today(config('app.timezone'));
}
$rate = $converter->getCurrencyRate($currency, $native, $date);
@@ -604,8 +604,8 @@ class Steam
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
->groupBy('transactions.transaction_currency_id');
- $balances = $query->get(['transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) as sum_for_currency')]); /** @phpstan-ignore-line */
- $return = [];
+ $balances = $query->get(['transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) as sum_for_currency')]); // @phpstan-ignore-line
+ $return = [];
/** @var stdClass $entry */
foreach ($balances as $entry) {
$return[(int)$entry->transaction_currency_id] = (string)$entry->sum_for_currency;
@@ -890,10 +890,10 @@ class Steam
return $value;
}
- $number = substr($value, 0, (int) strpos($value, 'E'));
+ $number = substr($value, 0, (int)strpos($value, 'E'));
if (str_contains($number, '.')) {
- $post = strlen(substr($number, (int) strpos($number, '.') + 1));
- $mantis = substr($value, (int) strpos($value, 'E') + 1);
+ $post = strlen(substr($number, (int)strpos($number, '.') + 1));
+ $mantis = substr($value, (int)strpos($value, 'E') + 1);
if ($mantis < 0) {
$post += abs((int)$mantis);
}
diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php
index d49485f8b5..3b150652c4 100644
--- a/app/Support/Twig/AmountFormat.php
+++ b/app/Support/Twig/AmountFormat.php
@@ -122,8 +122,8 @@ class AmountFormat extends AbstractExtension
return new TwigFunction(
'formatAmountBySymbol',
static function (string $amount, string $symbol, int $decimalPlaces = null, bool $coloured = null): string {
- $decimalPlaces ??= 2;
- $coloured ??= true;
+ $decimalPlaces ??= 2;
+ $coloured ??= true;
$currency = new TransactionCurrency();
$currency->symbol = $symbol;
$currency->decimal_places = $decimalPlaces;
diff --git a/app/TransactionRules/Actions/AppendDescriptionToNotes.php b/app/TransactionRules/Actions/AppendDescriptionToNotes.php
index 1b16a24ae9..037aeacd27 100644
--- a/app/TransactionRules/Actions/AppendDescriptionToNotes.php
+++ b/app/TransactionRules/Actions/AppendDescriptionToNotes.php
@@ -56,7 +56,7 @@ class AppendDescriptionToNotes implements ActionInterface
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
app('log')->error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
- event(new RuleActionFailedOnArray($this->action, $journal, (string) trans('rules.journal_other_user')));
+ event(new RuleActionFailedOnArray($this->action, $journal, (string)trans('rules.journal_other_user')));
return false;
}
$note = $object->notes()->first();
diff --git a/app/TransactionRules/Actions/ClearNotes.php b/app/TransactionRules/Actions/ClearNotes.php
index 0be3b9cae9..3215f776df 100644
--- a/app/TransactionRules/Actions/ClearNotes.php
+++ b/app/TransactionRules/Actions/ClearNotes.php
@@ -28,7 +28,6 @@ use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
use FireflyIII\Events\TriggeredAuditLog;
use FireflyIII\Models\Note;
use FireflyIII\Models\RuleAction;
-use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
/**
@@ -56,7 +55,7 @@ class ClearNotes implements ActionInterface
/** @var TransactionJournal $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
/** @var Note|null $notes */
- $notes = $object->notes()->first();
+ $notes = $object->notes()->first();
if (null === $notes) {
app('log')->debug(sprintf('RuleAction ClearNotes, journal #%d has no notes.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_already_no_notes')));
diff --git a/app/TransactionRules/Actions/SetDestinationToCashAccount.php b/app/TransactionRules/Actions/SetDestinationToCashAccount.php
index af12a4241c..549420e08b 100644
--- a/app/TransactionRules/Actions/SetDestinationToCashAccount.php
+++ b/app/TransactionRules/Actions/SetDestinationToCashAccount.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\TransactionRules\Actions;
+use DB;
use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
use FireflyIII\Events\TriggeredAuditLog;
use FireflyIII\Models\RuleAction;
@@ -31,7 +32,6 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\User;
-use DB;
/**
* Class SetDestinationToCashAccount
diff --git a/app/TransactionRules/Actions/SetSourceToCashAccount.php b/app/TransactionRules/Actions/SetSourceToCashAccount.php
index 1cc1a16085..11339594fb 100644
--- a/app/TransactionRules/Actions/SetSourceToCashAccount.php
+++ b/app/TransactionRules/Actions/SetSourceToCashAccount.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\TransactionRules\Actions;
+use DB;
use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
use FireflyIII\Events\TriggeredAuditLog;
use FireflyIII\Models\RuleAction;
@@ -31,14 +32,13 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\User;
-use DB;
/**
-* Class SetSourceToCashAccount
+ * Class SetSourceToCashAccount
*/
class SetSourceToCashAccount implements ActionInterface
{
- private RuleAction $action;
+ private RuleAction $action;
/**
* TriggerInterface constructor.
@@ -49,6 +49,7 @@ class SetSourceToCashAccount implements ActionInterface
{
$this->action = $action;
}
+
/**
* @inheritDoc
*/
@@ -66,7 +67,7 @@ class SetSourceToCashAccount implements ActionInterface
return false;
}
$type = $object->transactionType->type;
- if(TransactionType::DEPOSIT !== $type) {
+ if (TransactionType::DEPOSIT !== $type) {
app('log')->error('Transaction must be deposit.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.not_deposit')));
return false;
diff --git a/app/TransactionRules/Actions/UpdatePiggybank.php b/app/TransactionRules/Actions/UpdatePiggybank.php
index 862d433338..62fceba69b 100644
--- a/app/TransactionRules/Actions/UpdatePiggybank.php
+++ b/app/TransactionRules/Actions/UpdatePiggybank.php
@@ -30,7 +30,6 @@ use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
-use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\User;
diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php
index 898167fae6..ff720b8068 100644
--- a/app/TransactionRules/Engine/SearchRuleEngine.php
+++ b/app/TransactionRules/Engine/SearchRuleEngine.php
@@ -115,7 +115,7 @@ class SearchRuleEngine implements RuleEngineInterface
}
// if needs no context, value is different:
- $needsContext = (bool) (config(sprintf('search.operators.%s.needs_context', $ruleTrigger->trigger_type)) ?? true);
+ $needsContext = (bool)(config(sprintf('search.operators.%s.needs_context', $ruleTrigger->trigger_type)) ?? true);
if (false === $needsContext) {
app('log')->debug(sprintf('SearchRuleEngine:: add a rule trigger (no context): %s:true', $ruleTrigger->trigger_type));
$searchArray[$ruleTrigger->trigger_type][] = 'true';
diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.php
index 34d33f4097..4ba151783e 100644
--- a/app/Transformers/BillTransformer.php
+++ b/app/Transformers/BillTransformer.php
@@ -37,8 +37,8 @@ use Illuminate\Support\Collection;
*/
class BillTransformer extends AbstractTransformer
{
- private BillRepositoryInterface $repository;
private BillDateCalculator $calculator;
+ private BillRepositoryInterface $repository;
/**
* BillTransformer constructor.
diff --git a/app/Transformers/RecurrenceTransformer.php b/app/Transformers/RecurrenceTransformer.php
index 5aaf7b8164..1cbedd0c18 100644
--- a/app/Transformers/RecurrenceTransformer.php
+++ b/app/Transformers/RecurrenceTransformer.php
@@ -163,7 +163,7 @@ class RecurrenceTransformer extends AbstractTransformer
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions()->get() as $transaction) {
/** @var Account|null $sourceAccount */
- $sourceAccount = $transaction->sourceAccount;
+ $sourceAccount = $transaction->sourceAccount;
/** @var Account|null $destinationAccount */
$destinationAccount = $transaction->destinationAccount;
$foreignCurrencyCode = null;
diff --git a/app/Transformers/V2/CurrencyTransformer.php b/app/Transformers/V2/CurrencyTransformer.php
index 446d4083fa..108a758b5f 100644
--- a/app/Transformers/V2/CurrencyTransformer.php
+++ b/app/Transformers/V2/CurrencyTransformer.php
@@ -34,9 +34,7 @@ class CurrencyTransformer extends AbstractTransformer
/**
* @inheritDoc
*/
- public function collectMetaData(Collection $objects): void
- {
- }
+ public function collectMetaData(Collection $objects): void {}
/**
* Transform the currency.
diff --git a/app/Transformers/V2/PiggyBankTransformer.php b/app/Transformers/V2/PiggyBankTransformer.php
index 920c4c9816..e00d3ce6ea 100644
--- a/app/Transformers/V2/PiggyBankTransformer.php
+++ b/app/Transformers/V2/PiggyBankTransformer.php
@@ -80,7 +80,7 @@ class PiggyBankTransformer extends AbstractTransformer
$piggyBanks = $objects->pluck('id')->toArray();
$accountInfo = Account::whereIn('id', $objects->pluck('account_id')->toArray())->get();
$currencyPreferences = AccountMeta::where('name', '"currency_id"')->whereIn('account_id', $objects->pluck('account_id')->toArray())->get();
- $currencies = [];
+ $currencies = [];
/** @var Account $account */
foreach ($accountInfo as $account) {
$id = $account->id;
@@ -92,7 +92,7 @@ class PiggyBankTransformer extends AbstractTransformer
foreach ($currencyPreferences as $preference) {
$currencyId = (int)$preference->data;
$accountId = $preference->account_id;
- $currencies[$currencyId] ??= TransactionJournal::find($currencyId);
+ $currencies[$currencyId] ??= TransactionJournal::find($currencyId);
$this->currencies[$accountId] = $currencies[$currencyId];
}
diff --git a/app/Transformers/V2/TransactionGroupTransformer.php b/app/Transformers/V2/TransactionGroupTransformer.php
index 959b5abeb5..77be731803 100644
--- a/app/Transformers/V2/TransactionGroupTransformer.php
+++ b/app/Transformers/V2/TransactionGroupTransformer.php
@@ -31,7 +31,6 @@ use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionJournalMeta;
use FireflyIII\Models\TransactionType;
-use FireflyIII\Support\Http\Api\ConvertsExchangeRates;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\NullArrayObject;
use Illuminate\Support\Collection;
@@ -302,7 +301,7 @@ class TransactionGroupTransformer extends AbstractTransformer
// app('log')->debug(sprintf('Now in date("%s")', $string));
if (10 === strlen($string)) {
$res = Carbon::createFromFormat('Y-m-d', $string, config('app.timezone'));
- if(false === $res) {
+ if (false === $res) {
return null;
}
return $res;
@@ -312,7 +311,7 @@ class TransactionGroupTransformer extends AbstractTransformer
}
if (19 === strlen($string) && str_contains($string, 'T')) {
$res = Carbon::createFromFormat('Y-m-d\TH:i:s', substr($string, 0, 19), config('app.timezone'));
- if(false === $res) {
+ if (false === $res) {
return null;
}
return $res;
@@ -320,7 +319,7 @@ class TransactionGroupTransformer extends AbstractTransformer
// 2022-01-01 01:01:01
$res = Carbon::createFromFormat('Y-m-d H:i:s', substr($string, 0, 19), config('app.timezone'));
- if(false === $res) {
+ if (false === $res) {
return null;
}
return $res;
diff --git a/app/Transformers/V2/UserGroupTransformer.php b/app/Transformers/V2/UserGroupTransformer.php
index b33b81df01..f8fb013411 100644
--- a/app/Transformers/V2/UserGroupTransformer.php
+++ b/app/Transformers/V2/UserGroupTransformer.php
@@ -58,7 +58,7 @@ class UserGroupTransformer extends AbstractTransformer
/** @var UserGroup $userGroup */
foreach ($objects as $userGroup) {
$userGroupId = $userGroup->id;
- $access = $user->hasRoleInGroupOrOwner($userGroup, UserRoleEnum::VIEW_MEMBERSHIPS) || $user->hasRole('owner');
+ $access = $user->hasRoleInGroupOrOwner($userGroup, UserRoleEnum::VIEW_MEMBERSHIPS) || $user->hasRole('owner');
if ($access) {
$groupMemberships = $userGroup->groupMemberships()->get();
/** @var GroupMembership $groupMembership */
diff --git a/app/Transformers/WebhookTransformer.php b/app/Transformers/WebhookTransformer.php
index 511c3be8c4..5ed705f4de 100644
--- a/app/Transformers/WebhookTransformer.php
+++ b/app/Transformers/WebhookTransformer.php
@@ -37,9 +37,7 @@ class WebhookTransformer extends AbstractTransformer
/**
* WebhookTransformer constructor.
*/
- public function __construct()
- {
- }
+ public function __construct() {}
/**
* Transform webhook.
diff --git a/app/User.php b/app/User.php
index 958052f490..e99fd3aee3 100644
--- a/app/User.php
+++ b/app/User.php
@@ -361,33 +361,33 @@ class User extends Authenticatable
}
/**
- * Does the user have role X in group Y?
+ * Does the user have role X in group Y, or is the user the group owner of has full rights to the group?
+ *
+ * If $allowOverride is set to true, then the roles FULL or OWNER will also be checked,
+ * which means that in most cases the user DOES have access, regardless of the original role submitted in $role.
*
* @param UserGroup $userGroup
* @param UserRoleEnum $role
*
* @return bool
*/
- public function hasSpecificRoleInGroup(UserGroup $userGroup, UserRoleEnum $role): bool
+ public function hasRoleInGroupOrOwner(UserGroup $userGroup, UserRoleEnum $role): bool
{
- return $this->hasAnyRoleInGroup($userGroup, [$role]);
+ $roles = [$role->value, UserRoleEnum::OWNER->value, UserRoleEnum::FULL->value];
+ return $this->hasAnyRoleInGroup($userGroup, $roles);
}
/**
- * Does the user have role X in group Y, or is the user the group owner of has full rights to the group?
- *
- * If $allowOverride is set to true, then the roles FULL or OWNER will also be checked,
- * which means that in most cases the user DOES have access, regardless of the original role submitted in $role.
+ * Does the user have role X in group Y?
*
* @param UserGroup $userGroup
* @param UserRoleEnum $role
*
* @return bool
*/
- public function hasRoleInGroupOrOwner(UserGroup $userGroup, UserRoleEnum $role): bool
+ public function hasSpecificRoleInGroup(UserGroup $userGroup, UserRoleEnum $role): bool
{
- $roles = [$role->value, UserRoleEnum::OWNER->value, UserRoleEnum::FULL->value];
- return $this->hasAnyRoleInGroup($userGroup, $roles);
+ return $this->hasAnyRoleInGroup($userGroup, [$role]);
}
/**
@@ -416,63 +416,41 @@ class User extends Authenticatable
->where('user_group_id', $userGroup->id)->get();
if (0 === $groupMemberships->count()) {
app('log')->error(sprintf(
- 'User #%d "%s" does not have roles %s in user group #%d "%s"',
- $this->id,
- $this->email,
- implode(', ', $roles),
- $userGroup->id,
- $userGroup->title
- ));
+ 'User #%d "%s" does not have roles %s in user group #%d "%s"',
+ $this->id,
+ $this->email,
+ implode(', ', $roles),
+ $userGroup->id,
+ $userGroup->title
+ ));
return false;
}
foreach ($groupMemberships as $membership) {
app('log')->debug(sprintf(
- 'User #%d "%s" has role "%s" in user group #%d "%s"',
- $this->id,
- $this->email,
- $membership->userRole->title,
- $userGroup->id,
- $userGroup->title
- ));
+ 'User #%d "%s" has role "%s" in user group #%d "%s"',
+ $this->id,
+ $this->email,
+ $membership->userRole->title,
+ $userGroup->id,
+ $userGroup->title
+ ));
if (in_array($membership->userRole->title, $dbRolesTitles, true)) {
app('log')->debug(sprintf('Return true, found role "%s"', $membership->userRole->title));
return true;
}
}
app('log')->error(sprintf(
- 'User #%d "%s" does not have roles %s in user group #%d "%s"',
- $this->id,
- $this->email,
- implode(', ', $roles),
- $userGroup->id,
- $userGroup->title
- ));
+ 'User #%d "%s" does not have roles %s in user group #%d "%s"',
+ $this->id,
+ $this->email,
+ implode(', ', $roles),
+ $userGroup->id,
+ $userGroup->title
+ ));
return false;
}
- /**
- * This method refers to the "global" role a user can have, outside of any group they may be part of.
- *
- * @param string $role
- *
- * @return bool
- */
- public function hasRole(string $role): bool
- {
- return $this->roles()->where('name', $role)->count() === 1;
- }
-
- /**
- * Link to roles.
- *
- * @return BelongsToMany
- */
- public function roles(): BelongsToMany
- {
- return $this->belongsToMany(Role::class);
- }
-
/**
*
* @return HasMany
@@ -554,6 +532,28 @@ class User extends Authenticatable
};
}
+ /**
+ * This method refers to the "global" role a user can have, outside of any group they may be part of.
+ *
+ * @param string $role
+ *
+ * @return bool
+ */
+ public function hasRole(string $role): bool
+ {
+ return $this->roles()->where('name', $role)->count() === 1;
+ }
+
+ /**
+ * Link to roles.
+ *
+ * @return BelongsToMany
+ */
+ public function roles(): BelongsToMany
+ {
+ return $this->belongsToMany(Role::class);
+ }
+
/**
* Route notifications for the Slack channel.
*
@@ -696,7 +696,7 @@ class User extends Authenticatable
*/
public function userGroup(): BelongsTo
{
- return $this->belongsTo(UserGroup::class, );
+ return $this->belongsTo(UserGroup::class,);
}
/**
diff --git a/app/Validation/Account/OBValidation.php b/app/Validation/Account/OBValidation.php
index 63b0beb629..f419d8058a 100644
--- a/app/Validation/Account/OBValidation.php
+++ b/app/Validation/Account/OBValidation.php
@@ -137,7 +137,7 @@ trait OBValidation
$result = true;
// set the source to be a (dummy) initial balance account.
- $account = new Account();
+ $account = new Account();
/** @var AccountType $accountType */
$accountType = AccountType::whereType(AccountType::INITIAL_BALANCE)->first();
$account->accountType = $accountType;
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 8653fd5a4d..396a1d32ce 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -86,6 +86,7 @@ class FireflyValidator extends Validator
* @param mixed $value
* @param mixed $parameters
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ *
* @return bool
*/
public function validateBelongsToUser($attribute, $value, $parameters): bool
@@ -104,6 +105,7 @@ class FireflyValidator extends Validator
* @param mixed $attribute
* @param mixed $value
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ *
* @return bool
*/
public function validateBic($attribute, $value): bool
@@ -124,6 +126,7 @@ class FireflyValidator extends Validator
* @param mixed $attribute
* @param mixed $value
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ *
* @return bool
*/
public function validateIban(mixed $attribute, mixed $value): bool
@@ -229,7 +232,7 @@ class FireflyValidator extends Validator
}
try {
$checksum = bcmod($iban, '97');
- } catch (ValueError $e) { /** @phpstan-ignore-line */
+ } catch (ValueError $e) { // @phpstan-ignore-line
$message = sprintf('Could not validate IBAN check value "%s" (IBAN "%s")', $iban, $value);
app('log')->error($message);
app('log')->error($e->getTraceAsString());
@@ -245,6 +248,7 @@ class FireflyValidator extends Validator
* @param mixed $value
* @param mixed $parameters
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ *
* @return bool
*/
public function validateLess($attribute, $value, $parameters): bool
@@ -260,6 +264,7 @@ class FireflyValidator extends Validator
* @param mixed $value
* @param mixed $parameters
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ *
* @return bool
*/
public function validateMore($attribute, $value, $parameters): bool
@@ -275,6 +280,7 @@ class FireflyValidator extends Validator
* @param mixed $value
* @param mixed $parameters
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ *
* @return bool
*/
public function validateMustExist($attribute, $value, $parameters): bool
@@ -446,6 +452,7 @@ class FireflyValidator extends Validator
* @param mixed $attribute
* @param mixed $value
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ *
* @return bool
*/
public function validateSecurePassword($attribute, $value): bool