You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `{{name}}` placeholder could represent different things depending on
the state of the Result, and referring to it as `{{name}}` seems
arbitrary. This commit changes it to `{{subject}}`, which is much more
generic and it describes well what that placeholder can mean.
Respect\Validation offers over 150 rules, many of which are designed to address common scenarios. Here’s a quick guide to some specific use cases and the rules that make validation straightforward.
35
36
36
-
* Using rules as **PHP Attributes**: [Attributes](rules/Attributes.md).
Copy file name to clipboardExpand all lines: docs/03-handling-exceptions.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# Handling exceptions
2
2
3
3
The `Validator::assert()` method simplifies exception handling by throwing `ValidationException` exceptions when validation fails. These exceptions provide detailed feedback on what went wrong.
4
+
4
5
## Full exception message
5
6
6
7
The `getFullMessage()` method will return a full comprehensive explanation of rules that didn't pass in a nested Markdown list format.
@@ -51,6 +52,7 @@ Array
51
52
```
52
53
53
54
When validating with [Key](rules/Key.md) or [Property](rules/Property.md) the keys of will correspond to the name of the key or property that failed the validation.
55
+
54
56
## Custom templates
55
57
56
58
You can tailor the messages to better suit your needs.
@@ -100,7 +102,7 @@ use Respect\Validation\Validator as v;
100
102
101
103
$validator = v::alnum()->lowercase();
102
104
$validator->setTemplates([
103
-
'__root__' => '{{name}} is not valid',
105
+
'__root__' => '{{subject}} is not valid',
104
106
'alnum' => 'Usernames must contain only letters and digits',
0 commit comments