mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Fix various phpstan issues.
This commit is contained in:
@@ -54,9 +54,6 @@ trait ValidatesAutoBudgetRequest
|
||||
return;
|
||||
}
|
||||
|
||||
if ('' === (string) $amount) {
|
||||
$validator->errors()->add('auto_budget_amount', (string)trans('validation.amount_required_for_auto_budget'));
|
||||
}
|
||||
if (1 !== bccomp((string)$amount, '0')) {
|
||||
$validator->errors()->add('auto_budget_amount', (string)trans('validation.auto_budget_amount_positive'));
|
||||
}
|
||||
|
||||
@@ -671,12 +671,12 @@ class FireflyValidator extends Validator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $attribute
|
||||
* @param $value
|
||||
* @param string|null $attribute
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validateUniqueCurrencyCode($attribute, $value): bool
|
||||
public function validateUniqueCurrencyCode(string|null $attribute, string|null $value): bool
|
||||
{
|
||||
return $this->validateUniqueCurrency('code', (string)$attribute, (string)$value);
|
||||
}
|
||||
@@ -694,23 +694,23 @@ class FireflyValidator extends Validator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $attribute
|
||||
* @param $value
|
||||
* @param string|null $attribute
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validateUniqueCurrencyName($attribute, $value): bool
|
||||
public function validateUniqueCurrencyName(string|null $attribute, string|null $value): bool
|
||||
{
|
||||
return $this->validateUniqueCurrency('name', (string)$attribute, (string)$value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $attribute
|
||||
* @param $value
|
||||
* @param string|null $attribute
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validateUniqueCurrencySymbol($attribute, $value): bool
|
||||
public function validateUniqueCurrencySymbol(string|null $attribute, string|null $value): bool
|
||||
{
|
||||
return $this->validateUniqueCurrency('symbol', (string)$attribute, (string)$value);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ trait GroupValidation
|
||||
$count = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id')
|
||||
->leftJoin('transaction_groups', 'transaction_groups.id', 'transaction_journals.transaction_group_id')
|
||||
->where('transaction_journals.transaction_group_id', $transactionGroup->id)
|
||||
->where('transactions.reconciled', 1)->where('transactions.amount', '<', 0)->count(['transactions.id']);
|
||||
->where('transactions.reconciled', 1)->where('transactions.amount', '<', 0)->count('transactions.id');
|
||||
if (0 === $count) {
|
||||
app('log')->debug(sprintf('Transaction is not reconciled, done with %s', __METHOD__));
|
||||
return;
|
||||
|
||||
@@ -324,7 +324,7 @@ trait TransactionValidation
|
||||
*/
|
||||
private function isLiability(Account $account): bool
|
||||
{
|
||||
$type = $account->accountType?->type;
|
||||
$type = $account->accountType->type;
|
||||
if (in_array($type, config('firefly.valid_liabilities'), true)) {
|
||||
return true;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ trait TransactionValidation
|
||||
*/
|
||||
private function isAsset(Account $account): bool
|
||||
{
|
||||
$type = $account->accountType?->type;
|
||||
$type = $account->accountType->type;
|
||||
return $type === AccountType::ASSET;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user