From dfce704a2e2ea160aebbf04f6c34049f26a8be0a Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 15 Feb 2023 16:58:39 +0100 Subject: [PATCH] Fix PHPStan errors --- src/Concerns/RegistersCurrencies.php | 5 ++++- src/Currency.php | 1 + src/Money.php | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Concerns/RegistersCurrencies.php b/src/Concerns/RegistersCurrencies.php index db80491..e96b420 100644 --- a/src/Concerns/RegistersCurrencies.php +++ b/src/Concerns/RegistersCurrencies.php @@ -128,7 +128,10 @@ trait RegistersCurrencies } if (class_exists($currency) && (new ReflectionClass($currency))->isSubclassOf(Currency::class)) { - return (new $currency)->code(); + /** @var Currency $currency * */ + $currency = new $currency; + + return $currency->code(); } throw new InvalidCurrencyException( diff --git a/src/Currency.php b/src/Currency.php index 3f071bf..9ae7b3f 100644 --- a/src/Currency.php +++ b/src/Currency.php @@ -8,6 +8,7 @@ use ArchTech\Money\Exceptions\InvalidCurrencyException; use Illuminate\Contracts\Support\Arrayable; use JsonSerializable; +/** @implements Arrayable */ class Currency implements Arrayable, JsonSerializable { /** Code of the currency (e.g. 'CZK'). */ diff --git a/src/Money.php b/src/Money.php index 16f0c3c..6eaa6a7 100644 --- a/src/Money.php +++ b/src/Money.php @@ -8,6 +8,7 @@ use Illuminate\Contracts\Support\Arrayable; use JsonSerializable; use Livewire\Wireable; +/** @implements Arrayable */ final class Money implements JsonSerializable, Arrayable, Wireable { protected int $value;