Skip to content

Commit

Permalink
Run cs-fixer against codebase
Browse files Browse the repository at this point in the history
stloyd committed Feb 9, 2024
1 parent 96c4474 commit ea8e416
Showing 16 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Connect/AbstractController.php
Original file line number Diff line number Diff line change
@@ -168,7 +168,7 @@ protected function getConfirmationResponse(Request $request, array $accessToken,
/**
* @param Event|DeprecatedEvent $event
*/
protected function dispatch($event, string $eventName = null): void
protected function dispatch($event, ?string $eventName = null): void
{
$this->dispatcher->dispatch($event, $eventName);
}
2 changes: 1 addition & 1 deletion src/OAuth/Exception/HttpTransportException.php
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ final class HttpTransportException extends AuthenticationException
{
private string $ownerName;

public function __construct(string $message, string $ownerName, int $code = 0, \Throwable $previous = null)
public function __construct(string $message, string $ownerName, int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
$this->ownerName = $ownerName;
2 changes: 1 addition & 1 deletion src/OAuth/ResourceOwner/AbstractResourceOwner.php
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ public function addStateParameter(string $key, string $value): void
/**
* {@inheritdoc}
*/
public function storeState(StateInterface $state = null): void
public function storeState(?StateInterface $state = null): void
{
if (null === $state || 0 === \count($state->getAll())) {
return;
4 changes: 2 additions & 2 deletions src/OAuth/ResourceOwner/QQResourceOwner.php
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ public function getResponseContent(ResponseInterface $rawResponse): array
/**
* {@inheritdoc}
*/
public function getUserInformation(array $accessToken = null, array $extraParameters = [])
public function getUserInformation(?array $accessToken = null, array $extraParameters = [])
{
$openid = $extraParameters['openid'] ?? $this->requestUserIdentifier($accessToken);

@@ -90,7 +90,7 @@ protected function configureOptions(OptionsResolver $resolver)
]);
}

private function requestUserIdentifier(array $accessToken = null)
private function requestUserIdentifier(?array $accessToken = null)
{
$url = $this->normalizeUrl($this->options['me_url'], [
'access_token' => $accessToken['access_token'],
2 changes: 1 addition & 1 deletion src/OAuth/ResourceOwner/SinaWeiboResourceOwner.php
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ final class SinaWeiboResourceOwner extends GenericOAuth2ResourceOwner
/**
* {@inheritdoc}
*/
public function getUserInformation(array $accessToken = null, array $extraParameters = [])
public function getUserInformation(?array $accessToken = null, array $extraParameters = [])
{
$url = $this->normalizeUrl($this->options['infos_url'], [
'access_token' => $accessToken['access_token'],
2 changes: 1 addition & 1 deletion src/OAuth/ResourceOwner/SpotifyResourceOwner.php
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ final class SpotifyResourceOwner extends GenericOAuth2ResourceOwner
/**
* {@inheritdoc}
*/
public function getUserInformation(array $accessToken = null, array $extraParameters = [])
public function getUserInformation(?array $accessToken = null, array $extraParameters = [])
{
$url = $this->normalizeUrl($this->options['infos_url'], [
'access_token' => $accessToken['access_token'],
2 changes: 1 addition & 1 deletion src/OAuth/ResourceOwnerInterface.php
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ public function refreshAccessToken($refreshToken, array $extraParameters = []);

public function getState(): StateInterface;

public function storeState(StateInterface $state = null);
public function storeState(?StateInterface $state = null);

public function addStateParameter(string $key, string $value): void;
}
2 changes: 1 addition & 1 deletion src/OAuth/State/State.php
Original file line number Diff line number Diff line change
@@ -130,7 +130,7 @@ public function encode(): ?string
*
* @return array<string,string>|null
*/
private function parseStringParameter(string $queryParameter = null): ?array
private function parseStringParameter(?string $queryParameter = null): ?array
{
$urlDecoded = $queryParameter ? urldecode($queryParameter) : '';

2 changes: 1 addition & 1 deletion src/Security/Core/User/EntityUserProvider.php
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ final class EntityUserProvider implements UserProviderInterface, OAuthAwareUserP
* @param string $class User entity class to load
* @param array<string, string> $properties Mapping of resource owners to properties
*/
public function __construct(ManagerRegistry $registry, string $class, array $properties, string $managerName = null)
public function __construct(ManagerRegistry $registry, string $class, array $properties, ?string $managerName = null)
{
$this->em = $registry->getManager($managerName);
$this->class = $class;
4 changes: 2 additions & 2 deletions src/Security/Http/Authenticator/OAuthAuthenticator.php
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ public function supports(Request $request): bool
return false;
}

public function start(Request $request, AuthenticationException $authException = null): Response
public function start(Request $request, ?AuthenticationException $authException = null): Response
{
if ($this->options['use_forward'] ?? false) {
$subRequest = $this->httpUtils->createRequest($request, $this->options['login_path']);
@@ -209,7 +209,7 @@ public function refreshToken(OAuthToken $token): OAuthToken
*
* @return T
*/
public function recreateToken(OAuthToken $token, UserInterface $user = null): OAuthToken
public function recreateToken(OAuthToken $token, ?UserInterface $user = null): OAuthToken
{
$user = $user instanceof UserInterface ? $user : $token->getUser();

2 changes: 1 addition & 1 deletion src/Security/Http/EntryPoint/OAuthEntryPoint.php
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ public function __construct(HttpKernelInterface $kernel, HttpUtils $httpUtils, s
/**
* {@inheritdoc}
*/
public function start(Request $request, AuthenticationException $authException = null): Response
public function start(Request $request, ?AuthenticationException $authException = null): Response
{
if ($this->useForward) {
$subRequest = $this->httpUtils->createRequest($request, $this->loginPath);
4 changes: 2 additions & 2 deletions src/Security/OAuthUtils.php
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ public function getResourceOwners(): array
return array_keys($resourceOwners);
}

public function getAuthorizationUrl(Request $request, string $name, string $redirectUrl = null, array $extraParameters = []): string
public function getAuthorizationUrl(Request $request, string $name, ?string $redirectUrl = null, array $extraParameters = []): string
{
$resourceOwner = $this->getResourceOwner($name);

@@ -252,7 +252,7 @@ private function getCurrentFirewallName(Request $request): ?string
return null === $firewallConfig ? null : $firewallConfig->getName();
}

private function getResourceOwnerCheckPath(string $name, string $firewallName = null): ?string
private function getResourceOwnerCheckPath(string $name, ?string $firewallName = null): ?string
{
$resourceOwnerMaps = $this->ownerMaps;

Original file line number Diff line number Diff line change
@@ -436,7 +436,7 @@ protected function createResourceOwner(
array $options = [],
array $paths = [],
array $responses = [],
StateInterface $state = null
?StateInterface $state = null
): GenericOAuth2ResourceOwner {
/** @var GenericOAuth2ResourceOwner $resourceOwner */
$resourceOwner = parent::createResourceOwner($options, $paths, $responses);
2 changes: 1 addition & 1 deletion src/Test/OAuth/ResourceOwner/ResourceOwnerTestCase.php
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ abstract class ResourceOwnerTestCase extends TestCase
/** @var class-string */
protected string $resourceOwnerClass;

protected function createMockResponse(?string $response, string $contentType = null, int $httpCode = null): MockResponse
protected function createMockResponse(?string $response, ?string $contentType = null, ?int $httpCode = null): MockResponse
{
return new MockResponse(
$response ?: '',
2 changes: 1 addition & 1 deletion src/Twig/Extension/OAuthRuntime.php
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ public function getLoginUrl(string $name): string
return $this->oauthUtils->getLoginUrl($this->getMainRequest(), $name);
}

public function getAuthorizationUrl(string $name, string $redirectUrl = null, array $extraParameters = []): string
public function getAuthorizationUrl(string $name, ?string $redirectUrl = null, array $extraParameters = []): string
{
return $this->oauthUtils->getAuthorizationUrl($this->getMainRequest(), $name, $redirectUrl, $extraParameters);
}
2 changes: 1 addition & 1 deletion tests/Fixtures/CustomResourceOwner.php
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ public function addStateParameter(string $key, string $value): void
{
}

public function storeState(StateInterface $state = null): void
public function storeState(?StateInterface $state = null): void
{
}
}

0 comments on commit ea8e416

Please sign in to comment.