Skip to content

Commit

Permalink
fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
ariaieboy committed May 14, 2024
1 parent c3c812d commit 397444f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ide-helper.stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function currency(string | Closure | null $currency = null, bool $shouldC
return $this;
}
}
}
}e

namespace Filament\Forms\Components {
class TextInput
Expand Down
11 changes: 9 additions & 2 deletions src/FilamentCurrencyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ public function bootingPackage(): void
return $this;
});
TextInput::macro('currencyMask', function ($thousandSeparator = ',', $decimalSeparator = '.', $precision = 2): TextInput {
/**
* @var TextInput $this
*/
$this->view = 'filament-currency::currency-mask';
$this->viewData(compact('thousandSeparator', 'decimalSeparator', 'precision'));

return $this;
});

Summarizers\Sum::macro('currency', function (string | Closure | null $currency = null, bool $shouldConvert = false) use ($formatter): Summarizers\Sum {

/**
* @var Summarizers\Sum $this
*/
$this->formatStateUsing(static function (Summarizers\Summarizer $summarizer, $state) use ($currency, $shouldConvert, $formatter): ?string {

return $formatter($state, $summarizer, $currency, $shouldConvert);
Expand All @@ -72,7 +77,9 @@ public function bootingPackage(): void
});

Summarizers\Average::macro('currency', function (string | Closure | null $currency = null, bool $shouldConvert = false) use ($formatter): Summarizers\Average {

/**
* @var Summarizers\Average $this
*/
$this->formatStateUsing(static function (Summarizers\Summarizer $summarizer, $state) use ($currency, $shouldConvert, $formatter): ?string {

return $formatter($state, $summarizer, $currency, $shouldConvert);
Expand Down

0 comments on commit 397444f

Please sign in to comment.