8000 Add generic to UserProviderInterface · symfony/symfony@c3fc7e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit c3fc7e9

Browse files
Add generic to UserProviderInterface
1 parent 5bf5c4d commit c3fc7e9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Symfony/Component/Security/Core/User/AttributesBasedUserProviderInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
* This is particularly useful with self-contained access tokens.
1919
*
2020
* @experimental
21+
*
22+
* @template TUser of UserInterface
23+
* @template-extends UserProviderInterface<TUser>
2124
*/
2225
interface AttributesBasedUserProviderInterface extends UserProviderInterface
2326
{
@@ -27,6 +30,8 @@ interface AttributesBasedUserProviderInterface extends UserProviderInterface
2730
* This method must throw UserNotFoundException if the user is not found.
2831
*
2932
* @throws UserNotFoundException
33+
*
34+
* @return TUser
3035
*/
3136
public function loadUserByIdentifier(string $identifier, array $attributes = []): UserInterface;
3237
}

src/Symfony/Component/Security/Core/User/UserProviderInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
* information is submitted or what the UserInterface object looks like.
2929
*
3030
* @author Fabien Potencier <fabien@symfony.com>
31+
*
32+
* @template TUser of UserInterface
3133
*/
3234
interface UserProviderInterface
3335
{
@@ -40,6 +42,7 @@ interface UserProviderInterface
4042
* map.
4143
*
4244
* @return UserInterface
45+
* @psalm-return TUser
4346
*
4447
* @throws UnsupportedUserException if the user is not supported
4548
* @throws UserNotFoundException if the user is not found
@@ -49,6 +52,8 @@ public function refreshUser(UserInterface $user);
4952
/**
5053
* Whether this provider supports the given user class.
5154
*
55+
* @param class-string<TUser> $class
56+
*
5257
* @return bool
5358
*/
5459
public function supportsClass(string $class);
@@ -59,6 +64,8 @@ public function supportsClass(string $class);
5964
* This method must throw UserNotFoundException if the user is not found.
6065
*
6166
* @throws UserNotFoundException
67+
*
68+
* @return TUser
6269
*/
6370
public function loadUserByIdentifier(string $identifier): UserInterface;
6471
}

0 commit comments

Comments
 (0)
0