mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Reformat code.
This commit is contained in:
@@ -25,27 +25,27 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use FireflyIII\TransactionRules\Expressions\ActionExpression;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Translation\PotentiallyTranslatedString;
|
||||
|
||||
class IsValidActionExpression implements ValidationRule
|
||||
{
|
||||
/**
|
||||
* Check that the given action expression is syntactically valid.
|
||||
*
|
||||
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
||||
* @param \Closure(string): PotentiallyTranslatedString $fail
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
public function validate(string $attribute, mixed $value, \Closure $fail): void
|
||||
{
|
||||
$value ??= '';
|
||||
$expr = new ActionExpression($value);
|
||||
|
||||
if (!$expr->isValid()) {
|
||||
$fail('validation.rule_action_expression')->translate([
|
||||
'error' => $expr->getValidationError()->getMessage()
|
||||
'error' => $expr->getValidationError()->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user