Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
j0k3r committed Mar 5, 2024
1 parent f9b8943 commit 6025cff
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/Imgur/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class AbstractApi
*/
protected $pager;

public function __construct(Client $client, PagerInterface $pager = null)
public function __construct(Client $client, ?PagerInterface $pager = null)
{
$this->client = $client;
$this->pager = $pager;
Expand Down
4 changes: 2 additions & 2 deletions lib/Imgur/Auth/AuthInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interface AuthInterface
* @param string $responseType (code, token, pin) Determines if Imgur should return an authorization_code, a PIN code, or an opaque access_token
* @param string $state Any value which you want Imgur to pass back
*/
public function getAuthenticationUrl(string $responseType = 'code', string $state = null): string;
public function getAuthenticationUrl(string $responseType = 'code', ?string $state = null): string;

public function getAccessToken(): ?array;

public function requestAccessToken(string $code, string $requestType = null): array;
public function requestAccessToken(string $code, ?string $requestType = null): array;

public function setAccessToken(array $accessToken): void;

Expand Down
6 changes: 3 additions & 3 deletions lib/Imgur/Auth/OAuth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct(HttpClientInterface $httpClient, string $clientId, s
/**
* Generates the authentication URL to which a user should be pointed at in order to start the OAuth2 process.
*/
public function getAuthenticationURL(string $responseType = 'code', string $state = null): string
public function getAuthenticationURL(string $responseType = 'code', ?string $state = null): string
{
$httpQueryParameters = [
'client_id' => $this->clientId,
Expand All @@ -88,7 +88,7 @@ public function getAuthenticationURL(string $responseType = 'code', string $stat
/**
* Exchanges a code/pin for an access token.
*/
public function requestAccessToken(string $code, string $requestType = null): array
public function requestAccessToken(string $code, ?string $requestType = null): array
{
switch ($requestType) {
case 'pin':
Expand Down Expand Up @@ -166,7 +166,7 @@ public function refreshToken(): array
*
* @throws AuthException
*/
public function setAccessToken(array $token = null): void
public function setAccessToken(?array $token = null): void
{
if (!\is_array($token)) {
throw new AuthException('Token is not a valid json string.');
Expand Down
8 changes: 4 additions & 4 deletions lib/Imgur/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Client
*
* @param HttpClientInterface|null $httpClient Imgur http client
*/
public function __construct(AuthInterface $authenticationClient = null, HttpClientInterface $httpClient = null)
public function __construct(?AuthInterface $authenticationClient = null, ?HttpClientInterface $httpClient = null)
{
$this->httpClient = $httpClient;
$this->authenticationClient = $authenticationClient;
Expand All @@ -51,7 +51,7 @@ public function __construct(AuthInterface $authenticationClient = null, HttpClie
/**
* @throws InvalidArgumentException
*/
public function api(string $name, PagerInterface $pager = null): AbstractApi
public function api(string $name, ?PagerInterface $pager = null): AbstractApi
{
if (!$this->getAccessToken()) {
$this->sign();
Expand Down Expand Up @@ -97,7 +97,7 @@ public function getOption(string $name): ?string
/**
* @throws InvalidArgumentException
*/
public function setOption(string $name, string $value = null): void
public function setOption(string $name, ?string $value = null): void
{
if (!\array_key_exists($name, $this->options)) {
throw new InvalidArgumentException(sprintf('Undefined option called: "%s"', $name));
Expand Down Expand Up @@ -125,7 +125,7 @@ public function getAuthenticationClient(): AuthInterface
/**
* Proxy method for the authentication objects URL building method.
*/
public function getAuthenticationUrl(string $responseType = 'code', string $state = null): string
public function getAuthenticationUrl(string $responseType = 'code', ?string $state = null): string
{
return $this->getAuthenticationClient()->getAuthenticationUrl($responseType, $state);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Imgur/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class HttpClient implements HttpClientInterface
/** @var HandlerStack */
protected $stack;

public function __construct(array $options = [], ClientInterface $client = null, HandlerStack $stack = null)
public function __construct(array $options = [], ?ClientInterface $client = null, ?HandlerStack $stack = null)
{
$this->options = array_merge($options, $this->options);

Expand Down
2 changes: 1 addition & 1 deletion tests/HttpClient/HttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ class TestHttpClient extends HttpClient
/**
* @return array|string|null
*/
public function getOption(string $name, string $default = null)
public function getOption(string $name, ?string $default = null)
{
return $this->options[$name] ?? $default;
}
Expand Down

0 comments on commit 6025cff

Please sign in to comment.