Skip to content

Commit

Permalink
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_…
Browse files Browse the repository at this point in the history
…null_value
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
1 parent 6477c31 commit ed19471
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions DataCollector/SecurityDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
private $hasVarDumper;
private $authenticatorManagerEnabled;

public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null, bool $authenticatorManagerEnabled = false)
public function __construct(?TokenStorageInterface $tokenStorage = null, ?RoleHierarchyInterface $roleHierarchy = null, ?LogoutUrlGenerator $logoutUrlGenerator = null, ?AccessDecisionManagerInterface $accessDecisionManager = null, ?FirewallMapInterface $firewallMap = null, ?TraceableFirewallListener $firewall = null, bool $authenticatorManagerEnabled = false)
{
if (!$authenticatorManagerEnabled) {
trigger_deprecation('symfony/security-bundle', '5.4', 'Setting the $authenticatorManagerEnabled argument of "%s" to "false" is deprecated, use the new authenticator system instead.', __METHOD__);
Expand All @@ -65,7 +65,7 @@ public function __construct(TokenStorageInterface $tokenStorage = null, RoleHier
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Throwable $exception = null)
public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
if (null === $this->tokenStorage) {
$this->data = [
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/SecurityExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ private function createContextListener(ContainerBuilder $container, string $cont
return $this->contextListeners[$contextKey] = $listenerId;
}

private function createAuthenticationListeners(ContainerBuilder $container, string $id, array $firewall, array &$authenticationProviders, ?string $defaultProvider, array $providerIds, ?string $defaultEntryPoint, string $contextListenerId = null)
private function createAuthenticationListeners(ContainerBuilder $container, string $id, array $firewall, array &$authenticationProviders, ?string $defaultProvider, array $providerIds, ?string $defaultEntryPoint, ?string $contextListenerId = null)
{
$listeners = [];
$hasListeners = false;
Expand Down Expand Up @@ -1060,7 +1060,7 @@ private function createExpression(ContainerBuilder $container, string $expressio
return $this->expressions[$id] = new Reference($id);
}

private function createRequestMatcher(ContainerBuilder $container, string $path = null, string $host = null, int $port = null, array $methods = [], array $ips = null, array $attributes = []): Reference
private function createRequestMatcher(ContainerBuilder $container, ?string $path = null, ?string $host = null, ?int $port = null, array $methods = [], ?array $ips = null, array $attributes = []): Reference
{
if ($methods) {
$methods = array_map('strtoupper', $methods);
Expand Down
2 changes: 1 addition & 1 deletion LoginLink/FirewallAwareLoginLinkHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(FirewallMap $firewallMap, ContainerInterface $loginL
$this->requestStack = $requestStack;
}

public function createLoginLink(UserInterface $user, Request $request = null): LoginLinkDetails
public function createLoginLink(UserInterface $user, ?Request $request = null): LoginLinkDetails
{
return $this->getForFirewall()->createLoginLink($user, $request);
}
Expand Down
2 changes: 1 addition & 1 deletion Security/FirewallConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class FirewallConfig
private $authenticators;
private $switchUser;

public function __construct(string $name, string $userChecker, string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, string $provider = null, string $context = null, string $entryPoint = null, string $accessDeniedHandler = null, string $accessDeniedUrl = null, array $authenticators = [], array $switchUser = null)
public function __construct(string $name, string $userChecker, ?string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, ?string $provider = null, ?string $context = null, ?string $entryPoint = null, ?string $accessDeniedHandler = null, ?string $accessDeniedUrl = null, array $authenticators = [], ?array $switchUser = null)
{
$this->name = $name;
$this->userChecker = $userChecker;
Expand Down
2 changes: 1 addition & 1 deletion Security/FirewallContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FirewallContext
/**
* @param iterable<mixed, callable> $listeners
*/
public function __construct(iterable $listeners, ExceptionListener $exceptionListener = null, LogoutListener $logoutListener = null, FirewallConfig $config = null)
public function __construct(iterable $listeners, ?ExceptionListener $exceptionListener = null, ?LogoutListener $logoutListener = null, ?FirewallConfig $config = null)
{
$this->listeners = $listeners;
$this->exceptionListener = $exceptionListener;
Expand Down
4 changes: 2 additions & 2 deletions Tests/DataCollector/SecurityDataCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function testCollectCollectsDecisionLogWhenStrategyIsAffirmative()
$voter2 = new DummyVoter();

$decoratedVoter1 = new TraceableVoter($voter1, new class() implements EventDispatcherInterface {
public function dispatch(object $event, string $eventName = null): object
public function dispatch(object $event, ?string $eventName = null): object
{
return new \stdClass();
}
Expand Down Expand Up @@ -305,7 +305,7 @@ public function testCollectCollectsDecisionLogWhenStrategyIsUnanimous()
$voter2 = new DummyVoter();

$decoratedVoter1 = new TraceableVoter($voter1, new class() implements EventDispatcherInterface {
public function dispatch(object $event, string $eventName = null): object
public function dispatch(object $event, ?string $eventName = null): object
{
return new \stdClass();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
], JsonResponse::HTTP_FORBIDDEN);
}

public function start(Request $request, AuthenticationException $authException = null): Response
public function start(Request $request, ?AuthenticationException $authException = null): Response
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
{
}

public function start(Request $request, AuthenticationException $authException = null): Response
public function start(Request $request, ?AuthenticationException $authException = null): Response
{
return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class EntryPointStub implements AuthenticationEntryPointInterface
{
public const RESPONSE_TEXT = '2be8e651259189d841a19eecdf37e771e2431741';

public function start(Request $request, AuthenticationException $authException = null): Response
public function start(Request $request, ?AuthenticationException $authException = null): Response
{
return new Response(self::RESPONSE_TEXT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(ContainerInterface $container)
$this->container = $container;
}

public function loginAction(Request $request, UserInterface $user = null)
public function loginAction(Request $request, ?UserInterface $user = null)
{
// get the login error if there is one
if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
{
}

public function start(Request $request, AuthenticationException $authException = null): Response
public function start(Request $request, ?AuthenticationException $authException = null): Response
{
return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function manualLoginAction(GuardAuthenticatorHandler $guardAuthenticatorH
return new Response('Logged in.');
}

public function profileAction(UserInterface $user = null)
public function profileAction(?UserInterface $user = null)
{
if (null === $user) {
return new Response('Not logged in.');
Expand Down

0 comments on commit ed19471

Please sign in to comment.