🤖 Auto commit for release 'develop' on 2025-05-04

This commit is contained in:
JC5
2025-05-04 13:55:42 +02:00
parent 2c96729d76
commit 1001e04b63
136 changed files with 987 additions and 1149 deletions

View File

@@ -1256,16 +1256,16 @@
},
{
"name": "symfony/console",
"version": "v7.2.5",
"version": "v7.2.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "e51498ea18570c062e7df29d05a7003585b19b88"
"reference": "0e2e3f38c192e93e622e41ec37f4ca70cfedf218"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/e51498ea18570c062e7df29d05a7003585b19b88",
"reference": "e51498ea18570c062e7df29d05a7003585b19b88",
"url": "https://api.github.com/repos/symfony/console/zipball/0e2e3f38c192e93e622e41ec37f4ca70cfedf218",
"reference": "0e2e3f38c192e93e622e41ec37f4ca70cfedf218",
"shasum": ""
},
"require": {
@@ -1329,7 +1329,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v7.2.5"
"source": "https://github.com/symfony/console/tree/v7.2.6"
},
"funding": [
{
@@ -1345,7 +1345,7 @@
"type": "tidelift"
}
],
"time": "2025-03-12T08:11:12+00:00"
"time": "2025-04-07T19:09:28+00:00"
},
{
"name": "symfony/deprecation-contracts",
@@ -1769,7 +1769,7 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.31.0",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@@ -1828,7 +1828,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0"
},
"funding": [
{
@@ -1848,7 +1848,7 @@
},
{
"name": "symfony/polyfill-intl-grapheme",
"version": "v1.31.0",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-grapheme.git",
@@ -1906,7 +1906,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.32.0"
},
"funding": [
{
@@ -1926,7 +1926,7 @@
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.31.0",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@@ -1987,7 +1987,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0"
},
"funding": [
{
@@ -2007,19 +2007,20 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.31.0",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493",
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"php": ">=7.2"
},
"provide": {
@@ -2067,7 +2068,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0"
},
"funding": [
{
@@ -2083,20 +2084,20 @@
"type": "tidelift"
}
],
"time": "2024-09-09T11:45:10+00:00"
"time": "2024-12-23T08:48:59+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.31.0",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"shasum": ""
},
"require": {
@@ -2147,7 +2148,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0"
},
"funding": [
{
@@ -2163,11 +2164,11 @@
"type": "tidelift"
}
],
"time": "2024-09-09T11:45:10+00:00"
"time": "2025-01-02T08:10:11+00:00"
},
{
"name": "symfony/polyfill-php81",
"version": "v1.31.0",
"version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php81.git",
@@ -2223,7 +2224,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-php81/tree/v1.32.0"
},
"funding": [
{
@@ -2449,16 +2450,16 @@
},
{
"name": "symfony/string",
"version": "v7.2.0",
"version": "v7.2.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "446e0d146f991dde3e73f45f2c97a9faad773c82"
"reference": "a214fe7d62bd4df2a76447c67c6b26e1d5e74931"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/446e0d146f991dde3e73f45f2c97a9faad773c82",
"reference": "446e0d146f991dde3e73f45f2c97a9faad773c82",
"url": "https://api.github.com/repos/symfony/string/zipball/a214fe7d62bd4df2a76447c67c6b26e1d5e74931",
"reference": "a214fe7d62bd4df2a76447c67c6b26e1d5e74931",
"shasum": ""
},
"require": {
@@ -2516,7 +2517,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v7.2.0"
"source": "https://github.com/symfony/string/tree/v7.2.6"
},
"funding": [
{
@@ -2532,7 +2533,7 @@
"type": "tidelift"
}
],
"time": "2024-11-13T13:31:26+00:00"
"time": "2025-04-20T20:18:16+00:00"
}
],
"packages-dev": [],

View File

@@ -65,7 +65,7 @@ class BillController extends Controller
$data = $request->getData();
$result = $this->repository->searchBill($data['query'], $this->parameters->get('limit'));
$filtered = $result->map(
static fn(Bill $item) => [
static fn (Bill $item) => [
'id' => (string) $item->id,
'name' => $item->name,
'active' => $item->active,

View File

@@ -65,7 +65,7 @@ class BudgetController extends Controller
$data = $request->getData();
$result = $this->repository->searchBudget($data['query'], $this->parameters->get('limit'));
$filtered = $result->map(
static fn(Budget $item) => [
static fn (Budget $item) => [
'id' => (string) $item->id,
'name' => $item->name,
]

View File

@@ -65,7 +65,7 @@ class CategoryController extends Controller
$data = $request->getData();
$result = $this->repository->searchCategory($data['query'], $this->parameters->get('limit'));
$filtered = $result->map(
static fn(Category $item) => [
static fn (Category $item) => [
'id' => (string) $item->id,
'name' => $item->name,
]

View File

@@ -119,7 +119,7 @@ class CategoryController extends Controller
$return = array_values($return);
// order by amount
usort($return, static fn(array $a, array $b) => (float) $a['amount'] < (float) $b['amount'] ? 1 : -1);
usort($return, static fn (array $a, array $b) => (float) $a['amount'] < (float) $b['amount'] ? 1 : -1);
return response()->json($this->clean($return));
}

View File

@@ -29,6 +29,7 @@ use FireflyIII\Api\V1\Requests\Data\Export\ExportRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Support\Export\ExportDataGenerator;
use Illuminate\Http\Response as LaravelResponse;
use function Safe\date;
/**

View File

@@ -177,7 +177,7 @@ class ListController extends Controller
// filter and paginate list:
$collection = $unfiltered->filter(
static fn(Bill $bill) => $bill->transaction_currency_id === $currency->id
static fn (Bill $bill) => $bill->transaction_currency_id === $currency->id
);
$count = $collection->count();
$bills = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);

View File

@@ -58,7 +58,7 @@ class StoreRequest extends FormRequest
{
$models = config('firefly.valid_attachment_models');
$models = array_map(
static fn(string $className) => str_replace('FireflyIII\Models\\', '', $className),
static fn (string $className) => str_replace('FireflyIII\Models\\', '', $className),
$models
);
$models = implode(',', $models);

View File

@@ -60,7 +60,7 @@ class UpdateRequest extends FormRequest
{
$models = config('firefly.valid_attachment_models');
$models = array_map(
static fn(string $className) => str_replace('FireflyIII\Models\\', '', $className),
static fn (string $className) => str_replace('FireflyIII\Models\\', '', $className),
$models
);
$models = implode(',', $models);

View File

@@ -61,7 +61,7 @@ class CategoryController extends Controller
$queryParameters = $request->getParameters();
$result = $this->repository->searchCategory($queryParameters['query'], $queryParameters['size']);
$filtered = $result->map(
static fn(Category $item) => [
static fn (Category $item) => [
'id' => (string) $item->id,
'title' => $item->name,
'meta' => [],

View File

@@ -61,7 +61,7 @@ class TagController extends Controller
$queryParameters = $request->getParameters();
$result = $this->repository->searchTag($queryParameters['query']);
$filtered = $result->map(
static fn(Tag $item) => [
static fn (Tag $item) => [
'id' => (string) $item->id,
'title' => $item->tag,
'value' => (string) $item->id,

View File

@@ -134,7 +134,7 @@ class CategoryController extends Controller
$return = array_values($return);
// order by native amount
usort($return, static fn(array $a, array $b) => (float) $a['native_amount'] < (float) $b['native_amount'] ? 1 : -1);
usort($return, static fn (array $a, array $b) => (float) $a['native_amount'] < (float) $b['native_amount'] ? 1 : -1);
$converter->summarize();
return response()->json($this->clean($return));

View File

@@ -115,7 +115,7 @@ class CorrectsCurrencies extends Command
$found = array_values(
array_filter(
$found,
static fn(int $currencyId) => 0 !== $currencyId
static fn (int $currencyId) => 0 !== $currencyId
)
);

View File

@@ -128,7 +128,7 @@ class CorrectsNativeAmounts extends Command
$repository->setUserGroup($userGroup);
$set = $repository->getPiggyBanks();
$set = $set->filter(
static fn(PiggyBank $piggyBank) => $currency->id !== $piggyBank->transaction_currency_id
static fn (PiggyBank $piggyBank) => $currency->id !== $piggyBank->transaction_currency_id
);
foreach ($set as $piggyBank) {
$piggyBank->encrypted = false;

View File

@@ -115,7 +115,7 @@ class CorrectsTransactionTypes extends Command
private function getSourceAccount(TransactionJournal $journal): Account
{
$collection = $journal->transactions->filter(
static fn(Transaction $transaction) => $transaction->amount < 0
static fn (Transaction $transaction) => $transaction->amount < 0
);
if (0 === $collection->count()) {
throw new FireflyException(sprintf('300001: Journal #%d has no source transaction.', $journal->id));
@@ -142,7 +142,7 @@ class CorrectsTransactionTypes extends Command
private function getDestinationAccount(TransactionJournal $journal): Account
{
$collection = $journal->transactions->filter(
static fn(Transaction $transaction) => $transaction->amount > 0
static fn (Transaction $transaction) => $transaction->amount > 0
);
if (0 === $collection->count()) {
throw new FireflyException(sprintf('300004: Journal #%d has no destination transaction.', $journal->id));

View File

@@ -179,7 +179,7 @@ class UpgradesToGroups extends Command
private function getDestinationTransactions(TransactionJournal $journal): Collection
{
return $journal->transactions->filter(
static fn(Transaction $transaction) => $transaction->amount > 0
static fn (Transaction $transaction) => $transaction->amount > 0
);
}

View File

@@ -38,20 +38,20 @@ class UpgradesTransferCurrencies extends Command
{
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_transfer_currencies';
protected $description = 'Updates transfer currency information.';
protected $signature = 'upgrade:480-transfer-currencies {--F|force : Force the execution of this command.}';
public const string CONFIG_NAME = '480_transfer_currencies';
protected $description = 'Updates transfer currency information.';
protected $signature = 'upgrade:480-transfer-currencies {--F|force : Force the execution of this command.}';
private array $accountCurrencies;
private AccountRepositoryInterface $accountRepos;
private JournalCLIRepositoryInterface $cliRepos;
private int $count;
private ?Account $destinationAccount = null;
private ?TransactionCurrency $destinationCurrency = null;
private ?Account $destinationAccount = null;
private ?TransactionCurrency $destinationCurrency = null;
private ?Transaction $destinationTransaction = null;
private ?Account $sourceAccount = null;
private ?TransactionCurrency $sourceCurrency = null;
private ?Transaction $sourceTransaction = null;
private ?Account $sourceAccount = null;
private ?TransactionCurrency $sourceCurrency = null;
private ?Transaction $sourceTransaction = null;
/**
* Execute the console command.

View File

@@ -41,7 +41,5 @@ class InvitationCreated extends Event
/**
* Create a new event instance.
*/
public function __construct(public InvitedUser $invitee)
{
}
public function __construct(public InvitedUser $invitee) {}
}

View File

@@ -37,7 +37,5 @@ class DestroyedTransactionLink extends Event
/**
* DestroyedTransactionLink constructor.
*/
public function __construct(private TransactionJournalLink $link)
{
}
public function __construct(private TransactionJournalLink $link) {}
}

View File

@@ -37,7 +37,5 @@ class DetectedNewIPAddress extends Event
/**
* Create a new event instance. This event is triggered when a new user registers.
*/
public function __construct(public User $user)
{
}
public function __construct(public User $user) {}
}

View File

@@ -31,7 +31,5 @@ class Updated
{
use SerializesModels;
public function __construct(public Account $account)
{
}
public function __construct(public Account $account) {}
}

View File

@@ -35,7 +35,5 @@ class Created extends Event
{
use SerializesModels;
public function __construct(public BudgetLimit $budgetLimit)
{
}
public function __construct(public BudgetLimit $budgetLimit) {}
}

View File

@@ -35,7 +35,5 @@ class Deleted extends Event
{
use SerializesModels;
public function __construct(public BudgetLimit $budgetLimit)
{
}
public function __construct(public BudgetLimit $budgetLimit) {}
}

View File

@@ -35,7 +35,5 @@ class Updated extends Event
{
use SerializesModels;
public function __construct(public BudgetLimit $budgetLimit)
{
}
public function __construct(public BudgetLimit $budgetLimit) {}
}

View File

@@ -46,7 +46,7 @@ class ChangedAmount extends Event
public function __construct(PiggyBank $piggyBank, string $amount, public ?TransactionJournal $transactionJournal, public ?TransactionGroup $transactionGroup)
{
app('log')->debug(sprintf('Created piggy bank event for piggy bank #%d with amount %s', $piggyBank->id, $amount));
$this->piggyBank = $piggyBank;
$this->amount = $amount;
$this->piggyBank = $piggyBank;
$this->amount = $amount;
}
}

View File

@@ -38,7 +38,5 @@ class RegisteredUser extends Event
/**
* Create a new event instance. This event is triggered when a new user registers.
*/
public function __construct(public OwnerNotifiable $owner, public User $user)
{
}
public function __construct(public OwnerNotifiable $owner, public User $user) {}
}

View File

@@ -38,7 +38,5 @@ class RequestedVersionCheckStatus extends Event
* Create a new event instance. This event is triggered when Firefly III wants to know
* what the deal is with the version checker.
*/
public function __construct(public User $user)
{
}
public function __construct(public User $user) {}
}

View File

@@ -30,7 +30,5 @@ class UnknownUserAttemptedLogin
{
use SerializesModels;
public function __construct(public string $address)
{
}
public function __construct(public string $address) {}
}

View File

@@ -37,7 +37,5 @@ class StoredAccount extends Event
/**
* Create a new event instance.
*/
public function __construct(public Account $account)
{
}
public function __construct(public Account $account) {}
}

View File

@@ -37,7 +37,5 @@ class StoredTransactionGroup extends Event
/**
* Create a new event instance.
*/
public function __construct(public TransactionGroup $transactionGroup, public bool $applyRules, public bool $fireWebhooks)
{
}
public function __construct(public TransactionGroup $transactionGroup, public bool $applyRules, public bool $fireWebhooks) {}
}

View File

@@ -39,7 +39,5 @@ class TriggeredAuditLog extends Event
*
* @SuppressWarnings("PHPMD.ExcessiveParameterList")
*/
public function __construct(public Model $changer, public Model $auditable, public string $field, public mixed $before, public mixed $after)
{
}
public function __construct(public Model $changer, public Model $auditable, public string $field, public mixed $before, public mixed $after) {}
}

View File

@@ -37,7 +37,5 @@ class UpdatedAccount extends Event
/**
* Create a new event instance.
*/
public function __construct(public Account $account)
{
}
public function __construct(public Account $account) {}
}

View File

@@ -37,7 +37,5 @@ class UpdatedTransactionGroup extends Event
/**
* Create a new event instance.
*/
public function __construct(public TransactionGroup $transactionGroup, public bool $applyRules, public bool $fireWebhooks)
{
}
public function __construct(public TransactionGroup $transactionGroup, public bool $applyRules, public bool $fireWebhooks) {}
}

View File

@@ -37,7 +37,5 @@ class UserChangedEmail extends Event
/**
* UserChangedEmail constructor.
*/
public function __construct(public User $user, public string $newEmail, public string $oldEmail)
{
}
public function __construct(public User $user, public string $newEmail, public string $oldEmail) {}
}

View File

@@ -34,7 +34,5 @@ class WarnUserAboutBill extends Event
{
use SerializesModels;
public function __construct(public Bill $bill, public string $field, public int $diff)
{
}
public function __construct(public Bill $bill, public string $field, public int $diff) {}
}

View File

@@ -253,7 +253,7 @@ class Handler extends ExceptionHandler
{
return null !== Arr::first(
$this->dontReport,
static fn($type) => $e instanceof $type
static fn ($type) => $e instanceof $type
);
}

View File

@@ -27,7 +27,6 @@ namespace FireflyIII\Handlers\Events;
use FireflyIII\Enums\WebhookTrigger;
use FireflyIII\Events\DestroyedTransactionGroup;
use FireflyIII\Events\RequestedSendWebhookMessages;
use FireflyIII\Events\UpdatedTransactionGroup;
use FireflyIII\Generator\Webhook\MessageGeneratorInterface;
use FireflyIII\Support\Models\AccountBalanceCalculator;
use Illuminate\Support\Collection;

View File

@@ -64,24 +64,24 @@ class UpdatedGroupEventHandler
return;
}
$journals = $updatedGroupEvent->transactionGroup->transactionJournals;
$array = [];
$journals = $updatedGroupEvent->transactionGroup->transactionJournals;
$array = [];
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
$array[] = $journal->id;
}
$journalIds = implode(',', $array);
$journalIds = implode(',', $array);
Log::debug(sprintf('Add local operator for journal(s): %s', $journalIds));
// collect rules:
$ruleGroupRepository = app(RuleGroupRepositoryInterface::class);
$ruleGroupRepository->setUser($updatedGroupEvent->transactionGroup->user);
$groups = $ruleGroupRepository->getRuleGroupsWithRules('update-journal');
$groups = $ruleGroupRepository->getRuleGroupsWithRules('update-journal');
// file rule engine.
$newRuleEngine = app(RuleEngineInterface::class);
$newRuleEngine = app(RuleEngineInterface::class);
$newRuleEngine->setUser($updatedGroupEvent->transactionGroup->user);
$newRuleEngine->addOperator(['type' => 'journal_id', 'value' => $journalIds]);
$newRuleEngine->setRuleGroups($groups);
@@ -90,7 +90,7 @@ class UpdatedGroupEventHandler
private function recalculateCredit(UpdatedTransactionGroup $event): void
{
$group = $event->transactionGroup;
$group = $event->transactionGroup;
/** @var CreditRecalculateService $object */
$object = app(CreditRecalculateService::class);
@@ -101,13 +101,13 @@ class UpdatedGroupEventHandler
private function triggerWebhooks(UpdatedTransactionGroup $updatedGroupEvent): void
{
Log::debug(__METHOD__);
$group = $updatedGroupEvent->transactionGroup;
$group = $updatedGroupEvent->transactionGroup;
if (false === $updatedGroupEvent->fireWebhooks) {
Log::info(sprintf('Will not fire webhooks for transaction group #%d', $group->id));
return;
}
$user = $group->user;
$user = $group->user;
/** @var MessageGeneratorInterface $engine */
$engine = app(MessageGeneratorInterface::class);
@@ -124,19 +124,20 @@ class UpdatedGroupEventHandler
*/
public function unifyAccounts(UpdatedTransactionGroup $updatedGroupEvent): void
{
$group = $updatedGroupEvent->transactionGroup;
$group = $updatedGroupEvent->transactionGroup;
if (1 === $group->transactionJournals->count()) {
return;
}
// first journal:
/** @var null|TransactionJournal $first */
$first = $group->transactionJournals()
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC')
->first();
$first = $group->transactionJournals()
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC')
->first()
;
if (null === $first) {
Log::warning(sprintf('Group #%d has no transaction journals.', $group->id));
@@ -144,24 +145,26 @@ class UpdatedGroupEventHandler
return;
}
$all = $group->transactionJournals()->get()->pluck('id')->toArray();
$all = $group->transactionJournals()->get()->pluck('id')->toArray();
/** @var Account $sourceAccount */
$sourceAccount = $first->transactions()->where('amount', '<', '0')->first()->account;
/** @var Account $destAccount */
$destAccount = $first->transactions()->where('amount', '>', '0')->first()->account;
$destAccount = $first->transactions()->where('amount', '>', '0')->first()->account;
$type = $first->transactionType->type;
$type = $first->transactionType->type;
if (TransactionTypeEnum::TRANSFER->value === $type || TransactionTypeEnum::WITHDRAWAL->value === $type) {
// set all source transactions to source account:
Transaction::whereIn('transaction_journal_id', $all)
->where('amount', '<', 0)->update(['account_id' => $sourceAccount->id]);
->where('amount', '<', 0)->update(['account_id' => $sourceAccount->id])
;
}
if (TransactionTypeEnum::TRANSFER->value === $type || TransactionTypeEnum::DEPOSIT->value === $type) {
// set all destination transactions to destination account:
Transaction::whereIn('transaction_journal_id', $all)
->where('amount', '>', 0)->update(['account_id' => $destAccount->id]);
->where('amount', '>', 0)->update(['account_id' => $destAccount->id])
;
}
}

View File

@@ -42,7 +42,7 @@ class WebhookEventHandler
$messages = WebhookMessage::where('webhook_messages.sent', false)
->get(['webhook_messages.*'])
->filter(
static fn(WebhookMessage $message) => $message->webhookAttempts()->count() <= 2
static fn (WebhookMessage $message) => $message->webhookAttempts()->count() <= 2
)->splice(0, 5)
;
app('log')->debug(sprintf('Found %d webhook message(s) ready to be send.', $messages->count()));

View File

@@ -34,6 +34,7 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use FireflyIII\Models\TransactionJournal;
/**
* Trait MetaCollection
@@ -492,7 +493,7 @@ trait MetaCollection
'notes',
static function (JoinClause $join): void {
$join->on('notes.noteable_id', '=', 'transaction_journals.id');
$join->where('notes.noteable_type', '=', \FireflyIII\Models\TransactionJournal::class);
$join->where('notes.noteable_type', '=', TransactionJournal::class);
$join->whereNull('notes.deleted_at');
}
);

View File

@@ -166,7 +166,7 @@ class ShowController extends Controller
/** @var AttachmentTransformer $transformer */
$transformer = app(AttachmentTransformer::class);
$attachments = $collection->each(
static fn(Attachment $attachment) => $transformer->transform($attachment)
static fn (Attachment $attachment) => $transformer->transform($attachment)
);
}

View File

@@ -90,7 +90,7 @@ class PiggyBankController extends Controller
$chartData = [];
while ($oldest <= $today) {
$filtered = $set->filter(
static fn(PiggyBankEvent $event) => $event->date->lte($oldest)
static fn (PiggyBankEvent $event) => $event->date->lte($oldest)
);
$currentSum = $filtered->sum('amount');
$label = $oldest->isoFormat((string) trans('config.month_and_day_js', [], $locale));
@@ -98,7 +98,7 @@ class PiggyBankController extends Controller
$oldest = app('navigation')->addPeriod($oldest, $step, 0);
}
$finalFiltered = $set->filter(
static fn(PiggyBankEvent $event) => $event->date->lte($today)
static fn (PiggyBankEvent $event) => $event->date->lte($today)
);
$finalSum = $finalFiltered->sum('amount');
$finalLabel = $today->isoFormat((string) trans('config.month_and_day_js', [], $locale));

View File

@@ -82,7 +82,7 @@ class FrontpageController extends Controller
// sort by current percentage (lowest at the top)
uasort(
$info,
static fn(array $a, array $b) => $a['percentage'] <=> $b['percentage']
static fn (array $a, array $b) => $a['percentage'] <=> $b['percentage']
);
$html = '';

View File

@@ -41,7 +41,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)) {
@@ -55,8 +55,8 @@ class IntroController extends Controller
// remove last step:
array_pop($steps);
// merge arrays and add last step again
$steps = array_merge($steps, $specificSteps);
$steps[] = $lastStep;
$steps = array_merge($steps, $specificSteps);
$steps[] = $lastStep;
}
if (!$this->hasOutroStep($route)) {
$steps = array_merge($steps, $specificSteps);
@@ -77,7 +77,7 @@ class IntroController extends Controller
return false;
}
$hasStep = array_key_exists('outro', $elements);
$hasStep = array_key_exists('outro', $elements);
app('log')->debug('Elements is array', $elements);
app('log')->debug('Keys is', array_keys($elements));
@@ -94,8 +94,8 @@ class IntroController extends Controller
public function postEnable(string $route, ?string $specialPage = null): JsonResponse
{
$specialPage ??= '';
$route = str_replace('.', '_', $route);
$key = sprintf('shown_demo_%s', $route);
$route = str_replace('.', '_', $route);
$key = sprintf('shown_demo_%s', $route);
if ('' !== $specialPage) {
$key = sprintf('%s_%s', $key, $specialPage);
}
@@ -114,7 +114,7 @@ class IntroController extends Controller
public function postFinished(string $route, ?string $specialPage = null): JsonResponse
{
$specialPage ??= '';
$key = sprintf('shown_demo_%s', $route);
$key = sprintf('shown_demo_%s', $route);
if ('' !== $specialPage) {
$key = sprintf('%s_%s', $key, $specialPage);
}

View File

@@ -104,7 +104,7 @@ class EditController extends Controller
$repetition = $recurrence->recurrenceRepetitions()->first();
$currentRepType = $repetition->repetition_type;
if ('' !== $repetition->repetition_moment) {
$currentRepType = sprintf('%s,%s', $currentRepType,$repetition->repetition_moment);
$currentRepType = sprintf('%s,%s', $currentRepType, $repetition->repetition_moment);
}
// put previous url in session if not redirect from store (not "return_to_edit").

View File

@@ -43,9 +43,7 @@ class Authenticate
* The authentication factory instance.
*/
protected Auth $auth
)
{
}
) {}
/**
* Handle an incoming request.

View File

@@ -45,7 +45,7 @@ class SecureHeaders
// generate and share nonce.
$nonce = base64_encode(random_bytes(16));
Vite::useCspNonce($nonce);
if (class_exists(\Barryvdh\Debugbar\Facades\Debugbar::class)) {
if (class_exists(Debugbar::class)) {
Debugbar::getJavascriptRenderer()->setCspNonce($nonce);
}
app('view')->share('JS_NONCE', $nonce);

View File

@@ -156,7 +156,7 @@ class CreateRecurringTransactions implements ShouldQueue
private function filterRecurrences(Collection $recurrences): Collection
{
return $recurrences->filter(
fn(Recurrence $recurrence) => $this->validRecurrence($recurrence)
fn (Recurrence $recurrence) => $this->validRecurrence($recurrence)
);
}

View File

@@ -43,7 +43,7 @@ class MailError extends Job implements ShouldQueue
*/
public function __construct(protected array $userData, protected string $destination, protected string $ipAddress, protected array $exception)
{
$debug = $this->exception;
$debug = $this->exception;
unset($debug['stackTrace'], $debug['headers']);
app('log')->error(sprintf('Exception is: %s', \Safe\json_encode($debug)));

View File

@@ -45,9 +45,7 @@ class SendWebhookMessage implements ShouldQueue
/**
* Create a new job instance.
*/
public function __construct(private WebhookMessage $message)
{
}
public function __construct(private WebhookMessage $message) {}
/**
* Execute the job.

View File

@@ -40,9 +40,7 @@ class BillWarningMail extends Mailable
/**
* ConfirmEmailChangeMail constructor.
*/
public function __construct(public Bill $bill, public string $field, public int $diff)
{
}
public function __construct(public Bill $bill, public string $field, public int $diff) {}
/**
* Build the message.

View File

@@ -40,9 +40,7 @@ class ConfirmEmailChangeMail extends Mailable
/**
* ConfirmEmailChangeMail constructor.
*/
public function __construct(public string $newEmail, public string $oldEmail, public string $url)
{
}
public function __construct(public string $newEmail, public string $oldEmail, public string $url) {}
/**
* Build the message.

View File

@@ -42,7 +42,7 @@ class InvitationMail extends Mailable
*/
public function __construct(public string $invitee, public string $admin, public string $url)
{
$this->host = (string) \Safe\parse_url($this->url, PHP_URL_HOST);
$this->host = (string) \Safe\parse_url($this->url, PHP_URL_HOST);
}
/**

View File

@@ -43,9 +43,7 @@ class NewIPAddressWarningMail extends Mailable
/**
* OAuthTokenCreatedMail constructor.
*/
public function __construct(public string $ipAddress)
{
}
public function __construct(public string $ipAddress) {}
/**
* Build the message.

View File

@@ -40,9 +40,7 @@ class OAuthTokenCreatedMail extends Mailable
/**
* OAuthTokenCreatedMail constructor.
*/
public function __construct(public Client $client)
{
}
public function __construct(public Client $client) {}
/**
* Build the message.

View File

@@ -40,9 +40,7 @@ class RegisteredUser extends Mailable
/**
* Create a new message instance.
*/
public function __construct(public string $address)
{
}
public function __construct(public string $address) {}
/**
* Build the message.

View File

@@ -45,9 +45,7 @@ class ReportNewJournalsMail extends Mailable
/**
* ConfirmEmailChangeMail constructor.
*/
public function __construct(public Collection $groups)
{
}
public function __construct(public Collection $groups) {}
/**
* Build the message.

View File

@@ -39,9 +39,7 @@ class RequestedNewPassword extends Mailable
/**
* RequestedNewPassword constructor.
*/
public function __construct(public string $url)
{
}
public function __construct(public string $url) {}
/**
* Build the message.

View File

@@ -38,9 +38,7 @@ class UndoEmailChangeMail extends Mailable
/**
* UndoEmailChangeMail constructor.
*/
public function __construct(public string $newEmail, public string $oldEmail, public string $url)
{
}
public function __construct(public string $newEmail, public string $oldEmail, public string $url) {}
/**
* Build the message.

View File

@@ -41,9 +41,7 @@ class UnknownUserLoginAttempt extends Notification
{
use Queueable;
public function __construct(private string $address)
{
}
public function __construct(private string $address) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -45,9 +45,7 @@ class UserInvitation extends Notification
{
use Queueable;
public function __construct(private InvitedUser $invitee)
{
}
public function __construct(private InvitedUser $invitee) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -45,9 +45,7 @@ class UserRegistration extends Notification
{
use Queueable;
public function __construct(private User $user)
{
}
public function __construct(private User $user) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -42,9 +42,7 @@ class VersionCheckResult extends Notification
{
use Queueable;
public function __construct(private string $message)
{
}
public function __construct(private string $message) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -40,9 +40,7 @@ class DisabledMFANotification extends Notification
{
use Queueable;
public function __construct(private User $user)
{
}
public function __construct(private User $user) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -40,9 +40,7 @@ class EnabledMFANotification extends Notification
{
use Queueable;
public function __construct(private User $user)
{
}
public function __construct(private User $user) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -40,9 +40,7 @@ class MFABackupFewLeftNotification extends Notification
{
use Queueable;
public function __construct(private User $user, private int $count)
{
}
public function __construct(private User $user, private int $count) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -40,9 +40,7 @@ class MFABackupNoLeftNotification extends Notification
{
use Queueable;
public function __construct(private User $user)
{
}
public function __construct(private User $user) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -40,9 +40,7 @@ class MFAManyFailedAttemptsNotification extends Notification
{
use Queueable;
public function __construct(private User $user, private int $count)
{
}
public function __construct(private User $user, private int $count) {}
public function toArray(User $notifiable): array
{

View File

@@ -40,9 +40,7 @@ class MFAUsedBackupCodeNotification extends Notification
{
use Queueable;
public function __construct(private User $user)
{
}
public function __construct(private User $user) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -40,9 +40,7 @@ class NewBackupCodesNotification extends Notification
{
use Queueable;
public function __construct(private User $user)
{
}
public function __construct(private User $user) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -41,9 +41,7 @@ class UserFailedLoginAttempt extends Notification
{
use Queueable;
public function __construct(private User $user)
{
}
public function __construct(private User $user) {}
public function toArray(User $notifiable): array
{

View File

@@ -42,9 +42,7 @@ class BillReminder extends Notification
{
use Queueable;
public function __construct(private Bill $bill, private string $field, private int $diff)
{
}
public function __construct(private Bill $bill, private string $field, private int $diff) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -36,9 +36,7 @@ class TransactionCreation extends Notification
{
use Queueable;
public function __construct(private array $collection)
{
}
public function __construct(private array $collection) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -43,9 +43,7 @@ class UserNewPassword extends Notification
{
use Queueable;
public function __construct(private string $url)
{
}
public function __construct(private string $url) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -48,12 +48,12 @@ class AuthServiceProvider extends ServiceProvider
{
Auth::provider(
'remote_user_provider',
static fn($app, array $config) => new RemoteUserProvider()
static fn ($app, array $config) => new RemoteUserProvider()
);
Auth::extend(
'remote_user_guard',
static fn($app, string $name, array $config) => new RemoteUserGuard(Auth::createUserProvider($config['provider']), $app)
static fn ($app, string $name, array $config) => new RemoteUserGuard(Auth::createUserProvider($config['provider']), $app)
);
Passport::tokensExpireIn(now()->addDays(14));

View File

@@ -90,7 +90,7 @@ class FireflyServiceProvider extends ServiceProvider
public function boot(): void
{
Validator::resolver(
static fn($translator, $data, $rules, $messages) => new FireflyValidator($translator, $data, $rules, $messages)
static fn ($translator, $data, $rules, $messages) => new FireflyValidator($translator, $data, $rules, $messages)
);
}
@@ -104,52 +104,52 @@ class FireflyServiceProvider extends ServiceProvider
{
$this->app->bind(
'preferences',
static fn() => new Preferences()
static fn () => new Preferences()
);
$this->app->bind(
'fireflyconfig',
static fn() => new FireflyConfig()
static fn () => new FireflyConfig()
);
$this->app->bind(
'navigation',
static fn() => new Navigation()
static fn () => new Navigation()
);
$this->app->bind(
'amount',
static fn() => new Amount()
static fn () => new Amount()
);
$this->app->bind(
'steam',
static fn() => new Steam()
static fn () => new Steam()
);
$this->app->bind(
'balance',
static fn() => new Balance()
static fn () => new Balance()
);
$this->app->bind(
'expandedform',
static fn() => new ExpandedForm()
static fn () => new ExpandedForm()
);
$this->app->bind(
'accountform',
static fn() => new AccountForm()
static fn () => new AccountForm()
);
$this->app->bind(
'currencyform',
static fn() => new CurrencyForm()
static fn () => new CurrencyForm()
);
$this->app->bind(
'piggybankform',
static fn() => new PiggyBankForm()
static fn () => new PiggyBankForm()
);
$this->app->bind(
'ruleform',
static fn() => new RuleForm()
static fn () => new RuleForm()
);
// chart generator:

View File

@@ -52,7 +52,7 @@ class FireflySessionProvider extends ServiceProvider
{
$this->app->singleton(
'session',
static fn($app) => new SessionManager($app)
static fn ($app) => new SessionManager($app)
);
}
@@ -63,11 +63,11 @@ class FireflySessionProvider extends ServiceProvider
{
$this->app->singleton(
'session.store',
static fn($app) =>
static fn ($app)
// First, we will create the session manager which is responsible for the
// creation of the various session drivers when they are needed by the
// application instance, and will resolve them on a lazy load basis.
$app->make('session')->driver()
=> $app->make('session')->driver()
);
}
}

View File

@@ -409,7 +409,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
public function getMetaValue(Account $account, string $field): ?string
{
$result = $account->accountMeta->filter(
static fn(AccountMeta $meta) => strtolower($meta->name) === strtolower($field)
static fn (AccountMeta $meta) => strtolower($meta->name) === strtolower($field)
);
if (0 === $result->count()) {
return null;

View File

@@ -127,7 +127,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup
public function getAllBudgetLimitsByCurrency(TransactionCurrency $currency, ?Carbon $start = null, ?Carbon $end = null): Collection
{
return $this->getAllBudgetLimits($start, $end)->filter(
static fn(BudgetLimit $budgetLimit) => $budgetLimit->transaction_currency_id === $currency->id
static fn (BudgetLimit $budgetLimit) => $budgetLimit->transaction_currency_id === $currency->id
);
}

View File

@@ -179,8 +179,8 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
$local = $this->get();
return $all->map(static function (TransactionCurrency $current) use ($local) {
$hasId = $local->contains(static fn(TransactionCurrency $entry) => $entry->id === $current->id);
$isNative = $local->contains(static fn(TransactionCurrency $entry) => 1 === (int) $entry->pivot->group_default && $entry->id === $current->id);
$hasId = $local->contains(static fn (TransactionCurrency $entry) => $entry->id === $current->id);
$isNative = $local->contains(static fn (TransactionCurrency $entry) => 1 === (int) $entry->pivot->group_default && $entry->id === $current->id);
$current->userGroupEnabled = $hasId;
$current->userGroupNative = $isNative;

View File

@@ -151,7 +151,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf
$merged = $outward->merge($inward);
return $merged->filter(
static fn(TransactionJournalLink $link) => null !== $link->source && null !== $link->destination
static fn (TransactionJournalLink $link) => null !== $link->source && null !== $link->destination
);
}

View File

@@ -149,7 +149,7 @@ class AccountRepository implements AccountRepositoryInterface
public function getMetaValue(Account $account, string $field): ?string
{
$result = $account->accountMeta->filter(
static fn(AccountMeta $meta) => strtolower($meta->name) === strtolower($field)
static fn (AccountMeta $meta) => strtolower($meta->name) === strtolower($field)
);
if (0 === $result->count()) {
return null;

View File

@@ -179,8 +179,8 @@ class CurrencyRepository implements CurrencyRepositoryInterface
$local = $this->get();
return $all->map(static function (TransactionCurrency $current) use ($local) {
$hasId = $local->contains(static fn(TransactionCurrency $entry) => $entry->id === $current->id);
$isNative = $local->contains(static fn(TransactionCurrency $entry) => 1 === (int) $entry->pivot->group_default && $entry->id === $current->id);
$hasId = $local->contains(static fn (TransactionCurrency $entry) => $entry->id === $current->id);
$isNative = $local->contains(static fn (TransactionCurrency $entry) => 1 === (int) $entry->pivot->group_default && $entry->id === $current->id);
$current->userGroupEnabled = $hasId;
$current->userGroupNative = $isNative;

View File

@@ -79,9 +79,9 @@ class WebhookRepository implements WebhookRepositoryInterface, UserGroupInterfac
->where('webhook_messages.errored', 0)
->get(['webhook_messages.*'])
->filter(
static fn(WebhookMessage $message) =>
static fn (WebhookMessage $message)
// @phpstan-ignore-line
$message->webhookAttempts()->count() <= 2
=> $message->webhookAttempts()->count() <= 2
)->splice(0, 3)
;
}

View File

@@ -45,9 +45,7 @@ class BelongsUserGroup implements ValidationRule
/**
* Create a new rule instance.
*/
public function __construct(private readonly UserGroup $userGroup)
{
}
public function __construct(private readonly UserGroup $userGroup) {}
public function validate(string $attribute, mixed $value, \Closure $fail): void
{

View File

@@ -34,9 +34,7 @@ use Illuminate\Contracts\Validation\ValidationRule;
*/
class IsDefaultUserGroupName implements ValidationRule
{
public function __construct(private readonly UserGroup $userGroup)
{
}
public function __construct(private readonly UserGroup $userGroup) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -28,9 +28,7 @@ use Illuminate\Contracts\Validation\ValidationRule;
class IsFilterValueIn implements ValidationRule
{
public function __construct(private readonly string $key, private readonly array $values)
{
}
public function __construct(private readonly string $key, private readonly array $values) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -33,9 +33,7 @@ class IsValidZeroOrMoreAmount implements ValidationRule
{
use ValidatesAmountsTrait;
public function __construct(private bool $nullable = false)
{
}
public function __construct(private bool $nullable = false) {}
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")

View File

@@ -117,7 +117,7 @@ class GroupCloneService
private function cloneNote(Note $note, TransactionJournal $newJournal, int $oldGroupId): void
{
$newNote = $note->replicate();
$newNote->text = sprintf("%s\n\n%s",$newNote->text, trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId]));
$newNote->text = sprintf("%s\n\n%s", $newNote->text, trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId]));
$newNote->noteable_id = $newJournal->id;
$newNote->save();
}

View File

@@ -76,7 +76,7 @@ class CacheProperties
private function hash(): void
{
$content = '';
$content = '';
foreach ($this->properties as $property) {
try {
$content = sprintf('%s%s', $content, \Safe\json_encode($property, JSON_THROW_ON_ERROR));

View File

@@ -203,7 +203,7 @@ class FrontpageChartGenerator
$amount = $limit->native_amount;
Log::debug(sprintf('Amount is now "%s".', $amount));
}
$amount ??= '0';
$amount ??= '0';
$sumSpent = bcmul((string) $entry['sum'], '-1'); // spent
$data[0]['entries'][$title] ??= '0';
$data[1]['entries'][$title] ??= '0';

View File

@@ -71,14 +71,15 @@ class AccountBalanceCalculator
$balances = [];
$count = 0;
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->whereNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
->whereNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
// this order is the same as GroupCollector, but in the exact reverse.
->orderBy('transaction_journals.date', 'asc')
->orderBy('transaction_journals.order', 'desc')
->orderBy('transaction_journals.id', 'asc')
->orderBy('transaction_journals.description', 'asc')
->orderBy('transactions.amount', 'asc');
->orderBy('transaction_journals.date', 'asc')
->orderBy('transaction_journals.order', 'desc')
->orderBy('transaction_journals.id', 'asc')
->orderBy('transaction_journals.description', 'asc')
->orderBy('transactions.amount', 'asc')
;
if ($accounts->count() > 0) {
$query->whereIn('transactions.account_id', $accounts->pluck('id')->toArray());
}
@@ -87,7 +88,7 @@ class AccountBalanceCalculator
$query->where('transaction_journals.date', '>=', $notBefore);
}
$set = $query->get(['transactions.id', 'transactions.balance_dirty', 'transactions.transaction_currency_id', 'transaction_journals.date', 'transactions.account_id', 'transactions.amount']);
$set = $query->get(['transactions.id', 'transactions.balance_dirty', 'transactions.transaction_currency_id', 'transaction_journals.date', 'transactions.account_id', 'transactions.amount']);
Log::debug(sprintf('Counted %d transaction(s)', $set->count()));
// the balance value is an array.
@@ -100,8 +101,8 @@ class AccountBalanceCalculator
$balances[$entry->account_id][$entry->transaction_currency_id] ??= [$this->getLatestBalance($entry->account_id, $entry->transaction_currency_id, $notBefore), null];
// before and after are easy:
$before = $balances[$entry->account_id][$entry->transaction_currency_id][0];
$after = bcadd($before, (string) $entry->amount);
$before = $balances[$entry->account_id][$entry->transaction_currency_id][0];
$after = bcadd($before, (string) $entry->amount);
if (true === $entry->balance_dirty || $accounts->count() > 0) {
// update the transaction:
$entry->balance_before = $before;
@@ -127,17 +128,18 @@ class AccountBalanceCalculator
return '0';
}
Log::debug(sprintf('getLatestBalance: notBefore date is "%s", calculating', $notBefore->format('Y-m-d')));
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->whereNull('transactions.deleted_at')
->where('transaction_journals.transaction_currency_id', $currencyId)
->whereNull('transaction_journals.deleted_at')
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->whereNull('transactions.deleted_at')
->where('transaction_journals.transaction_currency_id', $currencyId)
->whereNull('transaction_journals.deleted_at')
// this order is the same as GroupCollector
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC')
->orderBy('transactions.amount', 'DESC')
->where('transactions.account_id', $accountId);
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC')
->orderBy('transactions.amount', 'DESC')
->where('transactions.account_id', $accountId)
;
$notBefore->startOfDay();
$query->where('transaction_journals.date', '<', $notBefore);
@@ -169,7 +171,7 @@ class AccountBalanceCalculator
*/
foreach ($currencies as $currencyId => $balance) {
/** @var null|TransactionCurrency $currency */
$currency = TransactionCurrency::find($currencyId);
$currency = TransactionCurrency::find($currencyId);
if (null === $currency) {
Log::error(sprintf('Could not find currency #%d, will not save account balance.', $currencyId));
@@ -197,9 +199,9 @@ class AccountBalanceCalculator
public static function recalculateForJournal(TransactionJournal $transactionJournal): void
{
Log::debug(__METHOD__);
$object = new self();
$object = new self();
$set = [];
$set = [];
foreach ($transactionJournal->transactions as $transaction) {
$set[$transaction->account_id] = $transaction->account;
}

View File

@@ -118,7 +118,7 @@ class BillDateCalculator
}
Log::debug('end of loop');
$simple = $set->map( // @phpstan-ignore-line
static fn(Carbon $date) => $date->format('Y-m-d')
static fn (Carbon $date) => $date->format('Y-m-d')
);
Log::debug(sprintf('Found %d pay dates', $set->count()), $simple->toArray());

View File

@@ -2009,7 +2009,7 @@ class OperatorQuerySearch implements SearchInterface
}
app('log')->debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
$filtered = $accounts->filter(
static fn(Account $account) => $stringMethod(strtolower($account->name), strtolower($value))
static fn (Account $account) => $stringMethod(strtolower($account->name), strtolower($value))
);
if (0 === $filtered->count()) {

View File

@@ -138,7 +138,7 @@ class General extends AbstractExtension
{
return new TwigFilter(
'mimeIcon',
static fn(string $string): string => match ($string) {
static fn (string $string): string => match ($string) {
'application/pdf' => 'fa-file-pdf-o',
'image/png', 'image/jpeg', 'image/svg+xml', 'image/heic', 'image/heic-sequence', 'application/vnd.oasis.opendocument.image' => 'fa-file-image-o',
'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'application/x-iwork-pages-sffpages', 'application/vnd.sun.xml.writer', 'application/vnd.sun.xml.writer.template', 'application/vnd.sun.xml.writer.global', 'application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text-template', 'application/vnd.oasis.opendocument.text-web', 'application/vnd.oasis.opendocument.text-master' => 'fa-file-word-o',
@@ -146,7 +146,7 @@ class General extends AbstractExtension
'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.sun.xml.impress', 'application/vnd.sun.xml.impress.template', 'application/vnd.stardivision.impress', 'application/vnd.oasis.opendocument.presentation', 'application/vnd.oasis.opendocument.presentation-template' => 'fa-file-powerpoint-o',
'application/vnd.sun.xml.draw', 'application/vnd.sun.xml.draw.template', 'application/vnd.stardivision.draw', 'application/vnd.oasis.opendocument.chart' => 'fa-paint-brush',
'application/vnd.oasis.opendocument.graphics', 'application/vnd.oasis.opendocument.graphics-template', 'application/vnd.sun.xml.math', 'application/vnd.stardivision.math', 'application/vnd.oasis.opendocument.formula', 'application/vnd.oasis.opendocument.database' => 'fa-calculator',
default => 'fa-file-o',
default => 'fa-file-o',
},
['is_safe' => ['html']]
);
@@ -211,7 +211,7 @@ class General extends AbstractExtension
{
return new TwigFunction(
'phpdate',
static fn(string $str): string => \Safe\date($str)
static fn (string $str): string => \Safe\date($str)
);
}
@@ -373,7 +373,7 @@ class General extends AbstractExtension
{
return new TwigFunction(
'carbonize',
static fn(string $date): Carbon => new Carbon($date, config('app.timezone'))
static fn (string $date): Carbon => new Carbon($date, config('app.timezone'))
);
}
}

View File

@@ -45,7 +45,7 @@ class Rule extends AbstractExtension
{
return new TwigFunction(
'allJournalTriggers',
static fn() => [
static fn () => [
'store-journal' => (string) trans('firefly.rule_trigger_store_journal'),
'update-journal' => (string) trans('firefly.rule_trigger_update_journal'),
'manual-activation' => (string) trans('firefly.rule_trigger_manual'),

View File

@@ -38,7 +38,7 @@ class Translation extends AbstractExtension
return [
new TwigFilter(
'_',
static fn($name) => (string) trans(sprintf('firefly.%s', $name)),
static fn ($name) => (string) trans(sprintf('firefly.%s', $name)),
['is_safe' => ['html']]
),
];

View File

@@ -39,9 +39,7 @@ class AddTag implements ActionInterface
/**
* TriggerInterface constructor.
*/
public function __construct(private readonly RuleAction $action)
{
}
public function __construct(private readonly RuleAction $action) {}
public function actOnArray(array $journal): bool
{

View File

@@ -40,9 +40,7 @@ class AppendDescription implements ActionInterface
/**
* TriggerInterface constructor.
*/
public function __construct(private RuleAction $action)
{
}
public function __construct(private RuleAction $action) {}
public function actOnArray(array $journal): bool
{

View File

@@ -42,9 +42,7 @@ class AppendDescriptionToNotes implements ActionInterface
/**
* TriggerInterface constructor.
*/
public function __construct(private RuleAction $action)
{
}
public function __construct(private RuleAction $action) {}
public function actOnArray(array $journal): bool
{

Some files were not shown because too many files have changed in this diff Show More