1
0
Fork 0
mirror of https://github.com/archtechx/money.git synced 2025-12-14 03:54:03 +00:00

Fix PHPStan errors

This commit is contained in:
lukinovec 2023-02-15 16:58:39 +01:00
parent 3079fcdf48
commit dfce704a2e
3 changed files with 6 additions and 1 deletions

View file

@ -128,7 +128,10 @@ trait RegistersCurrencies
} }
if (class_exists($currency) && (new ReflectionClass($currency))->isSubclassOf(Currency::class)) { 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( throw new InvalidCurrencyException(

View file

@ -8,6 +8,7 @@ use ArchTech\Money\Exceptions\InvalidCurrencyException;
use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Arrayable;
use JsonSerializable; use JsonSerializable;
/** @implements Arrayable<string, string|int|float> */
class Currency implements Arrayable, JsonSerializable class Currency implements Arrayable, JsonSerializable
{ {
/** Code of the currency (e.g. 'CZK'). */ /** Code of the currency (e.g. 'CZK'). */

View file

@ -8,6 +8,7 @@ use Illuminate\Contracts\Support\Arrayable;
use JsonSerializable; use JsonSerializable;
use Livewire\Wireable; use Livewire\Wireable;
/** @implements Arrayable<string, string|int> */
final class Money implements JsonSerializable, Arrayable, Wireable final class Money implements JsonSerializable, Arrayable, Wireable
{ {
protected int $value; protected int $value;