-
-
Notifications
You must be signed in to change notification settings - Fork 450
Replace Stringable|string argument types with string-only
#1042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,7 +46,6 @@ | |||||
| use Lcobucci\JWT\UnencryptedToken; | ||||||
| use Psr\Clock\ClockInterface; | ||||||
| use Psr\Http\Message\ResponseInterface; | ||||||
| use Stringable; | ||||||
| use Throwable; | ||||||
| use Traversable; | ||||||
|
|
||||||
|
|
@@ -76,7 +75,7 @@ public function __construct( | |||||
| $this->jwtParser = new Parser(new JoseEncoder()); | ||||||
| } | ||||||
|
|
||||||
| public function getUser(Stringable|string $uid): UserRecord | ||||||
| public function getUser(string $uid): UserRecord | ||||||
| { | ||||||
| $uid = Uid::fromString($uid)->value; | ||||||
|
|
||||||
|
|
@@ -91,7 +90,7 @@ public function getUser(Stringable|string $uid): UserRecord | |||||
|
|
||||||
| public function getUsers(array $uids): array | ||||||
| { | ||||||
| $uids = array_map(static fn(\Stringable|string $uid): string => Uid::fromString($uid)->value, $uids); | ||||||
| $uids = array_map(static fn(string $uid): string => Uid::fromString($uid)->value, $uids); | ||||||
|
|
||||||
| $users = array_fill_keys($uids, null); | ||||||
|
|
||||||
|
|
@@ -161,7 +160,7 @@ public function createUser(array|CreateUser $properties): UserRecord | |||||
| return $this->getUserRecordFromResponseAfterUserUpdate($response); | ||||||
| } | ||||||
|
|
||||||
| public function updateUser(Stringable|string $uid, array|UpdateUser $properties): UserRecord | ||||||
| public function updateUser(string $uid, array|UpdateUser $properties): UserRecord | ||||||
| { | ||||||
| $request = $properties instanceof UpdateUser | ||||||
| ? $properties | ||||||
|
|
@@ -174,7 +173,7 @@ public function updateUser(Stringable|string $uid, array|UpdateUser $properties) | |||||
| return $this->getUserRecordFromResponseAfterUserUpdate($response); | ||||||
| } | ||||||
|
|
||||||
| public function createUserWithEmailAndPassword(Stringable|string $email, Stringable|string $password): UserRecord | ||||||
| public function createUserWithEmailAndPassword(string $email, string $password): UserRecord | ||||||
| { | ||||||
| return $this->createUser( | ||||||
| CreateUser::new() | ||||||
|
|
@@ -183,9 +182,9 @@ public function createUserWithEmailAndPassword(Stringable|string $email, Stringa | |||||
| ); | ||||||
| } | ||||||
|
|
||||||
| public function getUserByEmail(Stringable|string $email): UserRecord | ||||||
| public function getUserByEmail(string $email): UserRecord | ||||||
| { | ||||||
| $email = Email::fromString((string) $email)->value; | ||||||
| $email = Email::fromString($email)->value; | ||||||
|
|
||||||
| $response = $this->client->getUserByEmail($email); | ||||||
|
|
||||||
|
|
@@ -198,10 +197,8 @@ public function getUserByEmail(Stringable|string $email): UserRecord | |||||
| return $userRecord; | ||||||
| } | ||||||
|
|
||||||
| public function getUserByPhoneNumber(Stringable|string $phoneNumber): UserRecord | ||||||
| public function getUserByPhoneNumber(string $phoneNumber): UserRecord | ||||||
| { | ||||||
| $phoneNumber = (string) $phoneNumber; | ||||||
|
|
||||||
| $response = $this->client->getUserByPhoneNumber($phoneNumber); | ||||||
|
|
||||||
| $userRecord = self::getFirstUserRecordFromUserListResponse($response); | ||||||
|
|
@@ -213,11 +210,8 @@ public function getUserByPhoneNumber(Stringable|string $phoneNumber): UserRecord | |||||
| return $userRecord; | ||||||
| } | ||||||
|
|
||||||
| public function getUserByProviderUid(Stringable|string $providerId, Stringable|string $providerUid): UserRecord | ||||||
| public function getUserByProviderUid(string $providerId, string $providerUid): UserRecord | ||||||
| { | ||||||
| $providerId = (string) $providerId; | ||||||
| $providerUid = (string) $providerUid; | ||||||
|
|
||||||
| $response = $this->client->getUserByProviderUid($providerId, $providerUid); | ||||||
|
|
||||||
| $userRecord = self::getFirstUserRecordFromUserListResponse($response); | ||||||
|
|
@@ -234,27 +228,27 @@ public function createAnonymousUser(): UserRecord | |||||
| return $this->createUser(CreateUser::new()); | ||||||
| } | ||||||
|
|
||||||
| public function changeUserPassword(Stringable|string $uid, Stringable|string $newPassword): UserRecord | ||||||
| public function changeUserPassword(string $uid, string $newPassword): UserRecord | ||||||
| { | ||||||
| return $this->updateUser($uid, UpdateUser::new()->withClearTextPassword($newPassword)); | ||||||
| } | ||||||
|
|
||||||
| public function changeUserEmail(Stringable|string $uid, Stringable|string $newEmail): UserRecord | ||||||
| public function changeUserEmail(string $uid, string $newEmail): UserRecord | ||||||
| { | ||||||
| return $this->updateUser($uid, UpdateUser::new()->withEmail($newEmail)); | ||||||
| } | ||||||
|
|
||||||
| public function enableUser(Stringable|string $uid): UserRecord | ||||||
| public function enableUser(string $uid): UserRecord | ||||||
| { | ||||||
| return $this->updateUser($uid, UpdateUser::new()->markAsEnabled()); | ||||||
| } | ||||||
|
|
||||||
| public function disableUser(Stringable|string $uid): UserRecord | ||||||
| public function disableUser(string $uid): UserRecord | ||||||
| { | ||||||
| return $this->updateUser($uid, UpdateUser::new()->markAsDisabled()); | ||||||
| } | ||||||
|
|
||||||
| public function deleteUser(Stringable|string $uid): void | ||||||
| public function deleteUser(string $uid): void | ||||||
| { | ||||||
| $uid = Uid::fromString($uid)->value; | ||||||
|
|
||||||
|
|
@@ -277,9 +271,9 @@ public function deleteUsers(iterable $uids, bool $forceDeleteEnabledUsers = fals | |||||
| return DeleteUsersResult::fromRequestAndResponse($request, $response); | ||||||
| } | ||||||
|
|
||||||
| public function getEmailActionLink(string $type, Stringable|string $email, $actionCodeSettings = null, ?string $locale = null): string | ||||||
| public function getEmailActionLink(string $type, string $email, $actionCodeSettings = null, ?string $locale = null): string | ||||||
| { | ||||||
| $email = Email::fromString((string) $email)->value; | ||||||
| $email = Email::fromString($email)->value; | ||||||
|
|
||||||
| if ($actionCodeSettings === null) { | ||||||
| $actionCodeSettings = ValidatedActionCodeSettings::empty(); | ||||||
|
|
@@ -292,9 +286,9 @@ public function getEmailActionLink(string $type, Stringable|string $email, $acti | |||||
| return $this->client->getEmailActionLink($type, $email, $actionCodeSettings, $locale); | ||||||
| } | ||||||
|
|
||||||
| public function sendEmailActionLink(string $type, Stringable|string $email, $actionCodeSettings = null, ?string $locale = null): void | ||||||
| public function sendEmailActionLink(string $type, string $email, $actionCodeSettings = null, ?string $locale = null): void | ||||||
| { | ||||||
| $email = Email::fromString((string) $email)->value; | ||||||
| $email = Email::fromString($email)->value; | ||||||
|
|
||||||
| if ($actionCodeSettings === null) { | ||||||
| $actionCodeSettings = ValidatedActionCodeSettings::empty(); | ||||||
|
|
@@ -330,45 +324,45 @@ public function sendEmailActionLink(string $type, Stringable|string $email, $act | |||||
| $this->client->sendEmailActionLink($type, $email, $actionCodeSettings, $locale, $idToken); | ||||||
| } | ||||||
|
|
||||||
| public function getEmailVerificationLink(Stringable|string $email, $actionCodeSettings = null, ?string $locale = null): string | ||||||
| public function getEmailVerificationLink(string $email, $actionCodeSettings = null, ?string $locale = null): string | ||||||
| { | ||||||
| return $this->getEmailActionLink('VERIFY_EMAIL', $email, $actionCodeSettings, $locale); | ||||||
| } | ||||||
|
|
||||||
| public function sendEmailVerificationLink(Stringable|string $email, $actionCodeSettings = null, ?string $locale = null): void | ||||||
| public function sendEmailVerificationLink(string $email, $actionCodeSettings = null, ?string $locale = null): void | ||||||
| { | ||||||
| $this->sendEmailActionLink('VERIFY_EMAIL', $email, $actionCodeSettings, $locale); | ||||||
| } | ||||||
|
|
||||||
| public function getPasswordResetLink(Stringable|string $email, $actionCodeSettings = null, ?string $locale = null): string | ||||||
| public function getPasswordResetLink(string $email, $actionCodeSettings = null, ?string $locale = null): string | ||||||
| { | ||||||
| return $this->getEmailActionLink('PASSWORD_RESET', $email, $actionCodeSettings, $locale); | ||||||
| } | ||||||
|
|
||||||
| public function sendPasswordResetLink(Stringable|string $email, $actionCodeSettings = null, ?string $locale = null): void | ||||||
| public function sendPasswordResetLink(string $email, $actionCodeSettings = null, ?string $locale = null): void | ||||||
| { | ||||||
| $this->sendEmailActionLink('PASSWORD_RESET', $email, $actionCodeSettings, $locale); | ||||||
| } | ||||||
|
|
||||||
| public function getSignInWithEmailLink(Stringable|string $email, $actionCodeSettings = null, ?string $locale = null): string | ||||||
| public function getSignInWithEmailLink(string $email, $actionCodeSettings = null, ?string $locale = null): string | ||||||
| { | ||||||
| return $this->getEmailActionLink('EMAIL_SIGNIN', $email, $actionCodeSettings, $locale); | ||||||
| } | ||||||
|
|
||||||
| public function sendSignInWithEmailLink(Stringable|string $email, $actionCodeSettings = null, ?string $locale = null): void | ||||||
| public function sendSignInWithEmailLink(string $email, $actionCodeSettings = null, ?string $locale = null): void | ||||||
| { | ||||||
| $this->sendEmailActionLink('EMAIL_SIGNIN', $email, $actionCodeSettings, $locale); | ||||||
| } | ||||||
|
|
||||||
| public function setCustomUserClaims(Stringable|string $uid, ?array $claims): void | ||||||
| public function setCustomUserClaims(string $uid, ?array $claims): void | ||||||
| { | ||||||
| $uid = Uid::fromString($uid)->value; | ||||||
| $claims ??= []; | ||||||
|
|
||||||
| $this->client->setCustomUserClaims($uid, $claims); | ||||||
| } | ||||||
|
|
||||||
| public function createCustomToken(Stringable|string $uid, array $claims = [], $ttl = 3600): UnencryptedToken | ||||||
| public function createCustomToken(string $uid, array $claims = [], $ttl = 3600): UnencryptedToken | ||||||
| { | ||||||
| if ($this->tokenGenerator === null) { | ||||||
| throw new AuthError('Custom Token Generation is disabled because the current credentials do not permit it'); | ||||||
|
|
@@ -507,7 +501,7 @@ public function confirmPasswordReset(string $oobCode, $newPassword, bool $invali | |||||
| return $email; | ||||||
| } | ||||||
|
|
||||||
| public function revokeRefreshTokens(Stringable|string $uid): void | ||||||
| public function revokeRefreshTokens(string $uid): void | ||||||
| { | ||||||
| $uid = Uid::fromString($uid)->value; | ||||||
|
|
||||||
|
|
@@ -518,12 +512,7 @@ public function unlinkProvider($uid, $provider): UserRecord | |||||
| { | ||||||
| $uid = Uid::fromString($uid)->value; | ||||||
|
|
||||||
| $provider = array_values( | ||||||
| array_filter( | ||||||
| array_map(strval(...), (array) $provider), | ||||||
| static fn(string $value): bool => $value !== '', | ||||||
| ), | ||||||
| ); | ||||||
| $provider = array_map(strval(...), (array) $provider); | ||||||
|
|
||||||
| $response = $this->client->unlinkProvider($uid, $provider); | ||||||
|
|
||||||
|
|
@@ -533,7 +522,7 @@ public function unlinkProvider($uid, $provider): UserRecord | |||||
| public function signInAsUser($user, ?array $claims = null): SignInResult | ||||||
| { | ||||||
| $claims ??= []; | ||||||
| $uid = $user instanceof UserRecord ? $user->uid : (string) $user; | ||||||
| $uid = $user instanceof UserRecord ? $user->uid : $user; | ||||||
|
|
||||||
| try { | ||||||
| $customToken = $this->createCustomToken($uid, $claims); | ||||||
|
|
@@ -560,15 +549,15 @@ public function signInWithRefreshToken(string $refreshToken): SignInResult | |||||
|
|
||||||
| public function signInWithEmailAndPassword($email, $clearTextPassword): SignInResult | ||||||
|
||||||
| public function signInWithEmailAndPassword($email, $clearTextPassword): SignInResult | |
| public function signInWithEmailAndPassword(string $email, string $clearTextPassword): SignInResult |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing string type hint for $email parameter. The interface Auth declares this method as signInWithEmailAndOobCode(string $email, string $oobCode) (line 432), but the implementation is missing the type hint for $email. It should be explicitly typed as string to match the interface and align with the PR's goal.
| public function signInWithEmailAndOobCode($email, string $oobCode): SignInResult | |
| public function signInWithEmailAndOobCode(string $email, string $oobCode): SignInResult |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing string type hint for $provider parameter. The interface Auth declares this method with string $provider (line 451), but the implementation is missing the type hint. It should be explicitly typed as string to match the interface and align with the PR's goal of removing Stringable support.
| public function signInWithIdpAccessToken($provider, string $accessToken, $redirectUrl = null, ?string $oauthTokenSecret = null, ?string $linkingIdToken = null, ?string $rawNonce = null): SignInResult | |
| public function signInWithIdpAccessToken(string $provider, string $accessToken, $redirectUrl = null, ?string $oauthTokenSecret = null, ?string $linkingIdToken = null, ?string $rawNonce = null): SignInResult |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing string type hint for $provider parameter. The interface Auth declares this method with string $provider (line 462), but the implementation is missing the type hint. It should be explicitly typed as string to match the interface and align with the PR's goal of removing Stringable support.
| public function signInWithIdpIdToken($provider, $idToken, $redirectUrl = null, ?string $linkingIdToken = null, ?string $rawNonce = null): SignInResult | |
| public function signInWithIdpIdToken(string $provider, $idToken, $redirectUrl = null, ?string $linkingIdToken = null, ?string $rawNonce = null): SignInResult |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing validation to filter out empty strings from providers. The old implementation used
array_filter()to remove empty strings before passing to the API client, which expectslist<non-empty-string>. Now the code only converts to strings witharray_map(strval(...), (array) $provider)but doesn't filter empty strings.Consider restoring the filter: