mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-26 05:26:17 +00:00
Fix phpstan messages.
This commit is contained in:
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Services\Internal\Destroy;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Models\RecurrenceTransaction;
|
||||
@@ -68,11 +67,7 @@ class AccountDestroyService
|
||||
// delete account meta:
|
||||
$account->accountMeta()->delete();
|
||||
// delete account.
|
||||
try {
|
||||
$account->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$account->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,10 +37,6 @@ class BillDestroyService
|
||||
*/
|
||||
public function destroy(Bill $bill): void
|
||||
{
|
||||
try {
|
||||
$bill->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,7 @@ class BudgetDestroyService
|
||||
*/
|
||||
public function destroy(Budget $budget): void
|
||||
{
|
||||
try {
|
||||
$budget->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
|
||||
// also delete auto budget:
|
||||
foreach ($budget->autoBudgets()->get() as $autoBudget) {
|
||||
|
||||
@@ -39,11 +39,7 @@ class CategoryDestroyService
|
||||
*/
|
||||
public function destroy(Category $category): void
|
||||
{
|
||||
try {
|
||||
$category->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
|
||||
// also delete all relations between categories and transaction journals:
|
||||
DB::table('category_transaction_journal')->where('category_id', (int)$category->id)->delete();
|
||||
|
||||
@@ -38,10 +38,6 @@ class CurrencyDestroyService
|
||||
*/
|
||||
public function destroy(TransactionCurrency $currency): void
|
||||
{
|
||||
try {
|
||||
$currency->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Services\Internal\Destroy;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
@@ -43,61 +42,57 @@ class JournalDestroyService
|
||||
*/
|
||||
public function destroy(TransactionJournal $journal): void
|
||||
{
|
||||
try {
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($journal->transactions()->get() as $transaction) {
|
||||
Log::debug(sprintf('Will now delete transaction #%d', $transaction->id));
|
||||
$transaction->delete();
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($journal->transactions()->get() as $transaction) {
|
||||
Log::debug(sprintf('Will now delete transaction #%d', $transaction->id));
|
||||
$transaction->delete();
|
||||
}
|
||||
|
||||
// also delete journal_meta entries.
|
||||
/** @var TransactionJournalMeta $meta */
|
||||
foreach ($journal->transactionJournalMeta()->get() as $meta) {
|
||||
Log::debug(sprintf('Will now delete meta-entry #%d', $meta->id));
|
||||
$meta->delete();
|
||||
}
|
||||
|
||||
// also delete attachments.
|
||||
/** @var Attachment $attachment */
|
||||
foreach ($journal->attachments()->get() as $attachment) {
|
||||
$attachment->delete();
|
||||
}
|
||||
|
||||
// delete all from 'budget_transaction_journal'
|
||||
DB::table('budget_transaction_journal')
|
||||
->where('transaction_journal_id', $journal->id)->delete();
|
||||
|
||||
// delete all from 'category_transaction_journal'
|
||||
DB::table('category_transaction_journal')
|
||||
->where('transaction_journal_id', $journal->id)->delete();
|
||||
|
||||
// delete all from 'tag_transaction_journal'
|
||||
DB::table('tag_transaction_journal')
|
||||
->where('transaction_journal_id', $journal->id)->delete();
|
||||
|
||||
// delete all links:
|
||||
TransactionJournalLink::where('source_id', $journal->id)->delete();
|
||||
TransactionJournalLink::where('destination_id', $journal->id)->delete();
|
||||
|
||||
// delete all notes
|
||||
$journal->notes()->delete();
|
||||
|
||||
// update events
|
||||
// TODO move to repository
|
||||
$journal->piggyBankEvents()->update(['transaction_journal_id' => null]);
|
||||
|
||||
$journal->delete();
|
||||
|
||||
// delete group, if group is empty:
|
||||
$group = $journal->transactionGroup;
|
||||
if (null !== $group) {
|
||||
$count = $group->transactionJournals->count();
|
||||
if (0 === $count) {
|
||||
$group->delete();
|
||||
}
|
||||
|
||||
// also delete journal_meta entries.
|
||||
/** @var TransactionJournalMeta $meta */
|
||||
foreach ($journal->transactionJournalMeta()->get() as $meta) {
|
||||
Log::debug(sprintf('Will now delete meta-entry #%d', $meta->id));
|
||||
$meta->delete();
|
||||
}
|
||||
|
||||
// also delete attachments.
|
||||
/** @var Attachment $attachment */
|
||||
foreach ($journal->attachments()->get() as $attachment) {
|
||||
$attachment->delete();
|
||||
}
|
||||
|
||||
// delete all from 'budget_transaction_journal'
|
||||
DB::table('budget_transaction_journal')
|
||||
->where('transaction_journal_id', $journal->id)->delete();
|
||||
|
||||
// delete all from 'category_transaction_journal'
|
||||
DB::table('category_transaction_journal')
|
||||
->where('transaction_journal_id', $journal->id)->delete();
|
||||
|
||||
// delete all from 'tag_transaction_journal'
|
||||
DB::table('tag_transaction_journal')
|
||||
->where('transaction_journal_id', $journal->id)->delete();
|
||||
|
||||
// delete all links:
|
||||
TransactionJournalLink::where('source_id', $journal->id)->delete();
|
||||
TransactionJournalLink::where('destination_id', $journal->id)->delete();
|
||||
|
||||
// delete all notes
|
||||
$journal->notes()->delete();
|
||||
|
||||
// update events
|
||||
// TODO move to repository
|
||||
$journal->piggyBankEvents()->update(['transaction_journal_id' => null]);
|
||||
|
||||
$journal->delete();
|
||||
|
||||
// delete group, if group is empty:
|
||||
$group = $journal->transactionGroup;
|
||||
if (null !== $group) {
|
||||
$count = $group->transactionJournals->count();
|
||||
if (0 === $count) {
|
||||
$group->delete();
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Internal\Destroy;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Models\RecurrenceTransaction;
|
||||
|
||||
@@ -55,30 +54,18 @@ class RecurrenceDestroyService
|
||||
*/
|
||||
public function destroy(Recurrence $recurrence): void
|
||||
{
|
||||
try {
|
||||
// delete all meta data
|
||||
$recurrence->recurrenceMeta()->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
// delete all meta data
|
||||
$recurrence->recurrenceMeta()->delete();
|
||||
// delete all transactions.
|
||||
/** @var RecurrenceTransaction $transaction */
|
||||
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
||||
$transaction->recurrenceTransactionMeta()->delete();
|
||||
try {
|
||||
$transaction->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$transaction->delete();
|
||||
}
|
||||
// delete all repetitions
|
||||
$recurrence->recurrenceRepetitions()->delete();
|
||||
|
||||
// delete recurrence
|
||||
try {
|
||||
$recurrence->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$recurrence->delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Internal\Destroy;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Events\DestroyedTransactionGroup;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
|
||||
@@ -44,11 +43,7 @@ class TransactionGroupDestroyService
|
||||
foreach ($transactionGroup->transactionJournals as $journal) {
|
||||
$service->destroy($journal);
|
||||
}
|
||||
try {
|
||||
$transactionGroup->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$transactionGroup->delete();
|
||||
// trigger just after destruction
|
||||
event(new DestroyedTransactionGroup($transactionGroup));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Services\Internal\Support;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\DuplicateTransactionException;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\AccountMetaFactory;
|
||||
@@ -173,11 +172,7 @@ trait AccountServiceTrait
|
||||
if ('' === $note) {
|
||||
$dbNote = $account->notes()->first();
|
||||
if (null !== $dbNote) {
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$dbNote->delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Internal\Support;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
@@ -70,11 +69,7 @@ trait BillServiceTrait
|
||||
if ('' === $note) {
|
||||
$dbNote = $bill->notes()->first();
|
||||
if (null !== $dbNote) {
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$dbNote->delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Internal\Support;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\AccountMetaFactory;
|
||||
use FireflyIII\Factory\TagFactory;
|
||||
@@ -395,11 +394,7 @@ trait JournalServiceTrait
|
||||
}
|
||||
if ('' === $notes && null !== $note) {
|
||||
// try to delete existing notes.
|
||||
try {
|
||||
$note->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$note->delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,11 +61,7 @@ trait RecurringTransactionTrait
|
||||
if ('' === $note) {
|
||||
$dbNote = $recurrence->notes()->first();
|
||||
if (null !== $dbNote) {
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -376,11 +372,9 @@ trait RecurringTransactionTrait
|
||||
/** @var RecurrenceTransaction $transaction */
|
||||
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
||||
$transaction->recurrenceTransactionMeta()->delete();
|
||||
try {
|
||||
|
||||
$transaction->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,11 +153,9 @@ class CategoryUpdateService
|
||||
if ('' === $note) {
|
||||
$dbNote = $category->notes()->first();
|
||||
if (null !== $dbNote) {
|
||||
try {
|
||||
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Services\Internal\Update;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidDateException;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\TagFactory;
|
||||
@@ -652,9 +653,8 @@ class JournalUpdateService
|
||||
if ($this->hasFields([$field])) {
|
||||
try {
|
||||
$value = '' === (string)$this->data[$field] ? null : new Carbon($this->data[$field]);
|
||||
} catch (Exception $e) {
|
||||
} catch (InvalidDateException $e) {
|
||||
Log::debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
|
||||
|
||||
@@ -132,11 +132,7 @@ class RecurrenceUpdateService
|
||||
return;
|
||||
}
|
||||
if (null !== $dbNote && '' === $text) {
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Log;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class PwndVerifierV2.
|
||||
@@ -73,12 +72,7 @@ class PwndVerifierV2 implements Verifier
|
||||
if (404 === $res->getStatusCode()) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
$strpos = stripos($res->getBody()->getContents(), $rest);
|
||||
} catch (RuntimeException $e) {
|
||||
Log::error(sprintf('Could not get body from Pwnd result: %s', $e->getMessage()));
|
||||
$strpos = false;
|
||||
}
|
||||
$strpos = stripos($res->getBody()->getContents(), $rest);
|
||||
if (false === $strpos) {
|
||||
Log::debug(sprintf('%s was not found in result body. Return true.', $rest));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user