Fix a lot of phpstan things

This commit is contained in:
James Cole
2023-11-26 12:10:42 +01:00
parent a6c355c7b8
commit 68f01d932e
53 changed files with 214 additions and 120 deletions

View File

@@ -170,6 +170,9 @@ class TwoFactorController extends Controller
private function isBackupCode(string $mfaCode): bool
{
$list = app('preferences')->get('mfa_recovery', [])->data;
if(!is_array($list)) {
$list = [];
}
if (in_array($mfaCode, $list, true)) {
return true;
}
@@ -185,6 +188,9 @@ class TwoFactorController extends Controller
private function removeFromBackupCodes(string $mfaCode): void
{
$list = app('preferences')->get('mfa_recovery', [])->data;
if(!is_array($list)) {
$list = [];
}
$newList = array_values(array_diff($list, [$mfaCode]));
app('preferences')->set('mfa_recovery', $newList);
}