Fixes static analysis

This commit is contained in:
Italo
2022-07-27 14:22:05 -04:00
committed by GitHub
parent 21db20d103
commit 8277b1dd36
15 changed files with 33 additions and 15 deletions

View File

@@ -48,10 +48,11 @@ class AssertedRequest extends FormRequest
* Logs in the user for this assertion request.
*
* @param string|null $guard
* @return \Laragear\WebAuthn\Contracts\WebAuthnAuthenticatable&\Illuminate\Contracts\Auth\Authenticatable|null
* @return \Laragear\WebAuthn\Contracts\WebAuthnAuthenticatable|\Illuminate\Contracts\Auth\Authenticatable|null
*/
public function login(string $guard = null, bool $remember = null, bool $destroySession = false): ?WebAuthnAuthenticatable
{
/** @var \Illuminate\Contracts\Auth\StatefulGuard $guard */
$auth = Auth::guard($guard);
if ($auth->attempt($this->validated(), $remember ?? $this->hasRemember())) {

View File

@@ -133,7 +133,9 @@ class AssertionRequest extends FormRequest
// retrieve by its ID, otherwise we will fall back to credentials. Once done, we
// will check it uses WebAuthn if is not null, otherwise we'll fail miserably.
$user = is_string($credentials) || is_int($credentials)
// @phpstan-ignore-next-line
? Auth::guard($this->guard)->getProvider()->retrieveById($credentials)
// @phpstan-ignore-next-line
: Auth::guard($this->guard)->getProvider()->retrieveByCredentials($credentials);
if ($user && ! $user instanceof WebAuthnAuthenticatable) {