Fix phpstan issues.

This commit is contained in:
James Cole
2023-11-05 16:55:16 +01:00
parent 4edd9fe3da
commit a0564751d6
72 changed files with 110 additions and 138 deletions

View File

@@ -50,7 +50,7 @@ class BudgetFactory
// first by ID:
if ($budgetId > 0) {
/** @var Budget $budget */
/** @var Budget|null $budget */
$budget = $this->user->budgets()->find($budgetId);
if (null !== $budget) {
return $budget;

View File

@@ -54,7 +54,7 @@ class CategoryFactory
}
// first by ID:
if ($categoryId > 0) {
/** @var Category $category */
/** @var Category|null $category */
$category = $this->user->categories()->find($categoryId);
if (null !== $category) {
return $category;

View File

@@ -48,7 +48,7 @@ class PiggyBankFactory
}
// first find by ID:
if ($piggyBankId > 0) {
/** @var PiggyBank $piggyBank */
/** @var PiggyBank|null $piggyBank */
$piggyBank = $this->user->piggyBanks()->find($piggyBankId);
if (null !== $piggyBank) {
return $piggyBank;
@@ -57,7 +57,7 @@ class PiggyBankFactory
// then find by name:
if ('' !== $piggyBankName) {
/** @var PiggyBank $piggyBank */
/** @var PiggyBank|null $piggyBank */
$piggyBank = $this->findByName($piggyBankName);
if (null !== $piggyBank) {
return $piggyBank;

View File

@@ -92,6 +92,7 @@ class TagFactory
'longitude' => null,
'zoomLevel' => null,
];
/** @var Tag|null $tag */
$tag = Tag::create($array);
if (null !== $tag && null !== $latitude && null !== $longitude) {
// create location object.

View File

@@ -127,7 +127,9 @@ class TransactionFactory
);
// do foreign currency thing: add foreign currency info to $one and $two if necessary.
if (null !== $this->foreignCurrency && null !== $foreignAmount && $this->foreignCurrency->id !== $this->currency->id && '' !== $foreignAmount) {
if (null !== $this->foreignCurrency &&
null !== $foreignAmount &&
$this->foreignCurrency->id !== $this->currency->id) {
$result->foreign_currency_id = $this->foreignCurrency->id;
$result->foreign_amount = $foreignAmount;
}