mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Replace phpstan suggestions
This commit is contained in:
@@ -158,7 +158,7 @@ class AccountFactory
|
||||
}
|
||||
}
|
||||
if (null === $result) {
|
||||
Log::warning(sprintf('Found NO account type based on %d and "%s"', $accountTypeId, $accountTypeName));
|
||||
app('log')->warning(sprintf('Found NO account type based on %d and "%s"', $accountTypeId, $accountTypeName));
|
||||
throw new FireflyException(sprintf('AccountFactory::create() was unable to find account type #%d ("%s").', $accountTypeId, $accountTypeName));
|
||||
}
|
||||
Log::debug(sprintf('Found account type based on %d and "%s": "%s"', $accountTypeId, $accountTypeName, $result->type));
|
||||
|
@@ -47,7 +47,7 @@ class TransactionCurrencyFactory
|
||||
if (1 === $count) {
|
||||
$old = TransactionCurrency::withTrashed()->whereCode($data['code'])->first();
|
||||
$old->forceDelete();
|
||||
Log::warning(sprintf('Force deleted old currency with ID #%d and code "%s".', $old->id, $data['code']));
|
||||
app('log')->warning(sprintf('Force deleted old currency with ID #%d and code "%s".', $old->id, $data['code']));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -93,7 +93,7 @@ class TransactionCurrencyFactory
|
||||
if (null !== $currency) {
|
||||
return $currency;
|
||||
}
|
||||
Log::warning(sprintf('Currency ID is %d but found nothing!', $currencyId));
|
||||
app('log')->warning(sprintf('Currency ID is %d but found nothing!', $currencyId));
|
||||
}
|
||||
// then by code:
|
||||
if ('' !== $currencyCode) {
|
||||
@@ -101,9 +101,9 @@ class TransactionCurrencyFactory
|
||||
if (null !== $currency) {
|
||||
return $currency;
|
||||
}
|
||||
Log::warning(sprintf('Currency code is %d but found nothing!', $currencyCode));
|
||||
app('log')->warning(sprintf('Currency code is %d but found nothing!', $currencyCode));
|
||||
}
|
||||
Log::warning('Found nothing for currency.');
|
||||
app('log')->warning('Found nothing for currency.');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ class TransactionGroupFactory
|
||||
try {
|
||||
$collection = $this->journalFactory->create($data);
|
||||
} catch (DuplicateTransactionException $e) {
|
||||
Log::warning('GroupFactory::create() caught journalFactory::create() with a duplicate!');
|
||||
app('log')->warning('GroupFactory::create() caught journalFactory::create() with a duplicate!');
|
||||
throw new DuplicateTransactionException($e->getMessage(), 0, $e);
|
||||
}
|
||||
$title = $data['group_title'] ?? null;
|
||||
|
@@ -126,13 +126,13 @@ class TransactionJournalFactory
|
||||
}
|
||||
}
|
||||
} catch (DuplicateTransactionException $e) {
|
||||
Log::warning('TransactionJournalFactory::create() caught a duplicate journal in createJournal()');
|
||||
app('log')->warning('TransactionJournalFactory::create() caught a duplicate journal in createJournal()');
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
$this->forceDeleteOnError($collection);
|
||||
throw new DuplicateTransactionException($e->getMessage(), 0, $e);
|
||||
} catch (FireflyException $e) {
|
||||
Log::warning('TransactionJournalFactory::create() caught an exception.');
|
||||
app('log')->warning('TransactionJournalFactory::create() caught an exception.');
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
$this->forceDeleteOnError($collection);
|
||||
@@ -267,7 +267,7 @@ class TransactionJournalFactory
|
||||
Log::error('Exception creating positive transaction.');
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
Log::warning('Delete negative transaction.');
|
||||
app('log')->warning('Delete negative transaction.');
|
||||
$this->forceTrDelete($negative);
|
||||
$this->forceDeleteOnError(new Collection([$journal]));
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
@@ -345,7 +345,7 @@ class TransactionJournalFactory
|
||||
->first();
|
||||
}
|
||||
if (null !== $result) {
|
||||
Log::warning(sprintf('Found a duplicate in errorIfDuplicate because hash %s is not unique!', $hash));
|
||||
app('log')->warning(sprintf('Found a duplicate in errorIfDuplicate because hash %s is not unique!', $hash));
|
||||
$journal = $result->transactionJournal()->withTrashed()->first();
|
||||
$group = $journal?->transactionGroup()->withTrashed()->first();
|
||||
$groupId = $group?->id;
|
||||
|
Reference in New Issue
Block a user