From 0debdc77fa85a7ccc0a366e268861ba7a94ccd2a Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Sat, 26 Aug 2023 18:04:31 +0200 Subject: [PATCH] Remove deprecations reported by Symfony 6.x --- CHANGELOG.md | 1 + src/Security/Core/User/EntityUserProvider.php | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 726622a32..fdc2e30c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Changelog ========= ## 2.0.0 (2023-xx-xx) * Bugfix: Prevent refreshing non-expired tokens +* Bugfix: Remove deprecations reported by Symfony 6.x ## 2.0.0-BETA3 (2023-08-20) * BC Break: Dropped support for Symfony: 6.0.*, diff --git a/src/Security/Core/User/EntityUserProvider.php b/src/Security/Core/User/EntityUserProvider.php index 25aa93940..81604b26f 100644 --- a/src/Security/Core/User/EntityUserProvider.php +++ b/src/Security/Core/User/EntityUserProvider.php @@ -90,7 +90,7 @@ public function loadUserByOAuthUserResponse(UserResponseInterface $response): ?U return $user; } - public function refreshUser(UserInterface $user): ?UserInterface + public function refreshUser(UserInterface $user): UserInterface { $accessor = PropertyAccess::createPropertyAccessor(); $identifier = $this->properties['identifier']; @@ -100,8 +100,7 @@ public function refreshUser(UserInterface $user): ?UserInterface $userId = $accessor->getValue($user, $identifier); - // @phpstan-ignore-next-line Symfony <5.4 BC layer - $username = method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(); + $username = $user->getUserIdentifier(); if (null === $user = $this->findUser([$identifier => $userId])) { throw $this->createUserNotFoundException($username, sprintf('User with ID "%d" could not be reloaded.', $userId));