Skip to content

Commit 60a3a83

Browse files
committed
🚨 Fix phpstan's issues. Add generic typing to UserProviderInterface.
1 parent f069076 commit 60a3a83

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Controller/GraphQL/LoginController.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
1616
use TheCodingMachine\GraphQLite\Annotations\Mutation;
1717

18+
/**
19+
* @template-covariant TUser of UserInterface
20+
*/
1821
class LoginController
1922
{
2023

2124
/**
22-
* @var UserProviderInterface
25+
* @var UserProviderInterface<TUser>
2326
*/
2427
private $userProvider;
2528
/**
@@ -39,6 +42,9 @@ class LoginController
3942
*/
4043
private $eventDispatcher;
4144

45+
/**
46+
* @param UserProviderInterface<TUser> $userProvider
47+
*/
4248
public function __construct(UserProviderInterface $userProvider, UserPasswordHasherInterface $passwordEncoder, TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher, string $firewallName)
4349
{
4450
$this->userProvider = $userProvider;
@@ -50,6 +56,8 @@ public function __construct(UserProviderInterface $userProvider, UserPasswordHas
5056

5157
/**
5258
* @Mutation()
59+
*
60+
* @phpstan-return TUser
5361
*/
5462
public function login(string $userName, string $password, Request $request): UserInterface
5563
{

0 commit comments

Comments
 (0)