From f32942e43781a566fe1ba3f6f067e80a405d2c19 Mon Sep 17 00:00:00 2001 From: mychidarko Date: Mon, 4 Nov 2024 19:46:03 +0000 Subject: [PATCH] chore: fix styling --- src/Form.php | 14 +++++++------- tests/Pest.php | 3 ++- tests/message.test.php | 1 - tests/validation.test.php | 1 - 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Form.php b/src/Form.php index 68a7cb3..2ad6856 100644 --- a/src/Form.php +++ b/src/Form.php @@ -288,7 +288,7 @@ public function validate(array $dataSource, array $validationSet) public function addRule(string $name, $handler, ?string $message = null) { $this->rules[strtolower($name)] = $handler; - $this->messages[strtolower($name)] = $message ?? "%s is invalid!"; + $this->messages[strtolower($name)] = $message ?? '%s is invalid!'; } /** @@ -312,11 +312,11 @@ public function addErrorMessage($field, ?string $message = null) return $this->addMessage($field, $message); } - /** - * Add validation error message - * @param string|array $field The field to add the message to - * @param string|null $message The error message if $field is a string - */ + /** + * Add validation error message + * @param string|array $field The field to add the message to + * @param string|null $message The error message if $field is a string + */ public function addMessage($field, ?string $message = null) { if (is_array($field)) { @@ -342,7 +342,7 @@ public function submit(string $method, string $action, array $fields) $form_fields = ''; foreach ($fields as $key => $value) { - $form_fields = $form_fields . ""; + $form_fields = $form_fields . "message('number', 'This is a custom message'); diff --git a/tests/validation.test.php b/tests/validation.test.php index 2983348..7ecb3b2 100644 --- a/tests/validation.test.php +++ b/tests/validation.test.php @@ -2,7 +2,6 @@ declare(strict_types=1); -use Leaf\Form; test('can perform inline validation', function () { $value = '';