From 397f119432d26019402497e5231a4ae5cf4370aa Mon Sep 17 00:00:00 2001 From: Italo Date: Wed, 27 Jul 2022 14:47:04 -0400 Subject: [PATCH] Fixes static analysis --- .../Creator/Pipes/MayRetrieveCredentialsIdForUser.php | 1 + src/ByteBuffer.php | 1 + src/CborDecoder.php | 3 +-- src/Http/Requests/AssertedRequest.php | 1 + src/Models/WebAuthnCredential.php | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Assertion/Creator/Pipes/MayRetrieveCredentialsIdForUser.php b/src/Assertion/Creator/Pipes/MayRetrieveCredentialsIdForUser.php index 42977da..2b6b16d 100644 --- a/src/Assertion/Creator/Pipes/MayRetrieveCredentialsIdForUser.php +++ b/src/Assertion/Creator/Pipes/MayRetrieveCredentialsIdForUser.php @@ -36,6 +36,7 @@ class MayRetrieveCredentialsIdForUser * Adapt all credentials into an `allowCredentials` digestible array. * * @param \Illuminate\Database\Eloquent\Collection $credentials + * @phpstan-ignore-next-line * @return \Illuminate\Support\Collection}> */ protected function parseCredentials(EloquentCollection $credentials): Collection diff --git a/src/ByteBuffer.php b/src/ByteBuffer.php index 9b9aca7..90d8109 100644 --- a/src/ByteBuffer.php +++ b/src/ByteBuffer.php @@ -415,6 +415,7 @@ class ByteBuffer implements JsonSerializable, Jsonable, Stringable */ public static function fromBase64(string $base64): static { + /** @var string|false $bin */ $bin = base64_decode($base64); if (false === $bin) { diff --git a/src/CborDecoder.php b/src/CborDecoder.php index a0e887a..e570259 100644 --- a/src/CborDecoder.php +++ b/src/CborDecoder.php @@ -138,7 +138,6 @@ class CborDecoder $val = static::parseExtraLength($val, $buf, $offset); - // @phpstan-ingnore-next-line try { return static::parseItemData($type, $val, $buf, $offset); } catch (InvalidArgumentException $e) { @@ -249,7 +248,7 @@ class CborDecoder * @param \Laragear\WebAuthn\ByteBuffer $buf * @param $offset * @return \Laragear\WebAuthn\ByteBuffer|array|bool|float|int|string|null - * @throws \Laragear\WebAuthn\Exceptions\DataException + * @throws \Laragear\WebAuthn\Exceptions\DataException|\InvalidArgumentException */ protected static function parseItemData( int $type, diff --git a/src/Http/Requests/AssertedRequest.php b/src/Http/Requests/AssertedRequest.php index d8d68e4..452521f 100644 --- a/src/Http/Requests/AssertedRequest.php +++ b/src/Http/Requests/AssertedRequest.php @@ -59,6 +59,7 @@ class AssertedRequest extends FormRequest if ($auth->attempt($this->validated(), $remember ?? $this->hasRemember())) { $this->session()->regenerate($destroySession); + // @phpstan-ignore-next-line return $auth->user(); } diff --git a/src/Models/WebAuthnCredential.php b/src/Models/WebAuthnCredential.php index c5796bb..b3df3e1 100644 --- a/src/Models/WebAuthnCredential.php +++ b/src/Models/WebAuthnCredential.php @@ -102,6 +102,7 @@ class WebAuthnCredential extends Model */ public function authenticatable(): MorphTo { + // @phpstan-ignore-next-line return $this->morphTo('authenticatable'); }