Skip to content

Commit

Permalink
fixed psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Mar 19, 2024
1 parent 444216a commit 8433753
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Casts/CurrencyCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use UnexpectedValueException;

/**
* @template TGet
* @template TSet
*/
class CurrencyCast implements CastsAttributes

Check failure on line 13 in src/Casts/CurrencyCast.php

View workflow job for this annotation

GitHub Actions / psalm

MissingTemplateParam

src/Casts/CurrencyCast.php:13:31: MissingTemplateParam: Akaunting\Money\Casts\CurrencyCast has missing template params when extending Illuminate\Contracts\Database\Eloquent\CastsAttributes, expecting 2 (see https://psalm.dev/182)
{
public function get($model, string $key, $value, array $attributes): Currency
Expand Down
4 changes: 4 additions & 0 deletions src/Casts/MoneyCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use UnexpectedValueException;

/**
* @template TGet
* @template TSet
*/
class MoneyCast implements CastsAttributes

Check failure on line 14 in src/Casts/MoneyCast.php

View workflow job for this annotation

GitHub Actions / psalm

MissingTemplateParam

src/Casts/MoneyCast.php:14:28: MissingTemplateParam: Akaunting\Money\Casts\MoneyCast has missing template params when extending Illuminate\Contracts\Database\Eloquent\CastsAttributes, expecting 2 (see https://psalm.dev/182)
{
public function get($model, string $key, $value, array $attributes): Money
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/CurrencyRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function validate(string $attribute, mixed $value, Closure $fail): void
}
}

protected function passes($value): bool
protected function passes(mixed $value): bool
{
return is_string($value) && array_key_exists(strtoupper($value), Currency::getCurrencies());
}
Expand Down

0 comments on commit 8433753

Please sign in to comment.