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
6 changes: 3 additions & 3 deletions src/Client/lib/Api/DefaultApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ class DefaultApi {
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
?ClientInterface $client = null,
?Configuration $config = null,
?HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public function getHostFromSettings( $index, $variables = null ) {
*
* @return string URL based on host settings
*/
public static function getHostString( array $hostsSettings, $hostIndex, array $variables = null ) {
public static function getHostString( array $hostsSettings, $hostIndex, ?array $variables = null ) {
if ( null === $variables ) {
$variables = [];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/BodySummarizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class BodySummarizer implements BodySummarizerInterface
*/
private $truncateAt;

public function __construct(int $truncateAt = null)
public function __construct(?int $truncateAt = null)
{
$this->truncateAt = $truncateAt;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ public function sendRequest( RequestInterface $request ): ResponseInterface {
* @return mixed
* @deprecated Client::getConfig will be removed in Plausible\Analytics\WP\Client\Lib\GuzzleHttp/guzzle:8.0.
*/
public function getConfig( string $option = null ) {
public function getConfig( ?string $option = null ) {
return $option === null ? $this->config : ( $this->config[ $option ] ?? null );
}
}
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ public function requestAsync(string $method, $uri, array $options = []): Promise
*
* @deprecated ClientInterface::getConfig will be removed in Plausible\Analytics\WP\Client\Lib\GuzzleHttp/guzzle:8.0.
*/
public function getConfig(string $option = null);
public function getConfig(?string $option = null);
}
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/Cookie/CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function toArray(): array
}, $this->getIterator()->getArrayCopy());
}

public function clear(string $domain = null, string $path = null, string $name = null): void
public function clear( ?string $domain = null, ?string $path = null, ?string $name = null ): void
{
if (!$domain) {
$this->cookies = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function setCookie(SetCookie $cookie): bool;
* @param string|null $path Clears cookies matching a domain and path
* @param string|null $name Clears cookies matching a domain, path, and name
*/
public function clear(string $domain = null, string $path = null, string $name = null): void;
public function clear( ?string $domain = null, ?string $path = null, ?string $name = null ): void;

/**
* Discard all sessions cookies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct(
string $message,
RequestInterface $request,
ResponseInterface $response,
\Throwable $previous = null,
?\Throwable $previous = null,
array $handlerContext = []
) {
parent::__construct($message, $request, $response, $previous, $handlerContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ConnectException extends TransferException implements NetworkExceptionInte
public function __construct(
string $message,
RequestInterface $request,
\Throwable $previous = null,
?\Throwable $previous = null,
array $handlerContext = []
) {
parent::__construct($message, 0, $previous);
Expand Down
10 changes: 5 additions & 5 deletions src/Client/lib/Lib/GuzzleHttp/Exception/RequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class RequestException extends TransferException implements RequestExceptionInte
public function __construct(
string $message,
RequestInterface $request,
ResponseInterface $response = null,
\Throwable $previous = null,
?ResponseInterface $response = null,
?\Throwable $previous = null,
array $handlerContext = []
) {
// Set the code of the exception if the response is set and not future.
Expand Down Expand Up @@ -63,10 +63,10 @@ public static function wrapException(RequestInterface $request, \Throwable $e):
*/
public static function create(
RequestInterface $request,
ResponseInterface $response = null,
\Throwable $previous = null,
?ResponseInterface $response = null,
?\Throwable $previous = null,
array $handlerContext = [],
BodySummarizerInterface $bodySummarizer = null
?BodySummarizerInterface $bodySummarizer = null
): self {
if (!$response) {
return new self(
Expand Down
6 changes: 3 additions & 3 deletions src/Client/lib/Lib/GuzzleHttp/Handler/MockHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MockHandler implements \Countable
* @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
* @param callable|null $onRejected Callback to invoke when the return value is rejected.
*/
public static function createWithMiddleware(array $queue = null, callable $onFulfilled = null, callable $onRejected = null): HandlerStack
public static function createWithMiddleware( ?array $queue = null, ?callable $onFulfilled = null, ?callable $onRejected = null ): HandlerStack
{
return HandlerStack::create(new self($queue, $onFulfilled, $onRejected));
}
Expand All @@ -66,7 +66,7 @@ public static function createWithMiddleware(array $queue = null, callable $onFul
* @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled.
* @param callable|null $onRejected Callback to invoke when the return value is rejected.
*/
public function __construct(array $queue = null, callable $onFulfilled = null, callable $onRejected = null)
public function __construct( ?array $queue = null, ?callable $onFulfilled = null, ?callable $onRejected = null )
{
$this->onFulfilled = $onFulfilled;
$this->onRejected = $onRejected;
Expand Down Expand Up @@ -200,7 +200,7 @@ public function reset(): void
private function invokeStats(
RequestInterface $request,
array $options,
ResponseInterface $response = null,
?ResponseInterface $response = null,
$reason = null
): void {
if (isset($options['on_stats'])) {
Expand Down
4 changes: 2 additions & 2 deletions src/Client/lib/Lib/GuzzleHttp/Handler/StreamHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ private function invokeStats(
array $options,
RequestInterface $request,
?float $startTime,
ResponseInterface $response = null,
\Throwable $error = null
?ResponseInterface $response = null,
?\Throwable $error = null
): void {
if (isset($options['on_stats'])) {
$stats = new TransferStats($request, $response, Utils::currentTime() - $startTime, $error, []);
Expand Down
6 changes: 3 additions & 3 deletions src/Client/lib/Lib/GuzzleHttp/HandlerStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class HandlerStack
* handler is provided, the best handler for your
* system will be utilized.
*/
public static function create(callable $handler = null): self
public static function create( ?callable $handler = null ): self
{
$stack = new self($handler ?: Utils::chooseHandler());
$stack->push(Middleware::httpErrors(), 'http_errors');
Expand All @@ -58,7 +58,7 @@ public static function create(callable $handler = null): self
/**
* @param (callable(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler.
*/
public function __construct(callable $handler = null)
public function __construct( ?callable $handler = null )
{
$this->handler = $handler;
}
Expand Down Expand Up @@ -131,7 +131,7 @@ public function hasHandler(): bool
* @param callable(callable): callable $middleware Middleware function
* @param string $name Name to register for this middleware.
*/
public function unshift(callable $middleware, string $name = null): void
public function unshift( callable $middleware, ?string $name = null ): void
{
\array_unshift($this->stack, [$middleware, $name]);
$this->cached = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/MessageFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(?string $template = self::CLF)
* @param ResponseInterface|null $response Response that was received
* @param \Throwable|null $error Exception that was received
*/
public function format(RequestInterface $request, ResponseInterface $response = null, \Throwable $error = null): string
public function format( RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null ): string
{
$cache = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ interface MessageFormatterInterface
* @param ResponseInterface|null $response Response that was received
* @param \Throwable|null $error Exception that was received
*/
public function format(RequestInterface $request, ResponseInterface $response = null, \Throwable $error = null): string;
public function format( RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null ): string;
}
6 changes: 3 additions & 3 deletions src/Client/lib/Lib/GuzzleHttp/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static function (ResponseInterface $response) use ($cookieJar, $request): Respon
*
* @return callable(callable): callable Returns a function that accepts the next handler.
*/
public static function httpErrors(BodySummarizerInterface $bodySummarizer = null): callable
public static function httpErrors( ?BodySummarizerInterface $bodySummarizer = null ): callable
{
return static function (callable $handler) use ($bodySummarizer): callable {
return static function ($request, array $options) use ($handler, $bodySummarizer) {
Expand Down Expand Up @@ -132,7 +132,7 @@ static function ($reason) use ($request, &$container, $options) {
*
* @return callable Returns a function that accepts the next handler.
*/
public static function tap(callable $before = null, callable $after = null): callable
public static function tap( ?callable $before = null, ?callable $after = null ): callable
{
return static function (callable $handler) use ($before, $after): callable {
return static function (RequestInterface $request, array $options) use ($handler, $before, $after) {
Expand Down Expand Up @@ -176,7 +176,7 @@ public static function redirect(): callable
*
* @return callable Returns a function that accepts the next handler.
*/
public static function retry(callable $decider, callable $delay = null): callable
public static function retry( callable $decider, ?callable $delay = null ): callable
{
return static function (callable $handler) use ($decider, $delay): RetryMiddleware {
return new RetryMiddleware($decider, $handler, $delay);
Expand Down
4 changes: 2 additions & 2 deletions src/Client/lib/Lib/GuzzleHttp/Promise/Coroutine.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public static function of(callable $generatorFn): self
}

public function then(
callable $onFulfilled = null,
callable $onRejected = null
?callable $onFulfilled = null,
?callable $onRejected = null
): PromiseInterface {
return $this->result->then($onFulfilled, $onRejected);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Client/lib/Lib/GuzzleHttp/Promise/Each.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ final class Each
*/
public static function of(
$iterable,
callable $onFulfilled = null,
callable $onRejected = null
?callable $onFulfilled = null,
?callable $onRejected = null
): PromiseInterface {
return (new EachPromise($iterable, [
'fulfilled' => $onFulfilled,
Expand All @@ -50,8 +50,8 @@ public static function of(
public static function ofLimit(
$iterable,
$concurrency,
callable $onFulfilled = null,
callable $onRejected = null
?callable $onFulfilled = null,
?callable $onRejected = null
): PromiseInterface {
return (new EachPromise($iterable, [
'fulfilled' => $onFulfilled,
Expand All @@ -72,7 +72,7 @@ public static function ofLimit(
public static function ofLimitAll(
$iterable,
$concurrency,
callable $onFulfilled = null
?callable $onFulfilled = null
): PromiseInterface {
return self::ofLimit(
$iterable,
Expand Down
4 changes: 2 additions & 2 deletions src/Client/lib/Lib/GuzzleHttp/Promise/FulfilledPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function __construct($value)
}

public function then(
callable $onFulfilled = null,
callable $onRejected = null
?callable $onFulfilled = null,
?callable $onRejected = null
): PromiseInterface {
// Return itself if there is no onFulfilled function.
if (!$onFulfilled) {
Expand Down
8 changes: 4 additions & 4 deletions src/Client/lib/Lib/GuzzleHttp/Promise/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ class Promise implements PromiseInterface
* @param callable $cancelFn Fn that when invoked cancels the promise.
*/
public function __construct(
callable $waitFn = null,
callable $cancelFn = null
?callable $waitFn = null,
?callable $cancelFn = null
) {
$this->waitFn = $waitFn;
$this->cancelFn = $cancelFn;
}

public function then(
callable $onFulfilled = null,
callable $onRejected = null
?callable $onFulfilled = null,
?callable $onRejected = null
): PromiseInterface {
if ($this->state === self::PENDING) {
$p = new Promise(null, [$this, 'cancel']);
Expand Down
4 changes: 2 additions & 2 deletions src/Client/lib/Lib/GuzzleHttp/Promise/PromiseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ interface PromiseInterface
* @param callable $onRejected Invoked when the promise is rejected.
*/
public function then(
callable $onFulfilled = null,
callable $onRejected = null
?callable $onFulfilled = null,
?callable $onRejected = null
): PromiseInterface;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Client/lib/Lib/GuzzleHttp/Promise/RejectedPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function __construct($reason)
}

public function then(
callable $onFulfilled = null,
callable $onRejected = null
?callable $onFulfilled = null,
?callable $onRejected = null
): PromiseInterface {
// If there's no onRejected callback then just return self.
if (!$onRejected) {
Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/Promise/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class Utils
*
* @param TaskQueueInterface|null $assign Optionally specify a new queue instance.
*/
public static function queue(TaskQueueInterface $assign = null): TaskQueueInterface
public static function queue(?TaskQueueInterface $assign = null): TaskQueueInterface
{
static $queue;

Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/Psr7/CachingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class CachingStream implements StreamInterface
*/
public function __construct(
StreamInterface $stream,
StreamInterface $target = null
?StreamInterface $target = null
) {
$this->remoteStream = $stream;
$this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+'));
Expand Down
6 changes: 3 additions & 3 deletions src/Client/lib/Lib/GuzzleHttp/Psr7/HttpFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ final class HttpFactory implements RequestFactoryInterface, ResponseFactoryInter
{
public function createUploadedFile(
StreamInterface $stream,
int $size = null,
?int $size = null,
int $error = \UPLOAD_ERR_OK,
string $clientFilename = null,
string $clientMediaType = null
?string $clientFilename = null,
?string $clientMediaType = null
): UploadedFileInterface {
if ($size === null) {
$size = $stream->getSize();
Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/Psr7/MultipartStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class MultipartStream implements StreamInterface
*
* @throws \InvalidArgumentException
*/
public function __construct(array $elements = [], string $boundary = null)
public function __construct( array $elements = [], ?string $boundary = null )
{
$this->boundary = $boundary ?: bin2hex(random_bytes(20));
$this->stream = $this->createStream($elements);
Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/Psr7/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function __construct(
array $headers = [],
$body = null,
string $version = '1.1',
string $reason = null
?string $reason = null
) {
$this->assertStatusCodeRange($status);

Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/Psr7/StreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function register(): void
}
}

public function stream_open(string $path, string $mode, int $options, string &$opened_path = null): bool
public function stream_open( string $path, string $mode, int $options, ?string &$opened_path = null ): bool
{
$options = stream_context_get_options($this->context);

Expand Down
4 changes: 2 additions & 2 deletions src/Client/lib/Lib/GuzzleHttp/Psr7/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public function __construct(
$streamOrFile,
?int $size,
int $errorStatus,
string $clientFilename = null,
string $clientMediaType = null
?string $clientFilename = null,
?string $clientMediaType = null
) {
$this->setError($errorStatus);
$this->size = $size;
Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/Psr7/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public static function isRelativePathReference(UriInterface $uri): bool
*
* @see https://tools.ietf.org/html/rfc3986#section-4.4
*/
public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool
public static function isSameDocumentReference( UriInterface $uri, ?UriInterface $base = null ): bool
{
if ($base !== null) {
$uri = UriResolver::resolve($base, $uri);
Expand Down
2 changes: 1 addition & 1 deletion src/Client/lib/Lib/GuzzleHttp/Psr7/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public static function modifyRequest(RequestInterface $request, array $changes):
* @param StreamInterface $stream Stream to read from
* @param int|null $maxLength Maximum buffer length
*/
public static function readLine(StreamInterface $stream, int $maxLength = null): string
public static function readLine( StreamInterface $stream, ?int $maxLength = null ): string
{
$buffer = '';
$size = 0;
Expand Down
Loading