mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix phpstan messages.
This commit is contained in:
parent
ee0116f112
commit
445804a7f1
@ -10,6 +10,11 @@ parameters:
|
||||
- '#is neither abstract nor final#'
|
||||
- '#has a nullable return type declaration#'
|
||||
- '#with a nullable type declaration#'
|
||||
- '#with null as default value#'
|
||||
-
|
||||
message: '#but containers should not be injected#'
|
||||
paths:
|
||||
- ../app/Support/Authentication/RemoteUserGuard.php
|
||||
-
|
||||
message: '#Control structures using switch should not be used.#'
|
||||
paths:
|
||||
@ -18,6 +23,17 @@ parameters:
|
||||
- ../app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
|
||||
- ../app/Exceptions/GracefulNotFoundHandler.php
|
||||
- ../app/Generator/Webhook/StandardMessageGenerator.php
|
||||
- ../app/Support/Amount.php
|
||||
- ../app/Support/Navigation.php
|
||||
- ../app/Support/ParseDateString.php
|
||||
- ../app/Support/Search/AccountSearch.php
|
||||
- ../app/Support/Search/OperatorQuerySearch.php
|
||||
- ../app/Support/Twig/General.php
|
||||
- ../app/Transformers/RecurrenceTransformer.php
|
||||
- ../app/Validation/AccountValidator.php
|
||||
- ../app/Validation/RecurrenceValidation.php
|
||||
- ../app/Validation/TransactionValidation.php
|
||||
|
||||
-
|
||||
message: '#Function compact\(\) should not be used#'
|
||||
paths:
|
||||
@ -32,12 +48,21 @@ parameters:
|
||||
- ../app/Http/Controllers/Account/*.php
|
||||
- ../app/Http/Controllers/Admin/*.php
|
||||
- ../app/Http/Controllers/*.php
|
||||
- ../app/Support/ExpandedForm.php
|
||||
- ../app/Support/Form/AccountForm.php
|
||||
- ../app/Support/Form/CurrencyForm.php
|
||||
- ../app/Support/Form/FormSupport.php
|
||||
-
|
||||
message: '#Either catch a more specific exception#'
|
||||
paths:
|
||||
- ../app/Support/Form/FormSupport.php
|
||||
|
||||
paths:
|
||||
- ../app
|
||||
- ../database
|
||||
- ../routes
|
||||
- ../config
|
||||
- ../bootstrap/app.php
|
||||
|
||||
# The level 8 is the highest level. original was 5
|
||||
level: 1
|
||||
level: 2
|
||||
|
@ -251,7 +251,7 @@ class UserEventHandler
|
||||
|
||||
try {
|
||||
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $url));
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
@ -275,7 +275,7 @@ class UserEventHandler
|
||||
$url = route('profile.undo-email-change', [$token->data, $hashed]);
|
||||
try {
|
||||
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $url));
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
@ -301,7 +301,7 @@ class UserEventHandler
|
||||
$url = route('invite', [$event->invitee->invite_code]);
|
||||
try {
|
||||
Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url));
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$result['date']->setTimezone(config('app.timezone'));
|
||||
$result['created_at']->setTimezone(config('app.timezone'));
|
||||
$result['updated_at']->setTimezone(config('app.timezone'));
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ class DebugController extends Controller
|
||||
Log::debug('Call twig:clean...');
|
||||
try {
|
||||
Artisan::call('twig:clean');
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
Log::debug('Call view:clear...');
|
||||
@ -186,11 +186,7 @@ class DebugController extends Controller
|
||||
if ($handler instanceof RotatingFileHandler) {
|
||||
$logFile = $handler->getUrl();
|
||||
if (null !== $logFile) {
|
||||
try {
|
||||
$logContent = file_get_contents($logFile);
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
$logContent = file_get_contents($logFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ class InstallController extends Controller
|
||||
Artisan::call($command, $args);
|
||||
Log::debug(Artisan::output());
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
// clear cache as well.
|
||||
|
@ -155,7 +155,7 @@ class ReportFormRequest extends FormRequest
|
||||
if (preg_match($pattern, $string)) {
|
||||
try {
|
||||
$date = new Carbon($parts[1]);
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
||||
Log::error($error);
|
||||
throw new FireflyException($error, 0, $e);
|
||||
@ -189,7 +189,7 @@ class ReportFormRequest extends FormRequest
|
||||
if (preg_match($pattern, $string)) {
|
||||
try {
|
||||
$date = new Carbon($parts[0]);
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
||||
Log::error($error);
|
||||
throw new FireflyException($error, 0, $e);
|
||||
|
@ -90,7 +90,7 @@ class MailError extends Job implements ShouldQueue
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,6 @@ use FireflyIII\Helpers\Attachments\AttachmentHelper;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Helpers\Fiscal\FiscalHelper;
|
||||
use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;
|
||||
use FireflyIII\Helpers\Help\Help;
|
||||
use FireflyIII\Helpers\Help\HelpInterface;
|
||||
use FireflyIII\Helpers\Report\NetWorth;
|
||||
use FireflyIII\Helpers\Report\NetWorthInterface;
|
||||
use FireflyIII\Helpers\Report\PopupReport;
|
||||
@ -217,7 +215,6 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
|
||||
// more generators:
|
||||
$this->app->bind(PopupReportInterface::class, PopupReport::class);
|
||||
$this->app->bind(HelpInterface::class, Help::class);
|
||||
$this->app->bind(ReportHelperInterface::class, ReportHelper::class);
|
||||
$this->app->bind(FiscalHelperInterface::class, FiscalHelper::class);
|
||||
$this->app->bind(UpdateRequestInterface::class, UpdateRequest::class);
|
||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Repositories\Budget;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\TransactionCurrencyFactory;
|
||||
use FireflyIII\Models\Budget;
|
||||
@ -124,11 +123,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
*/
|
||||
public function destroyBudgetLimit(BudgetLimit $budgetLimit): void
|
||||
{
|
||||
try {
|
||||
$budgetLimit->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$budgetLimit->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -424,11 +419,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
// 1 if the left_operand is larger than the right_operand, -1 otherwise.
|
||||
if (null !== $limit && bccomp($amount, '0') <= 0) {
|
||||
Log::debug(sprintf('%s is zero, delete budget limit #%d', $amount, $limit->id));
|
||||
try {
|
||||
$limit->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$limit->delete();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -207,11 +207,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
public function cleanupBudgets(): bool
|
||||
{
|
||||
// delete limits with amount 0:
|
||||
try {
|
||||
BudgetLimit::where('amount', 0)->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
BudgetLimit::where('amount', 0)->delete();
|
||||
$budgets = $this->getActiveBudgets();
|
||||
/**
|
||||
* @var int $index
|
||||
@ -335,11 +331,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
return;
|
||||
}
|
||||
if (null !== $dbNote) {
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
'entries' => [],
|
||||
];
|
||||
$date = $journal['date']->format($carbonFormat);
|
||||
$data[$key]['entries'][$date] = bcadd($data[$budgetId]['entries'][$date] ?? '0', $journal['amount']);
|
||||
$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date] ?? '0', $journal['amount']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Repositories\Journal;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use Exception;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use FireflyIII\User;
|
||||
@ -124,28 +123,15 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
|
||||
|
||||
if ($cache->has()) {
|
||||
$result = null;
|
||||
try {
|
||||
$result = new Carbon($cache->get());
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
|
||||
return $result;
|
||||
return new Carbon($cache->get());
|
||||
}
|
||||
|
||||
$entry = $journal->transactionJournalMeta()->where('name', $field)->first();
|
||||
if (null === $entry) {
|
||||
return null;
|
||||
}
|
||||
$value = null;
|
||||
try {
|
||||
$value = new Carbon($entry->data);
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
if (null !== $value) {
|
||||
$cache->store($value);
|
||||
}
|
||||
$value = new Carbon($entry->data);
|
||||
$cache->store($value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
@ -185,11 +171,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
|
||||
|
||||
// return when something else:
|
||||
$return = (string)$value;
|
||||
try {
|
||||
$cache->store($return);
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
$cache->store($return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -331,13 +331,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
|
||||
|
||||
return;
|
||||
}
|
||||
if (null !== $dbNote && '' === $text) {
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
$dbNote?->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -339,13 +339,7 @@ trait ModifiesPiggyBanks
|
||||
{
|
||||
if ('' === $note) {
|
||||
$dbNote = $piggyBank->notes()->first();
|
||||
if (null !== $dbNote) {
|
||||
try {
|
||||
$dbNote->delete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
$dbNote?->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -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));
|
||||
|
||||
|
@ -124,9 +124,9 @@ class RemoteUserGuard implements Guard
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function hasUser()
|
||||
public function hasUser(): bool
|
||||
{
|
||||
// TODO: Implement hasUser() method.
|
||||
throw new FireflyException(sprintf('%s is not implemented', __METHOD__));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Binder;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Carbon\Exceptions\InvalidDateException;
|
||||
use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;
|
||||
use Illuminate\Routing\Route;
|
||||
use Log;
|
||||
@ -72,9 +72,10 @@ class Date implements BinderInterface
|
||||
|
||||
try {
|
||||
$result = new Carbon($value);
|
||||
} catch (Exception $e) {
|
||||
Log::error(sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage()));
|
||||
throw new NotFoundHttpException();
|
||||
} catch (InvalidDateException $e) {
|
||||
$message = sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage());
|
||||
Log::error($message);
|
||||
throw new NotFoundHttpException($message, $e);
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@ -53,6 +53,7 @@ use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use League\Csv\CannotInsertRecord;
|
||||
use League\Csv\Exception;
|
||||
use League\Csv\Writer;
|
||||
@ -206,7 +207,8 @@ class ExportDataGenerator
|
||||
|
||||
try {
|
||||
$string = $csv->toString();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
@ -280,7 +282,8 @@ class ExportDataGenerator
|
||||
|
||||
try {
|
||||
$string = $csv->toString();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
@ -344,7 +347,8 @@ class ExportDataGenerator
|
||||
|
||||
try {
|
||||
$string = $csv->toString();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
@ -392,7 +396,8 @@ class ExportDataGenerator
|
||||
|
||||
try {
|
||||
$string = $csv->toString();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
@ -469,7 +474,8 @@ class ExportDataGenerator
|
||||
|
||||
try {
|
||||
$string = $csv->toString();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
@ -630,7 +636,8 @@ class ExportDataGenerator
|
||||
|
||||
try {
|
||||
$string = $csv->toString();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
@ -758,7 +765,8 @@ class ExportDataGenerator
|
||||
|
||||
try {
|
||||
$string = $csv->toString();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
@ -810,7 +818,8 @@ class ExportDataGenerator
|
||||
|
||||
try {
|
||||
$string = $csv->toString();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
@ -952,7 +961,8 @@ class ExportDataGenerator
|
||||
|
||||
try {
|
||||
$string = $csv->toString();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
Log::error($e->getMessage());
|
||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
@ -1072,4 +1082,20 @@ class ExportDataGenerator
|
||||
{
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function has(mixed $key): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Configuration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class FireflyConfig.
|
||||
@ -45,11 +46,7 @@ class FireflyConfig
|
||||
if (Cache::has($fullName)) {
|
||||
Cache::forget($fullName);
|
||||
}
|
||||
try {
|
||||
Configuration::where('name', $name)->forceDelete();
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,7 +77,7 @@ class FireflyConfig
|
||||
/** @var Configuration|null $config */
|
||||
$config = Configuration::where('name', $name)->first(['id', 'name', 'data']);
|
||||
} catch (QueryException|Exception $e) {
|
||||
throw new FireflyException(sprintf('Could not poll the database: %s', $e->getMessage()));
|
||||
throw new FireflyException(sprintf('Could not poll the database: %s', $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
if (null !== $config) {
|
||||
@ -106,7 +103,8 @@ class FireflyConfig
|
||||
{
|
||||
try {
|
||||
$config = Configuration::whereName($name)->whereNull('deleted_at')->first();
|
||||
} catch (QueryException|Exception $e) {
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e->getMessage());
|
||||
$item = new Configuration();
|
||||
$item->name = $name;
|
||||
$item->data = $value;
|
||||
|
@ -24,11 +24,10 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Form;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Carbon\Exceptions\InvalidDateException;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Log;
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
@ -130,13 +129,8 @@ trait FormSupport
|
||||
$value = array_key_exists($name, $preFilled) && null === $value ? $preFilled[$name] : $value;
|
||||
}
|
||||
|
||||
try {
|
||||
if (null !== request()->old($name)) {
|
||||
$value = request()->old($name);
|
||||
}
|
||||
} catch (RuntimeException $e) {
|
||||
// don't care about session errors.
|
||||
Log::debug(sprintf('Run time: %s', $e->getMessage()));
|
||||
if (null !== request()->old($name)) {
|
||||
$value = request()->old($name);
|
||||
}
|
||||
|
||||
if ($value instanceof Carbon) {
|
||||
@ -163,8 +157,8 @@ trait FormSupport
|
||||
$date = null;
|
||||
try {
|
||||
$date = today(config('app.timezone'));
|
||||
} catch (Exception $e) {
|
||||
// @ignoreException
|
||||
} catch (InvalidDateException $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
|
||||
return $date;
|
||||
|
@ -415,7 +415,7 @@ trait PeriodOverview
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$first = $this->journalRepos->firstNull();
|
||||
$start = null === $first ? new Carbon() : $first->date;
|
||||
$end = $theDate ?? today(config('app.timezone'));
|
||||
$end = clone $theDate;
|
||||
|
||||
Log::debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d')));
|
||||
Log::debug(sprintf('End for getNoCategoryPeriodOverview() is %s', $end->format('Y-m-d')));
|
||||
|
@ -654,17 +654,17 @@ class Navigation
|
||||
|
||||
return $fiscalHelper->endOfFiscalYear($end);
|
||||
}
|
||||
switch ($range) {
|
||||
default:
|
||||
break;
|
||||
case 'last7':
|
||||
case 'last30':
|
||||
case 'last90':
|
||||
case 'last365':
|
||||
case 'YTD':
|
||||
case 'QTD':
|
||||
case 'MTD':
|
||||
return $end;
|
||||
$list = [
|
||||
'last7',
|
||||
'last30',
|
||||
'last90',
|
||||
'last365',
|
||||
'YTD',
|
||||
'QTD',
|
||||
'MTD',
|
||||
];
|
||||
if (in_array($range, $list, true)) {
|
||||
return $end;
|
||||
}
|
||||
|
||||
throw new FireflyException(sprintf('updateEndDate cannot handle range "%s"', $range));
|
||||
|
@ -40,6 +40,7 @@ class NullArrayObject extends ArrayObject
|
||||
* @param array $array
|
||||
* @param null $default
|
||||
*/
|
||||
/* @phpstan-ignore-next-line */
|
||||
public function __construct(array $array, $default = null)
|
||||
{
|
||||
parent::__construct($array);
|
||||
@ -49,9 +50,9 @@ class NullArrayObject extends ArrayObject
|
||||
/**
|
||||
* @param mixed $key
|
||||
*
|
||||
* @return mixed|null
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($key)
|
||||
public function offsetGet($key): mixed
|
||||
{
|
||||
if ($this->offsetExists($key)) {
|
||||
return parent::offsetGet($key);
|
||||
|
@ -85,11 +85,7 @@ class Preferences
|
||||
{
|
||||
$preference = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'user_id', 'name', 'data', 'updated_at', 'created_at']);
|
||||
if (null !== $preference && null === $preference->data) {
|
||||
try {
|
||||
$preference->delete();
|
||||
} catch (Exception $e) {
|
||||
throw new FireflyException(sprintf('Could not delete preference #%d: %s', $preference->id, $e->getMessage()), 0, $e);
|
||||
}
|
||||
$preference->delete();
|
||||
$preference = null;
|
||||
}
|
||||
|
||||
@ -117,11 +113,7 @@ class Preferences
|
||||
if (Cache::has($fullName)) {
|
||||
Cache::forget($fullName);
|
||||
}
|
||||
try {
|
||||
Preference::where('user_id', auth()->user()->id)->where('name', $name)->delete();
|
||||
} catch (Exception $e) {
|
||||
throw new FireflyException(sprintf('Could not delete preference: %s', $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -153,11 +145,7 @@ class Preferences
|
||||
$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
|
||||
|
||||
if (null !== $pref && null === $value) {
|
||||
try {
|
||||
$pref->delete();
|
||||
} catch (Exception $e) {
|
||||
throw new FireflyException(sprintf('Could not delete preference: %s', $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
return new Preference();
|
||||
}
|
||||
|
@ -32,6 +32,24 @@ use Log;
|
||||
*/
|
||||
trait ConvertsDataTypes
|
||||
{
|
||||
/**
|
||||
* Abstract method that always exists in the Request classes that use this
|
||||
* trait, OR a stub needs to be added by any other class that uses this train.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed|null $default
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function get(string $key, mixed $default = null): mixed;
|
||||
|
||||
/**
|
||||
* Abstract method that always exists in the Request classes that use this
|
||||
* trait, OR a stub needs to be added by any other class that uses this train.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function has(mixed $key): mixed;
|
||||
/**
|
||||
* Return integer value.
|
||||
*
|
||||
|
@ -678,7 +678,7 @@ class Steam
|
||||
{
|
||||
try {
|
||||
$hostName = gethostbyaddr($ipAddress);
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
return $hostName;
|
||||
|
@ -82,4 +82,20 @@ class AppendNotesToDescription implements ActionInterface
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function has(mixed $key): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -80,4 +80,20 @@ class MoveNotesToDescription implements ActionInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function has(mixed $key): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ trait DepositValidation
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
$result = $result ?? false;
|
||||
Log::debug(sprintf('validateDepositDestination will return %s', var_export($result, true)));
|
||||
|
||||
return $result;
|
||||
|
@ -74,7 +74,6 @@ trait OBValidation
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
$result = $result ?? false;
|
||||
Log::debug(sprintf('validateOBDestination(%d, "%s") will return %s', $accountId, $accountName, var_export($result, true)));
|
||||
|
||||
return $result;
|
||||
|
@ -62,10 +62,6 @@ return [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['audit_daily', 'audit_stdout'],
|
||||
],
|
||||
'scoped' => [
|
||||
'driver' => 'custom',
|
||||
'via' => FireflyIII\Logging\CreateCustomLogger::class,
|
||||
],
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => envNonEmpty('APP_LOG_LEVEL', 'info'),
|
||||
|
@ -1167,7 +1167,7 @@ try {
|
||||
Breadcrumbs::for(
|
||||
'transactions.mass.edit',
|
||||
static function (Generator $breadcrumbs, array $journals): void {
|
||||
if (!empty($journals)) {
|
||||
if (0 !== count($journals)) {
|
||||
$objectType = strtolower(reset($journals)['transaction_type_type']);
|
||||
$breadcrumbs->parent('transactions.index', $objectType);
|
||||
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', ['']));
|
||||
@ -1191,7 +1191,7 @@ try {
|
||||
Breadcrumbs::for(
|
||||
'transactions.bulk.edit',
|
||||
static function (Generator $breadcrumbs, array $journals): void {
|
||||
if (!empty($journals)) {
|
||||
if (0 !== count($journals)) {
|
||||
$ids = Arr::pluck($journals, 'transaction_journal_id');
|
||||
$first = reset($journals);
|
||||
$breadcrumbs->parent('transactions.index', strtolower($first['transaction_type_type']));
|
||||
|
Loading…
Reference in New Issue
Block a user