Skip to content

Commit

Permalink
Make nullable parameter types explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Mar 15, 2024
1 parent 074c34a commit a1429d6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
$message,
RequestInterface $request,
ResponseInterface $response,
\Exception $previous = null
?\Exception $previous = null
) {
parent::__construct($message, $request, $previous);

Expand All @@ -50,7 +50,7 @@ public function getResponse()
public static function create(
RequestInterface $request,
ResponseInterface $response,
\Exception $previous = null
?\Exception $previous = null
) {
$message = sprintf(
'[url] %s [http method] %s [status code] %s [reason phrase] %s',
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/NetworkException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class NetworkException extends TransferException implements PsrNetworkException
/**
* @param string $message
*/
public function __construct($message, RequestInterface $request, \Exception $previous = null)
public function __construct($message, RequestInterface $request, ?\Exception $previous = null)
{
$this->setRequest($request);

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/RequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RequestException extends TransferException implements PsrRequestException
/**
* @param string $message
*/
public function __construct($message, RequestInterface $request, \Exception $previous = null)
public function __construct($message, RequestInterface $request, ?\Exception $previous = null)
{
$this->setRequest($request);

Expand Down
2 changes: 1 addition & 1 deletion src/Promise/HttpFulfilledPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(ResponseInterface $response)
$this->response = $response;
}

public function then(callable $onFulfilled = null, callable $onRejected = null)
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
{
if (null === $onFulfilled) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Promise/HttpRejectedPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(Exception $exception)
$this->exception = $exception;
}

public function then(callable $onFulfilled = null, callable $onRejected = null)
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
{
if (null === $onRejected) {
return $this;
Expand Down

0 comments on commit a1429d6

Please sign in to comment.