Skip to content

Commit

Permalink
change request rule message format..
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Sep 26, 2024
1 parent d99a9e8 commit d3f8c85
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,21 @@ public function boot(): void

public function registerValidationRules(): void
{
$currency_code = null;

Validator::extend('currency_code', function ($attribute, $value, $parameters, $validator) use(&$currency_code) {
Validator::extend('currency_code', function ($attribute, $value, $parameters, $validator) {

Check failure on line 39 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

MissingClosureParamType

src/Provider.php:39:54: MissingClosureParamType: Parameter $attribute has no provided type (see https://psalm.dev/153)

Check failure on line 39 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

MissingClosureParamType

src/Provider.php:39:66: MissingClosureParamType: Parameter $value has no provided type (see https://psalm.dev/153)

Check failure on line 39 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

MissingClosureParamType

src/Provider.php:39:74: MissingClosureParamType: Parameter $parameters has no provided type (see https://psalm.dev/153)

Check failure on line 39 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

UnusedClosureParam

src/Provider.php:39:74: UnusedClosureParam: Param parameters is never referenced in this method (see https://psalm.dev/188)

Check failure on line 39 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

MissingClosureParamType

src/Provider.php:39:87: MissingClosureParamType: Parameter $validator has no provided type (see https://psalm.dev/153)

Check failure on line 39 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

UnusedClosureParam

src/Provider.php:39:87: UnusedClosureParam: Param validator is never referenced in this method (see https://psalm.dev/188)
$status = false;

$currency_code = $value;

$currencies = config('money.currencies');

Check failure on line 42 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

MixedAssignment

src/Provider.php:42:13: MixedAssignment: Unable to determine the type that $currencies is being assigned to (see https://psalm.dev/032)

if (array_key_exists($value, $currencies)) {
$status = true;
}

return $status;
},
trans('validation.custom.invalid_currency', ['attribute' => $currency_code])
);
});

Validator::replacer('currency_code', function($message, $attribute, $rule, $parameters) {

Check failure on line 51 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

MissingClosureParamType

src/Provider.php:51:55: MissingClosureParamType: Parameter $message has no provided type (see https://psalm.dev/153)

Check failure on line 51 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

MissingClosureParamType

src/Provider.php:51:65: MissingClosureParamType: Parameter $attribute has no provided type (see https://psalm.dev/153)

Check failure on line 51 in src/Provider.php

View workflow job for this annotation

GitHub Actions / psalm

MissingClosureParamType

src/Provider.php:51:77: MissingClosureParamType: Parameter $rule has no provided type (see https://psalm.dev/153)
return trans('validation.custom.invalid_currency', ['attribute' => $attribute]);
});
}

public function registerBladeDirectives(): void
Expand Down

0 comments on commit d3f8c85

Please sign in to comment.