Skip to content

Commit

Permalink
PHP 8.4 nullable parameters fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dakujem committed Nov 22, 2024
1 parent 5a35196 commit da40d06
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/CurrencyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CurrencyService implements CurrencyServiceInterface, ExchangeServiceInterf
protected $exchangeArgs = [];


public function __construct(ExchangeRateProviderInterface $exchange = null)
public function __construct(?ExchangeRateProviderInterface $exchange = null)
{
$exchange !== null && $this->setExchangeRateProvider($exchange);
}
Expand Down Expand Up @@ -262,7 +262,7 @@ public function getExchangeRateProvider(): ExchangeRateProviderInterface
}


public function setExchangeRateProvider(ExchangeRateProviderInterface $exchange = null): self
public function setExchangeRateProvider(?ExchangeRateProviderInterface $exchange = null): self
{
$this->exchange = $exchange;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/MathException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class MathException extends RuntimeException
{
public function __construct($message = null, $code = null, Throwable $previous = null)
public function __construct($message = null, $code = null, ?Throwable $previous = null)
{
parent::__construct($message ?? '', $code ?? 0, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/SetupException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class SetupException extends LogicException
{
public function __construct($message = null, $code = null, Throwable $previous = null)
public function __construct($message = null, $code = null, ?Throwable $previous = null)
{
parent::__construct($message ?? '', $code ?? 0, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/StaticExchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __construct($referenceCurrency, array $exchangeRates, string $ex
* @param CurrencyInterface $from
* @return float|int
*/
public function getExchangeRate(CurrencyInterface $target, CurrencyInterface $from = null)
public function getExchangeRate(CurrencyInterface $target, ?CurrencyInterface $from = null)
{
$getter = function (CurrencyInterface $target) {
[$rate, $amount, $type] = $this->getRawExchangeRateSetup($target->code());
Expand Down

0 comments on commit da40d06

Please sign in to comment.