Skip to content

Commit

Permalink
minor #32254 [Security] [Guard] Added type-hints to AuthenticatorInte…
Browse files Browse the repository at this point in the history
…rface (thomasbisignani)

This PR was merged into the 5.0-dev branch.

Discussion
----------

[Security] [Guard] Added type-hints to AuthenticatorInterface

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32179
| License       | MIT
| Doc PR        |

This PR adds the type-hints to the AuthenticatorInterface

Commits
-------

51b3c2e [Security] [Guard] Added type-hints to AuthenticatorInterface
  • Loading branch information
fabpot committed Jul 3, 2019
2 parents 393f9ae + 51b3c2e commit cc9778e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
Expand Up @@ -25,11 +25,9 @@ abstract class AbstractGuardAuthenticator implements AuthenticatorInterface
* Shortcut to create a PostAuthenticationGuardToken for you, if you don't really
* care about which authenticated token you're using.
*
* @param string $providerKey
*
* @return PostAuthenticationGuardToken
*/
public function createAuthenticatedToken(UserInterface $user, $providerKey)
public function createAuthenticatedToken(UserInterface $user, string $providerKey)
{
return new PostAuthenticationGuardToken(
$user,
Expand Down
11 changes: 2 additions & 9 deletions src/Symfony/Component/Security/Guard/AuthenticatorInterface.php
Expand Up @@ -108,12 +108,9 @@ public function checkCredentials($credentials, UserInterface $user);
*
* @see AbstractGuardAuthenticator
*
* @param UserInterface $user
* @param string $providerKey The provider (i.e. firewall) key
*
* @return GuardTokenInterface
*/
public function createAuthenticatedToken(UserInterface $user, $providerKey);
public function createAuthenticatedToken(UserInterface $user, string $providerKey);

/**
* Called when authentication executed, but failed (e.g. wrong username password).
Expand All @@ -140,13 +137,9 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
* If you return null, the current request will continue, and the user
* will be authenticated. This makes sense, for example, with an API.
*
* @param Request $request
* @param TokenInterface $token
* @param string $providerKey The provider (i.e. firewall) key
*
* @return Response|null
*/
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey);
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey);

/**
* Does this method support remember me cookies?
Expand Down
Expand Up @@ -103,7 +103,7 @@ public function supports(Request $request)
return true;
}

public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey)
{
}

Expand Down

0 comments on commit cc9778e

Please sign in to comment.