Skip to content

Commit

Permalink
Merge pull request #359 from HubSpot/feature/csFix
Browse files Browse the repository at this point in the history
Code style fix
  • Loading branch information
ksvirkou-hubspot authored Apr 18, 2024
2 parents c25c400 + 1033927 commit d9e757a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '7.4'

- run: "composer install --no-interaction --no-progress --no-suggest"

Expand Down
8 changes: 4 additions & 4 deletions lib/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
*/
class Factory
{
public static function create(ClientInterface $client = null, Config $config = null): Discovery
public static function create(?ClientInterface $client = null, ?Config $config = null): Discovery
{
return new Discovery($client ?: new Client(), $config ?: new Config());
}

public static function createWithApiKey(string $apiKey, ClientInterface $client = null): Discovery
public static function createWithApiKey(string $apiKey, ?ClientInterface $client = null): Discovery
{
$config = new Config();
$config->setApiKey($apiKey);

return static::create($client, $config);
}

public static function createWithDeveloperApiKey(string $apiKey, ClientInterface $client = null): Discovery
public static function createWithDeveloperApiKey(string $apiKey, ?ClientInterface $client = null): Discovery
{
$config = new Config();
$config->setDeveloperApiKey($apiKey);

return static::create($client, $config);
}

public static function createWithAccessToken(string $accessToken, ClientInterface $client = null): Discovery
public static function createWithAccessToken(string $accessToken, ?ClientInterface $client = null): Discovery
{
$config = new Config();
$config->setAccessToken($accessToken);
Expand Down
8 changes: 4 additions & 4 deletions lib/RetryMiddlewareFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
class RetryMiddlewareFactory
{
public static function createInternalErrorsMiddleware(
callable $delayFunction = null,
?callable $delayFunction = null,
int $maxRetries = 5
) {
return static::createMiddlewareByHttpCodeRange(500, 504, $delayFunction, $maxRetries);
}

public static function createRateLimitMiddleware(
callable $delayFunction = null,
?callable $delayFunction = null,
int $maxRetries = 5
) {
return static::createMiddlewareByHttpCodes([429], $delayFunction, $maxRetries);
Expand Down Expand Up @@ -53,7 +53,7 @@ public static function getRetryFunctionByRange(
return function (
$retries,
Request $request,
Response $response = null
?Response $response = null
) use ($from, $to, $maxRetries) {
if ($retries >= $maxRetries) {
return false;
Expand All @@ -74,7 +74,7 @@ public static function getRetryFunction(array $codes, int $maxRetries = 5)
return function (
$retries,
Request $request,
Response $response = null
?Response $response = null
) use ($codes, $maxRetries) {
if ($retries >= $maxRetries) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Utils/SignatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public function unexpectedValueExceptionTimestampTest(): void
public static function generateHubspotSignatureV3(
string $secret,
string $requestBody,
string $httpUri = null,
?string $httpUri = null,
string $httpMethod = 'POST',
int $timestamp = null
?int $timestamp = null
): string {
$sourceString = $httpMethod.$httpUri.$requestBody.$timestamp;

Expand Down

0 comments on commit d9e757a

Please sign in to comment.