Skip to content

Commit 0e1d674

Browse files
committed
fix psalm errors
1 parent c6710ee commit 0e1d674

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

src/Casts/CurrencyCast.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
use UnexpectedValueException;
88

99
/**
10-
* @template TGet
11-
* @template TSet
10+
* @template-implements CastsAttributes<Currency,Currency>
1211
*/
1312
class CurrencyCast implements CastsAttributes
1413
{

src/Casts/MoneyCast.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
use UnexpectedValueException;
99

1010
/**
11-
* @template TGet
12-
* @template TSet
11+
* @template-implements CastsAttributes<Money,Money>
1312
*/
1413
class MoneyCast implements CastsAttributes
1514
{

src/Currency.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
* @method static Currency ZAR()
180180
* @method static Currency ZMW()
181181
* @method static Currency ZWL()
182+
* @template-implements Arrayable<string,array>
182183
*/
183184
class Currency implements Arrayable, Castable, Jsonable, JsonSerializable, Renderable
184185
{

src/Money.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Contracts\Support\Arrayable;
1212
use Illuminate\Contracts\Support\Jsonable;
1313
use Illuminate\Contracts\Support\Renderable;
14+
use Illuminate\Support\Arr;
1415
use Illuminate\Support\Traits\Macroable;
1516
use InvalidArgumentException;
1617
use JsonSerializable;
@@ -183,6 +184,7 @@
183184
* @method static Money ZAR(mixed $amount, bool $convert = false)
184185
* @method static Money ZMW(mixed $amount, bool $convert = false)
185186
* @method static Money ZWL(mixed $amount, bool $convert = false)
187+
* @template-implements Arrayable<string,int|float|Currency>
186188
*/
187189
class Money implements Arrayable, Castable, Jsonable, JsonSerializable, Renderable
188190
{
@@ -606,7 +608,7 @@ public function formatForHumans(?string $locale = null, ?Closure $callback = nul
606608
$prefix = $this->currency->getPrefix();
607609
$suffix = $this->currency->getSuffix();
608610

609-
$formatter = new \NumberFormatter($locale ?: static::getLocale(), \NumberFormatter::PADDING_POSITION);
611+
$formatter = new \NumberFormatter(is_null($locale) ? static::getLocale():$locale, \NumberFormatter::PADDING_POSITION);
610612

611613
$formatter->setSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, $this->currency->getDecimalMark());
612614
$formatter->setSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, $this->currency->getThousandsSeparator());
@@ -632,7 +634,7 @@ public function formatLocale(?string $locale = null, ?Closure $callback = null):
632634
}
633635
// @codeCoverageIgnoreEnd
634636

635-
$formatter = new \NumberFormatter($locale ?: static::getLocale(), \NumberFormatter::CURRENCY);
637+
$formatter = new \NumberFormatter(is_null($locale) ? static::getLocale():$locale, \NumberFormatter::CURRENCY);
636638

637639
$formatter->setSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, $this->currency->getDecimalMark());
638640
$formatter->setSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, $this->currency->getThousandsSeparator());

src/Rules/CurrencyRule.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
use Akaunting\Money\Currency;
66
use Illuminate\Contracts\Validation\Rule;
77

8+
/**
9+
* @psalm-suppress DeprecatedInterface
10+
*/
811
class CurrencyRule implements Rule
912
{
1013
public function passes($attribute, $value): bool

0 commit comments

Comments
 (0)