Skip to content

Commit

Permalink
Merge pull request #2 from drupaltest/uid-is-int
Browse files Browse the repository at this point in the history
The user ID is an integer.
  • Loading branch information
pfrenssen authored Jul 4, 2020
2 parents 6e8087e + 9be2bf0 commit 8a0fbea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/AuthenticationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function logIn(\stdClass $user): void
// Ensure we aren't already logged in.
$this->fastLogout();

$account = $this->getUnchangedUser($user->uid);
$account = $this->getUnchangedUser((int) $user->uid);
if (empty($account)) {
if (isset($user->role)) {
throw new \Exception(sprintf(
Expand Down Expand Up @@ -98,7 +98,7 @@ protected function getOneTimeLoginUrl(UserInterface $account): string
*
* This will get a fresh copy from the database, bypassing the cache.
*
* @param string $uid
* @param int $uid
* The user ID.
*
* @return \Drupal\user\UserInterface|null
Expand All @@ -109,7 +109,7 @@ protected function getOneTimeLoginUrl(UserInterface $account): string
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
* Thrown when the user entity type is not defined.
*/
protected function getUnchangedUser(string $uid): ?UserInterface
protected function getUnchangedUser(int $uid): ?UserInterface
{
/** @var \Drupal\user\UserInterface $account */
$account = \Drupal::entityTypeManager()->getStorage('user')->loadUnchanged($uid);
Expand Down

0 comments on commit 8a0fbea

Please sign in to comment.