Skip to content

Commit

Permalink
PHP 8.4 fix implicitly nullable via default value null
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubinix committed Dec 9, 2024
1 parent 3e49b43 commit 8afe5aa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ abstract class AbstractApi
/** @var ResponseMediator */
private $responseMediator;

public function __construct(Client $client, ResponseMediator $responseMediator = null)
public function __construct(Client $client, ?ResponseMediator $responseMediator = null)
{
$this->client = $client;
$this->responseMediator = $responseMediator ? $responseMediator : new ResponseMediator();
$this->responseMediator = $responseMediator ? : new ResponseMediator();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Client
private $responseMediator;

/** @param string $privatePackagistUrl */
public function __construct(HttpPluginClientBuilder $httpClientBuilder = null, $privatePackagistUrl = null, ResponseMediator $responseMediator = null)
public function __construct(?HttpPluginClientBuilder $httpClientBuilder = null, $privatePackagistUrl = null, ?ResponseMediator $responseMediator = null)
{
$this->httpClientBuilder = $builder = $httpClientBuilder ?: new HttpPluginClientBuilder();
$privatePackagistUrl = $privatePackagistUrl ? : 'https://packagist.com';
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpTransportException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HttpTransportException extends RuntimeException
{
private $requestUri;

public function __construct($message = "", $code = 0, $requestUri = "", Throwable $previous = null)
public function __construct($message = "", $code = 0, $requestUri = "", ?Throwable $previous = null)
{
$this->requestUri = $requestUri;
parent::__construct($message, $code, $previous);
Expand Down
4 changes: 2 additions & 2 deletions src/HttpClient/Plugin/ExceptionThrower.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class ExceptionThrower implements Plugin
/** @var ResponseMediator */
private $responseMediator;

public function __construct(ResponseMediator $responseMediator = null)
public function __construct(?ResponseMediator $responseMediator = null)
{
$this->responseMediator = $responseMediator ? $responseMediator : new ResponseMediator();
$this->responseMediator = $responseMediator ? : new ResponseMediator();
}

protected function doHandleRequest(RequestInterface $request, callable $next, callable $first)
Expand Down

0 comments on commit 8afe5aa

Please sign in to comment.