diff --git a/src/CurrencyService.php b/src/CurrencyService.php index 5638fd8..a36feef 100644 --- a/src/CurrencyService.php +++ b/src/CurrencyService.php @@ -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); } @@ -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; diff --git a/src/Exceptions/MathException.php b/src/Exceptions/MathException.php index ca835d3..e3382b4 100644 --- a/src/Exceptions/MathException.php +++ b/src/Exceptions/MathException.php @@ -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); } diff --git a/src/Exceptions/SetupException.php b/src/Exceptions/SetupException.php index 8a7ed3a..7957152 100644 --- a/src/Exceptions/SetupException.php +++ b/src/Exceptions/SetupException.php @@ -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); } diff --git a/src/StaticExchange.php b/src/StaticExchange.php index 6a78c36..0c351f6 100644 --- a/src/StaticExchange.php +++ b/src/StaticExchange.php @@ -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());