Skip to content

Commit 0c07060

Browse files
committed
Rename "Consecutive" to "Circuit"
The "Consecutive" rule is now renamed to "Circuit" to better reflect its behavior of stopping at the first failure. I also favour this name because it's much shorter.
1 parent e465810 commit 0c07060

27 files changed

+68
-76
lines changed

docs/02-feature-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Respect\Validation offers over 150 rules, many of which are designed to address
4343
* Validating the **Length** of the input: [Length](rules/Length.md).
4444
* Validating the **Maximum** value in the input: [Max](rules/Max.md).
4545
* Validating the **Minimum** value in the input: [Min](rules/Min.md).
46-
* Handling **Special cases**: [Lazy](rules/Lazy.md), [Consecutive](rules/Consecutive.md), [Call](rules/Call.md).
46+
* Handling **Special cases**: [Lazy](rules/Lazy.md), [Circuit](rules/Circuit.md), [Call](rules/Call.md).
4747

4848
### Custom templates
4949

docs/09-list-of-rules-by-category.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,11 @@
6161

6262
- [AllOf](rules/AllOf.md)
6363
- [AnyOf](rules/AnyOf.md)
64-
- [Consecutive](rules/Consecutive.md)
6564
- [NoneOf](rules/NoneOf.md)
6665
- [OneOf](rules/OneOf.md)
6766

6867
## Conditions
6968

70-
- [Consecutive](rules/Consecutive.md)
7169
- [Not](rules/Not.md)
7270
- [When](rules/When.md)
7371

@@ -163,7 +161,6 @@
163161
- [AllOf](rules/AllOf.md)
164162
- [AnyOf](rules/AnyOf.md)
165163
- [Call](rules/Call.md)
166-
- [Consecutive](rules/Consecutive.md)
167164
- [Each](rules/Each.md)
168165
- [Key](rules/Key.md)
169166
- [KeySet](rules/KeySet.md)
@@ -314,7 +311,6 @@
314311
- [Charset](rules/Charset.md)
315312
- [Cnh](rules/Cnh.md)
316313
- [Cnpj](rules/Cnpj.md)
317-
- [Consecutive](rules/Consecutive.md)
318314
- [Consonant](rules/Consonant.md)
319315
- [Contains](rules/Contains.md)
320316
- [ContainsAny](rules/ContainsAny.md)

docs/rules/AllOf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ v::allOf(v::intVal(), v::positive())->isValid(15); // true
4646
See also:
4747

4848
- [AnyOf](AnyOf.md)
49-
- [Consecutive](Consecutive.md)
49+
- [Circuit](Circuit.md)
5050
- [NoneOf](NoneOf.md)
5151
- [OneOf](OneOf.md)
5252
- [When](When.md)

docs/rules/AnyOf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ so `AnyOf()` returns true.
4444
See also:
4545

4646
- [AllOf](AllOf.md)
47-
- [Consecutive](Consecutive.md)
47+
- [Circuit](Circuit.md)
4848
- [ContainsAny](ContainsAny.md)
4949
- [NoneOf](NoneOf.md)
5050
- [OneOf](OneOf.md)
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Consecutive
1+
# Circuit
22

3-
- `Consecutive(Rule $rule1, Rule $rule2, Rule ...$rule)`
3+
- `Circuit(Rule $rule1, Rule $rule2, Rule ...$rule)`
44

5-
Validates the input against a series of rules until one fails.
5+
Validates the input against a series of rules until the first fails.
66

77
This rule can be handy for getting the least error messages possible from a chain.
88

99
This rule can be helpful in combinations with [Lazy](Lazy.md). An excellent example is when you want to validate a
1010
country code and a subdivision code.
1111

1212
```php
13-
v::consecutive(
13+
v::circuit(
1414
v::key('countryCode', v::countryCode()),
1515
v::lazy(static fn($input) => v::key('subdivisionCode', v::subdivisionCode($input['countryCode']))),
1616
)->isValid($_POST);
@@ -22,11 +22,7 @@ would then have to write `v::key('countryCode', v::countryCode())` twice in your
2222

2323
## Templates
2424

25-
## Template placeholders
26-
27-
| Placeholder | Description |
28-
|-------------|------------------------------------------------------------------|
29-
| `name` | The validated input or the custom validator name (if specified). |
25+
This rule does not have any templates, because it will always return the result of the first rule that fails. When all the validation rules pass, it will return the result of the last rule of the circuit.
3026

3127
## Categorization
3228

docs/rules/Lazy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ See also:
4747

4848
- [Call](Call.md)
4949
- [CallableType](CallableType.md)
50-
- [Consecutive](Consecutive.md)
50+
- [Circuit](Circuit.md)

docs/rules/NoneOf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ See also:
4545

4646
- [AllOf](AllOf.md)
4747
- [AnyOf](AnyOf.md)
48-
- [Consecutive](Consecutive.md)
48+
- [Circuit](Circuit.md)
4949
- [Not](Not.md)
5050
- [OneOf](OneOf.md)
5151
- [When](When.md)

docs/rules/OneOf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ See also:
4646

4747
- [AllOf](AllOf.md)
4848
- [AnyOf](AnyOf.md)
49-
- [Consecutive](Consecutive.md)
49+
- [Circuit](Circuit.md)
5050
- [NoneOf](NoneOf.md)
5151
- [When](When.md)

docs/rules/SubdivisionCode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ v::subdivisionCode('US')->isValid('CA'); // true
4444
***
4545
See also:
4646

47-
- [Consecutive](Consecutive.md)
47+
- [Circuit](Circuit.md)
4848
- [CountryCode](CountryCode.md)
4949
- [CurrencyCode](CurrencyCode.md)
5050
- [Nip](Nip.md)

docs/rules/When.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ See also:
4646
- [AllOf](AllOf.md)
4747
- [AlwaysInvalid](AlwaysInvalid.md)
4848
- [AnyOf](AnyOf.md)
49-
- [Consecutive](Consecutive.md)
49+
- [Circuit](Circuit.md)
5050
- [NoneOf](NoneOf.md)
5151
- [OneOf](OneOf.md)

0 commit comments

Comments
 (0)