From 77234ddc66dca0a7abe5243b5e41fc0a097fb9c1 Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Mon, 22 Nov 2021 01:20:57 +0100 Subject: [PATCH] Fix type hinting for TwoFAccount resources --- app/Api/v1/Resources/TwoFAccountReadResource.php | 4 ++-- app/Api/v1/Resources/TwoFAccountStoreResource.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Api/v1/Resources/TwoFAccountReadResource.php b/app/Api/v1/Resources/TwoFAccountReadResource.php index 4ad177f7..93d4755a 100644 --- a/app/Api/v1/Resources/TwoFAccountReadResource.php +++ b/app/Api/v1/Resources/TwoFAccountReadResource.php @@ -14,8 +14,8 @@ class TwoFAccountReadResource extends TwoFAccountStoreResource { return array_merge( [ - 'id' => $this->id, - 'group_id' => intval($this->group_id), + 'id' => (int) $this->id, + 'group_id' => is_null($this->group_id) ? null : (int) $this->group_id, ], parent::toArray($request) ); diff --git a/app/Api/v1/Resources/TwoFAccountStoreResource.php b/app/Api/v1/Resources/TwoFAccountStoreResource.php index f40e4011..835f9fd1 100644 --- a/app/Api/v1/Resources/TwoFAccountStoreResource.php +++ b/app/Api/v1/Resources/TwoFAccountStoreResource.php @@ -23,10 +23,10 @@ class TwoFAccountStoreResource extends JsonResource !$request->has('withSecret') || (int) filter_var($request->input('withSecret'), FILTER_VALIDATE_BOOLEAN) == 1, $this->secret ), - 'digits' => $this->digits, + 'digits' => (int) $this->digits, 'algorithm' => $this->algorithm, - 'period' => $this->period, - 'counter' => $this->counter + 'period' => is_null($this->period) ? null : (int)$this->period, + 'counter' => is_null($this->counter) ? null : (int)$this->counter ]; } } \ No newline at end of file