Skip to content

Commit

Permalink
Add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
pelmered committed Dec 4, 2024
1 parent f1436b5 commit fb66c3f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"coverage": [
"@php vendor/bin/pest --testsuite=default --coverage-clover=coverage.xml --coverage-filter=src --path-coverage"
],
"types": [
"@php vendor/bin/pest --type-coverage"
],
"check" : [
"composer lint",
"composer test"
Expand Down
4 changes: 2 additions & 2 deletions src/Forms/Components/MoneyInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function setUp(): void

$this->prepare();

$this->formatStateUsing(function (MoneyInput $component, $state): ?string {
$this->formatStateUsing(function (MoneyInput $component, null|int|string $state): ?string {

$this->prepare();

Expand All @@ -49,7 +49,7 @@ protected function setUp(): void
return MoneyFormatter::formatAsDecimal((int) $state, $currency, $locale, $this->getDecimals());
});

$this->dehydrateStateUsing(function (MoneyInput $component, $state): ?string {
$this->dehydrateStateUsing(function (MoneyInput $component, null|int|string $state): ?string {
$currency = $component->getCurrency();
$state = MoneyFormatter::parseDecimal($state, $currency, $component->getLocale(), $this->getDecimals());

Expand Down
4 changes: 2 additions & 2 deletions src/Infolists/Components/MoneyEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected function setUp(): void
$this->isMoney = true;
$this->numeric();

$this->formatStateUsing(function (MoneyEntry $component, $state): string {
$this->formatStateUsing(function (MoneyEntry $component, null|int|string $state): string {
return MoneyFormatter::format(
$state,
$component->getCurrency(),
Expand All @@ -29,7 +29,7 @@ protected function setUp(): void

public function short(): static
{
$this->formatStateUsing(function (MoneyEntry $component, $state) {
$this->formatStateUsing(function (MoneyEntry $component, null|int|string $state) {
return MoneyFormatter::formatShort(
$state,
$component->getCurrency(),
Expand Down
4 changes: 2 additions & 2 deletions src/Tables/Columns/MoneyColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected function setUp(): void
$this->isMoney = true;
$this->numeric();

$this->formatStateUsing(function (MoneyColumn $component, $state): string {
$this->formatStateUsing(function (MoneyColumn $component, null|int|string $state): string {
return MoneyFormatter::format(
$state,
$component->getCurrency(),
Expand All @@ -29,7 +29,7 @@ protected function setUp(): void

public function short(): static
{
$this->formatStateUsing(function (MoneyColumn $component, $state) {
$this->formatStateUsing(function (MoneyColumn $component, null|int|string $state) {
return MoneyFormatter::formatShort(
$state,
$component->getCurrency(),
Expand Down

0 comments on commit fb66c3f

Please sign in to comment.