Skip to content

Commit db22e7d

Browse files
Add missing return types to tests/internal/final methods
1 parent 5e6667b commit db22e7d

File tree

12 files changed

+40
-38
lines changed

12 files changed

+40
-38
lines changed

Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
9393
], JsonResponse::HTTP_FORBIDDEN);
9494
}
9595

96-
public function start(Request $request, AuthenticationException $authException = null)
96+
public function start(Request $request, AuthenticationException $authException = null): Response
9797
{
9898
}
9999
}

Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use Symfony\Component\Security\Core\User\UserInterface;
3737
use Symfony\Component\Security\Core\User\UserProviderInterface;
3838
use Symfony\Component\Security\Guard\AuthenticatorInterface as GuardAuthenticatorInterface;
39+
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
3940
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
4041
use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator;
4142
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
@@ -865,39 +866,39 @@ public function createToken(Passport $passport, string $firewallName): TokenInte
865866

866867
class NullAuthenticator implements GuardAuthenticatorInterface
867868
{
868-
public function start(Request $request, AuthenticationException $authException = null)
869+
public function start(Request $request, AuthenticationException $authException = null): Response
869870
{
870871
}
871872

872-
public function supports(Request $request)
873+
public function supports(Request $request): bool
873874
{
874875
}
875876

876877
public function getCredentials(Request $request)
877878
{
878879
}
879880

880-
public function getUser($credentials, UserProviderInterface $userProvider)
881+
public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface
881882
{
882883
}
883884

884-
public function checkCredentials($credentials, UserInterface $user)
885+
public function checkCredentials($credentials, UserInterface $user): bool
885886
{
886887
}
887888

888-
public function createAuthenticatedToken(UserInterface $user, string $providerKey)
889+
public function createAuthenticatedToken(UserInterface $user, string $providerKey): GuardTokenInterface
889890
{
890891
}
891892

892-
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
893+
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
893894
{
894895
}
895896

896-
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey)
897+
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey): ?Response
897898
{
898899
}
899900

900-
public function supportsRememberMe()
901+
public function supportsRememberMe(): bool
901902
{
902903
}
903904
}
@@ -922,20 +923,20 @@ public function createListeners(ContainerBuilder $container, string $firewallNam
922923
return ['custom_firewall_listener_id'];
923924
}
924925

925-
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint)
926+
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array
926927
{
927928
$container->register('provider_id', \stdClass::class);
928929
$container->register('listener_id', \stdClass::class);
929930

930931
return ['provider_id', 'listener_id', $defaultEntryPoint];
931932
}
932933

933-
public function getPosition()
934+
public function getPosition(): string
934935
{
935936
return 'form';
936937
}
937938

938-
public function getKey()
939+
public function getKey(): string
939940
{
940941
return 'custom_listener';
941942
}

Tests/Functional/Bundle/AnonymousBundle/AppCustomAuthenticator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class AppCustomAuthenticator extends AbstractGuardAuthenticator
2323
{
24-
public function supports(Request $request)
24+
public function supports(Request $request): bool
2525
{
2626
return false;
2727
}
@@ -30,28 +30,28 @@ public function getCredentials(Request $request)
3030
{
3131
}
3232

33-
public function getUser($credentials, UserProviderInterface $userProvider)
33+
public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface
3434
{
3535
}
3636

37-
public function checkCredentials($credentials, UserInterface $user)
37+
public function checkCredentials($credentials, UserInterface $user): bool
3838
{
3939
}
4040

41-
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
41+
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
4242
{
4343
}
4444

45-
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
45+
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): ?Response
4646
{
4747
}
4848

49-
public function start(Request $request, AuthenticationException $authException = null)
49+
public function start(Request $request, AuthenticationException $authException = null): Response
5050
{
5151
return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED);
5252
}
5353

54-
public function supportsRememberMe()
54+
public function supportsRememberMe(): bool
5555
{
5656
}
5757
}

Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function secureAction()
5454
/**
5555
* {@inheritdoc}
5656
*/
57-
public static function getSubscribedServices()
57+
public static function getSubscribedServices(): array
5858
{
5959
return [
6060
'form.factory' => FormFactoryInterface::class,

Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function homepageAction()
7171
/**
7272
* {@inheritdoc}
7373
*/
74-
public static function getSubscribedServices()
74+
public static function getSubscribedServices(): array
7575
{
7676
return [
7777
'twig' => Environment::class,

Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function secureAction()
6363
/**
6464
* {@inheritdoc}
6565
*/
66-
public static function getSubscribedServices()
66+
public static function getSubscribedServices(): array
6767
{
6868
return [
6969
'twig' => Environment::class,

Tests/Functional/Bundle/GuardedBundle/AppCustomAuthenticator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class AppCustomAuthenticator extends AbstractGuardAuthenticator
2323
{
24-
public function supports(Request $request)
24+
public function supports(Request $request): bool
2525
{
2626
return '/manual_login' !== $request->getPathInfo() && '/profile' !== $request->getPathInfo();
2727
}
@@ -31,29 +31,29 @@ public function getCredentials(Request $request)
3131
throw new AuthenticationException('This should be hit');
3232
}
3333

34-
public function getUser($credentials, UserProviderInterface $userProvider)
34+
public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface
3535
{
3636
}
3737

38-
public function checkCredentials($credentials, UserInterface $user)
38+
public function checkCredentials($credentials, UserInterface $user): bool
3939
{
4040
}
4141

42-
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
42+
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
4343
{
4444
return new Response('', 418);
4545
}
4646

47-
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
47+
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): ?Response
4848
{
4949
}
5050

51-
public function start(Request $request, AuthenticationException $authException = null)
51+
public function start(Request $request, AuthenticationException $authException = null): Response
5252
{
5353
return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED);
5454
}
5555

56-
public function supportsRememberMe()
56+
public function supportsRememberMe(): bool
5757
{
5858
}
5959
}

Tests/Functional/Bundle/LoginLink/TestCustomLoginLinkSuccessHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
use Symfony\Component\HttpFoundation\JsonResponse;
66
use Symfony\Component\HttpFoundation\Request;
7+
use Symfony\Component\HttpFoundation\Response;
78
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
89
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
910

1011
class TestCustomLoginLinkSuccessHandler implements AuthenticationSuccessHandlerInterface
1112
{
12-
public function onAuthenticationSuccess(Request $request, TokenInterface $token)
13+
public function onAuthenticationSuccess(Request $request, TokenInterface $token): Response
1314
{
1415
return new JsonResponse(['message' => sprintf('Welcome %s!', $token->getUserIdentifier())]);
1516
}

Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct($kernel)
2929
}
3030
}
3131

32-
public function loadTokenBySeries(string $series)
32+
public function loadTokenBySeries(string $series): PersistentTokenInterface
3333
{
3434
$token = self::$db[$series] ?? false;
3535
if (!$token) {

Tests/Functional/Bundle/RememberMeBundle/Security/UserChangingUserProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(InMemoryUserProvider $inner)
2626
$this->inner = $inner;
2727
}
2828

29-
public function loadUserByUsername($username)
29+
public function loadUserByUsername($username): UserInterface
3030
{
3131
return $this->inner->loadUserByUsername($username);
3232
}
@@ -36,7 +36,7 @@ public function loadUserByIdentifier(string $userIdentifier): UserInterface
3636
return $this->inner->loadUserByIdentifier($userIdentifier);
3737
}
3838

39-
public function refreshUser(UserInterface $user)
39+
public function refreshUser(UserInterface $user): UserInterface
4040
{
4141
$user = $this->inner->refreshUser($user);
4242

@@ -46,7 +46,7 @@ public function refreshUser(UserInterface $user)
4646
return $user;
4747
}
4848

49-
public function supportsClass($class)
49+
public function supportsClass($class): bool
5050
{
5151
return $this->inner->supportsClass($class);
5252
}

0 commit comments

Comments
 (0)