Various code cleanup.

This commit is contained in:
James Cole
2025-10-05 12:57:58 +02:00
parent 072212c112
commit 6341743cf9
169 changed files with 482 additions and 305 deletions

View File

@@ -155,9 +155,7 @@ trait AccountServiceTrait
{
$dbNote = $account->notes()->first();
if ('' === $note) {
if (null !== $dbNote) {
$dbNote->delete();
}
$dbNote?->delete();
return true;
}
@@ -342,7 +340,6 @@ trait AccountServiceTrait
}
/**
* @throws FireflyException
*/
protected function getCurrency(int $currencyId, string $currencyCode): TransactionCurrency
{
@@ -377,7 +374,7 @@ trait AccountServiceTrait
throw new FireflyException('Amount for update liability credit/debit was unexpectedly 0.');
}
// if direction is "debit" (i owe this debt), amount is negative.
// if direction is "debit" (I owe this debt), amount is negative.
// which means the liability will have a negative balance which the user must fill.
$openingBalance = app('steam')->negative($openingBalance);

View File

@@ -56,9 +56,7 @@ trait BillServiceTrait
{
if ('' === $note) {
$dbNote = $bill->notes()->first();
if (null !== $dbNote) {
$dbNote->delete();
}
$dbNote?->delete();
return true;
}

View File

@@ -39,6 +39,7 @@ use FireflyIII\Rules\UniqueIban;
use FireflyIII\Support\NullArrayObject;
use Illuminate\Support\Facades\Log;
use Safe\Exceptions\JsonException;
use function Safe\json_encode;
/**
@@ -265,7 +266,13 @@ trait JournalServiceTrait
}
/**
* @param Account|null $account
* @param array $data
* @param string $preferredType
*
* @return Account|null
* @throws FireflyException
* @throws JsonException
*/
private function createAccount(?Account $account, array $data, string $preferredType): ?Account
{

View File

@@ -54,9 +54,7 @@ trait RecurringTransactionTrait
{
if ('' === $note) {
$dbNote = $recurrence->notes()->first();
if (null !== $dbNote) {
$dbNote->delete();
}
$dbNote?->delete();
return true;
}