8000 minor #50399 [Security] Add generic to UserProviderInterface (Vincent… · symfony/symfony@cf3f52a · GitHub
[go: up one dir, main page]

Skip to content

Commit cf3f52a

Browse files
minor #50399 [Security] Add generic to UserProviderInterface (VincentLanglet)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Security] Add generic to UserProviderInterface | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | yes (but phpdoc only) | Deprecations? | no | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Similar to #48750 `@nicolas`-grekas Commits ------- ba46f32 Add generic to UserProviderInterface
2 parents 2f85c15 + ba46f32 commit cf3f52a

File tree

7 files changed

+24
-0
lines changed

7 files changed

+24
-0
lines changed

src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
*
3131
* @author Fabien Potencier <fabien@symfony.com>
3232
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
33+
*
34+
* @template TUser of UserInterface
35+
*
36+
* @template-implements UserProviderInterface<TUser>
3337
*/
3438
class EntityUserProvider implements UserProviderInterface, PasswordUpgraderInterface
3539
{

src/Symfony/Component/Ldap/Security/LdapUserProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
* @author Grégoire Pineau <lyrixx@lyrixx.info>
3131
* @author Charles Sarrazin <charles@sarraz.in>
3232
* @author Robin Chalas <robin.chalas@gmail.com>
33+
*
34+
* @template-implements UserProviderInterface<LdapUser>
3335
*/
3436
class LdapUserProvider implements UserProviderInterface, PasswordUpgraderInterface
3537
{

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
* This is particularly useful with self-contained access tokens.
1919
*
2020
* @experimental
21+
*
22+
* @template-covariant TUser of UserInterface
23+
*
24+
* @template-extends UserProviderInterface<TUser>
2125
*/
2226
interface AttributesBasedUserProviderInterface extends UserProviderInterface
2327
{
@@ -26,6 +30,8 @@ interface AttributesBasedUserProviderInterface extends UserProviderInterface
2630
*
2731
* This method must throw UserNotFoundException if the user is not found.
2832
*
33+
* @return TUser
34+
*
2935
* @throws UserNotFoundException
3036
*/
3137
public function loadUserByIdentifier(string $identifier, array $attributes = []): UserInterface;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* handle the request.
2222
*
2323
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
24+
*
25+
* @template-implements UserProviderInterface<UserInterface>
2426
*/
2527
class ChainUserProvider implements UserProviderInterface, PasswordUpgraderInterface
2628
{

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* (a backend with a unique admin for instance)
2222
*
2323
* @author Fabien Potencier <fabien@symfony.com>
24+
*
25+
* @template-implements UserProviderInterface<InMemoryUser>
2426
*/
2527
class InMemoryUserProvider implements UserProviderInterface
2628
{

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* when a firewall requires a user provider but none was defined.
1919
*
2020
* @internal
21+
*
22+
* @template-implements UserProviderInterface<never>
2123
*/
2224
class MissingUserProvider implements UserProviderInterface
2325
{

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

Lines changed: 6 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-covariant TUser of UserInterface
3133
*/
3234
interface UserProviderInterface
3335
{
@@ -41,6 +43,8 @@ interface UserProviderInterface
4143
*
4244
* @return UserInterface
4345
*
46+
* @psalm-return TUser
47+
*
4448
* @throws UnsupportedUserException if the user is not supported
4549
* @throws UserNotFoundException if the user is not found
4650
*/
@@ -58,6 +62,8 @@ public function supportsClass(string $class);
5862
*
5963
* This method must throw UserNotFoundException if the user is not found.
6064
*
65+
* @return TUser
66+
*
6167
* @throws UserNotFoundException
6268
*/
6369
public function loadUserByIdentifier(string $identifier): UserInterface;

0 commit comments

Comments
 (0)
0