Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,12 @@ parameters:
count: 1
path: src/Http/Middleware/ServerErrorHandler.php

-
message: '#^Binary operation "\." between non\-falsy\-string and array\<mixed\>\|string results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: src/Http/UriTemplate.php

-
message: '#^Method ShoppingFeed\\Sdk\\Http\\UriTemplate\:\:expand\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -936,6 +942,12 @@ parameters:
count: 1
path: src/Http/UriTemplate.php

-
message: '#^Parameter \#2 \$array of function implode expects array\<string\>, array\<array\<mixed\>\|string\> given\.$#'
identifier: argument.type
count: 1
path: src/Http/UriTemplate.php

-
message: '#^Property ShoppingFeed\\Sdk\\Http\\UriTemplate\:\:\$delims type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down
9 changes: 2 additions & 7 deletions src/Client/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@ class Client
private $client;

/**
* @param ClientOptions|null $options
*
* @return \ShoppingFeed\Sdk\Api\Session\SessionResource
*/
public static function createSession(CredentialInterface $credential, ClientOptions $options = null)
public static function createSession(CredentialInterface $credential, ?ClientOptions $options = null)
{
return (new self($options))->authenticate($credential);
}

/**
* @param ClientOptions|null $options
*/
public function __construct(ClientOptions $options = null)
public function __construct(?ClientOptions $options = null)
{
if (null === $options) {
$options = new ClientOptions();
Expand Down
12 changes: 4 additions & 8 deletions src/Hal/HalLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ public function delete($data, array $variables = [], array $options = [])
*/
public function batchSend(
$requests,
callable $success = null,
callable $error = null,
?callable $success = null,
?callable $error = null,
array $options = [],
$concurrency = 10,
) {
Expand Down Expand Up @@ -255,11 +255,9 @@ public function createRequest($method, array $variables = [], $body = null, $hea
}

/**
* @param callable|null $callback
*
* @return \Closure
*/
private function createResponseCallback(callable $callback = null)
private function createResponseCallback(?callable $callback = null)
{
return function (ResponseInterface $response) use ($callback) {
if ($callback) {
Expand All @@ -270,11 +268,9 @@ private function createResponseCallback(callable $callback = null)
}

/**
* @param callable|null $callback
*
* @return \Closure
*/
private function createExceptionCallback(callable $callback = null)
private function createExceptionCallback(?callable $callback = null)
{
return function (Exception $exception) use ($callback) {
call_user_func($callback, $exception);
Expand Down
8 changes: 3 additions & 5 deletions src/Http/Adapter/GuzzleHTTPAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class GuzzleHTTPAdapter implements Http\Adapter\AdapterInterface
private $pool;

public function __construct(
Client\ClientOptions $options = null,
GuzzleHttp\HandlerStack $stack = null,
?Client\ClientOptions $options = null,
?GuzzleHttp\HandlerStack $stack = null,
) {
$this->options = $options ?: new Client\ClientOptions();
$this->stack = $stack ?: $this->createHandlerStack();
Expand Down Expand Up @@ -106,11 +106,9 @@ public function withToken($token)
}

/**
* @param callable|null $callback
*
* @return \Closure
*/
private function createExceptionCallback(callable $callback = null)
private function createExceptionCallback(?callable $callback = null)
{
return function (GuzzleHttp\Exception\TransferException $exception) use ($callback) {
if ($callback && $exception instanceof GuzzleHttp\Exception\RequestException && $exception->hasResponse()) {
Expand Down
10 changes: 4 additions & 6 deletions src/Http/Middleware/RateLimitHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,20 @@ class RateLimitHandler
private $logger;

/**
* @param int $maxRetries
* @param LoggerInterface|null $logger
* @param int $maxRetries
*/
public function __construct($maxRetries = 3, LoggerInterface $logger = null)
public function __construct($maxRetries = 3, ?LoggerInterface $logger = null)
{
$this->maxRetries = (int) $maxRetries;
$this->logger = $logger;
}

/**
* @param int $count
* @param ResponseInterface|null $response
* @param int $count
*
* @return bool
*/
public function decide($count, RequestInterface $request, ResponseInterface $response = null)
public function decide($count, RequestInterface $request, ?ResponseInterface $response = null)
{
if (! $response || $count >= $this->maxRetries) {
return false;
Expand Down
5 changes: 2 additions & 3 deletions src/Http/Middleware/ServerErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ public function __construct($maxRetries = 3)
}

/**
* @param int $count
* @param ResponseInterface|null $response
* @param int $count
*
* @return bool
*/
public function decide($count, RequestInterface $request, ResponseInterface $response = null)
public function decide($count, RequestInterface $request, ?ResponseInterface $response = null)
{
if ($count >= $this->maxRetries) {
return false;
Expand Down
Loading