10000 [Security] Add generic to UserProviderInterface by VincentLanglet · Pull Request #50399 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] Add generic to UserProviderInterface #50399

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

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*
* @template TUser of UserInterface
*
* @template-implements UserProviderInterface<TUser>
*/
class EntityUserProvider implements UserProviderInterface, PasswordUpgraderInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Ldap/Security/LdapUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* @author Grégoire Pineau <lyrixx@lyrixx.info>
* @author Charles Sarrazin <charles@sarraz.in>
* @author Robin Chalas <robin.chalas@gmail.com>
*
* @template-implements UserProviderInterface<LdapUser>
*/
class LdapUserProvider implements UserProviderInterface, PasswordUpgraderInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
* This is particularly useful with self-contained access tokens.
*
* @experimental
*
* @template-covariant TUser of UserInterface
*
* @template-extends UserProviderInterface<TUser>
*/
interface AttributesBasedUserProviderInterface extends UserProviderInterface
{
Expand All @@ -26,6 +30,8 @@ interface AttributesBasedUserProviderInterface extends UserProviderInterface
*
* This method must throw UserNotFoundException if the user is not found.
*
* @return TUser
*
* @throws UserNotFoundException
*/
public function loadUserByIdentifier(string $identifier, array $attributes = []): UserInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* handle the request.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*
* @template-implements UserProviderInterface<UserInterface>
*/
class ChainUserProvider implements UserProviderInterface, PasswordUpgraderInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* (a backend with a unique admin for instance)
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @template-implements UserProviderInterface<InMemoryUser>
*/
class InMemoryUserProvider implements UserProviderInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* when a firewall requires a user provider but none was defined.
*
* @internal
*
* @template-implements UserProviderInterface<never>
*/
class MissingUserProvider implements UserProviderInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* information is submitted or what the UserInterface object looks like.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @template-covariant TUser of UserInterface
*/
interface UserProviderInterface
{
Expand All @@ -41,6 +43,8 @@ interface UserProviderInterface
*
* @return UserInterface
*
* @psalm-return TUser
*
* @throws UnsupportedUserException if the user is not supported
* @throws UserNotFoundException if the user is not found
*/
Expand All @@ -58,6 +62,8 @@ public function supportsClass(string $class);
*
* This method must throw UserNotFoundException if the user is not found.
*
* @return TUser
*
* @throws UserNotFoundException
*/
public function loadUserByIdentifier(string $identifier): UserInterface;
Expand Down
0