fix phpstan issues.

This commit is contained in:
James Cole
2023-11-28 17:18:31 +01:00
parent 7cb919e9c2
commit b0a39c00ba
25 changed files with 184 additions and 180 deletions

View File

@@ -73,8 +73,11 @@ class FireflyValidator extends Validator
}
$secretPreference = app('preferences')->get('temp-mfa-secret');
$secret = $secretPreference?->data ?? '';
if(is_array($secret)) {
$secret = '';
}
return Google2FA::verifyKey($secret, $value);
return (bool) Google2FA::verifyKey((string) $secret, $value);
}
/**
@@ -183,7 +186,7 @@ class FireflyValidator extends Validator
$value = strtoupper($value);
// replace characters outside of ASCI range.
$value = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $value);
$value = (string) iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $value);
$search = [' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
$replace = [
'',
@@ -509,7 +512,8 @@ class FireflyValidator extends Validator
if (!array_key_exists('user_id', $this->data)) {
return false;
}
/** @var User $user */
$user = User::find($this->data['user_id']);
$type = AccountType::find($this->data['account_type_id'])->first();
$value = $this->data['name'];