mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 06:01:21 +00:00
Various code cleanup and phpstan suggestions
This commit is contained in:
@@ -153,7 +153,7 @@ class AccountFactory
|
||||
// try with type:
|
||||
if (null === $result) {
|
||||
$types = config(sprintf('firefly.accountTypeByIdentifier.%s', $accountTypeName)) ?? [];
|
||||
if (!empty($types)) {
|
||||
if (0 !== count($types)) {
|
||||
$result = AccountType::whereIn('type', $types)->first();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Factory;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountMeta;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ class AccountMetaFactory
|
||||
if ('' === $value && null !== $entry) {
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch (QueryException $e) {
|
||||
Log::debug(sprintf('Could not delete entry: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ use FireflyIII\Services\Internal\Support\JournalServiceTrait;
|
||||
use FireflyIII\Support\NullArrayObject;
|
||||
use FireflyIII\User;
|
||||
use FireflyIII\Validation\AccountValidator;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Collection;
|
||||
use JsonException;
|
||||
use Log;
|
||||
@@ -108,7 +109,7 @@ class TransactionJournalFactory
|
||||
Log::debug('Start of TransactionJournalFactory::create()');
|
||||
$collection = new Collection();
|
||||
$transactions = $dataObject['transactions'] ?? [];
|
||||
if (empty($transactions)) {
|
||||
if (0 === count($transactions)) {
|
||||
Log::error('There are no transactions in the array, the TransactionJournalFactory cannot continue.');
|
||||
|
||||
return new Collection();
|
||||
@@ -510,7 +511,7 @@ class TransactionJournalFactory
|
||||
{
|
||||
try {
|
||||
$transaction->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
Log::error('Could not delete negative transaction.');
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace FireflyIII\Factory;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Models\TransactionJournalMeta;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -48,7 +49,7 @@ class TransactionJournalMetaFactory
|
||||
//Log::debug('Value is empty, delete meta value.');
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch (QueryException $e) {
|
||||
Log::error(sprintf('Could not delete transaction journal meta: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ class TransactionJournalMetaFactory
|
||||
Log::debug('Will not store empty strings, delete meta value');
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch (QueryException $e) {
|
||||
Log::error(sprintf('Could not delete transaction journal meta: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user