mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
Various code cleanup.
This commit is contained in:
@@ -91,7 +91,7 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
'timeout' => 3.1415,
|
||||
];
|
||||
$res = $client->request('GET', $uri, $options);
|
||||
} catch (GuzzleException | Exception $e) {
|
||||
} catch (GuzzleException $e) {
|
||||
Log::error('Ran into Guzzle error.');
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
@@ -111,7 +111,7 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
try {
|
||||
$json = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
} catch (JsonException | Exception $e) {
|
||||
} catch (JsonException $e) {
|
||||
Log::error('Body is not valid JSON');
|
||||
Log::error($body);
|
||||
$return['message'] = 'Invalid JSON :(';
|
||||
@@ -119,7 +119,7 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (!isset($json['firefly_iii'][$channel])) {
|
||||
if (!array_key_exists($channel, $json['firefly_iii'])) {
|
||||
Log::error(sprintf('No valid update channel "%s"', $channel));
|
||||
Log::error($body);
|
||||
$return['message'] = sprintf('Unknown update channel "%s" :(', $channel);
|
||||
|
||||
@@ -69,8 +69,8 @@ class AccountDestroyService
|
||||
// delete account.
|
||||
try {
|
||||
$account->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::error(sprintf('Could not delete account: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class AccountDestroyService
|
||||
|
||||
$collection = Transaction::groupBy('transaction_journal_id', 'account_id')
|
||||
->where('account_id', $moveTo->id)
|
||||
->get(['transaction_journal_id', 'account_id', DB::raw('count(*) as the_count')]);
|
||||
->get(['transaction_journal_id', 'account_id', DB::raw('count(*) as the_count')]); // @phpstan-ignore-line
|
||||
if (0 === $collection->count()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ class BillDestroyService
|
||||
{
|
||||
try {
|
||||
$bill->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::error(sprintf('Could not delete bill: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ class BudgetDestroyService
|
||||
|
||||
try {
|
||||
$budget->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::error(sprintf('Could not delete budget: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
|
||||
// also delete auto budget:
|
||||
|
||||
@@ -42,8 +42,8 @@ class CategoryDestroyService
|
||||
{
|
||||
try {
|
||||
$category->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::error(sprintf('Could not delete category: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
|
||||
// also delete all relations between categories and transaction journals:
|
||||
|
||||
@@ -42,8 +42,8 @@ class CurrencyDestroyService
|
||||
|
||||
try {
|
||||
$currency->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::error(sprintf('Could not delete transaction currency: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ class JournalDestroyService
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
Log::error(sprintf('Could not delete bill: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ class RecurrenceDestroyService
|
||||
try {
|
||||
// delete all meta data
|
||||
$recurrence->recurrenceMeta()->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::info(sprintf('Could not delete recurrence meta: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
// delete all transactions.
|
||||
/** @var RecurrenceTransaction $transaction */
|
||||
@@ -69,8 +69,8 @@ class RecurrenceDestroyService
|
||||
$transaction->recurrenceTransactionMeta()->delete();
|
||||
try {
|
||||
$transaction->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::info(sprintf('Could not delete recurrence transaction: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
// delete all repetitions
|
||||
@@ -79,8 +79,8 @@ class RecurrenceDestroyService
|
||||
// delete recurrence
|
||||
try {
|
||||
$recurrence->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::info(sprintf('Could not delete recurrence: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,8 +162,8 @@ trait AccountServiceTrait
|
||||
if (null !== $dbNote) {
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::debug($e->getMessage());
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user