1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 10:14:04 +00:00

fix: add explicit nullable type declarations for UserImpersonation parameters (#1324)

This commit is contained in:
MuHanz 2025-03-13 23:00:05 +07:00 committed by GitHub
parent 19bc316cf6
commit 3f9935784d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,7 +18,7 @@ class UserImpersonation implements Feature
public function bootstrap(Tenancy $tenancy): void
{
$tenancy->macro('impersonate', function (Tenant $tenant, string $userId, string $redirectUrl, string $authGuard = null): ImpersonationToken {
$tenancy->macro('impersonate', function (Tenant $tenant, string $userId, string $redirectUrl, ?string $authGuard = null): ImpersonationToken {
return ImpersonationToken::create([
'tenant_id' => $tenant->getTenantKey(),
'user_id' => $userId,
@ -32,10 +32,10 @@ class UserImpersonation implements Feature
* Impersonate a user and get an HTTP redirect response.
*
* @param string|ImpersonationToken $token
* @param int $ttl
* @param int|null $ttl
* @return RedirectResponse
*/
public static function makeResponse($token, int $ttl = null): RedirectResponse
public static function makeResponse($token, ?int $ttl = null): RedirectResponse
{
$token = $token instanceof ImpersonationToken ? $token : ImpersonationToken::findOrFail($token);