mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Fix phpstan messages.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user