Skip to content

Commit 6abf3a5

Browse files
committed
Remove Masked validator in favor of Formatted
The Masked validator was a proxy for what the new Formatted validator already does, so it is being removed to reduce redundancy. All tests and documentation have been updated accordingly. Assisted-by: OpenCode (ollama-cloud/glm-4.7)
1 parent dc0c034 commit 6abf3a5

25 files changed

Lines changed: 2 additions & 230 deletions

docs/migrating-from-v2-to-v3.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,6 @@ Version 3.0 introduces several new validators:
591591
| `KeyExists` | Checks if an array key exists |
592592
| `KeyOptional` | Validates an array key only if it exists |
593593
| `Factory` | Creates validators dynamically based on input |
594-
| `Masked` | Masks sensitive input values in error messages |
595594
| `Named` | Customizes the subject name in error messages |
596595
| `PropertyExists` | Checks if an object property exists |
597596
| `PropertyOptional` | Validates an object property only if it exists |
@@ -732,18 +731,6 @@ v::factory(
732731
)->assert(['password' => 'secret', 'confirmation' => 'secret']); // passes
733732
```
734733

735-
#### Masked
736-
737-
Decorates a validator to mask sensitive input values in error messages while still validating the original unmasked data. This allows applications to protect sensitive information like passwords, credit cards, or emails without implementing a custom layer between Validation and end users:
738-
739-
```php
740-
v::masked('1-@', v::email(),v::email())->assert('invalid@example.com');
741-
// → "*******@example.com" must be a valid email address
742-
743-
v::masked('6-12', v::creditCard(), 'X')->assert('4111111111111211');
744-
// → "41111XXXXXXX1211" must be a valid credit card number
745-
```
746-
747734
#### Named
748735

749736
Customizes the subject name in error messages:

docs/validators.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ In this page you will find a list of validators by their category.
2727

2828
**Date and Time**: [Date][] - [DateTime][] - [DateTimeDiff][] - [LeapDate][] - [LeapYear][] - [Time][]
2929

30-
**Display**: [Format][] - [Formatted][] - [Masked][] - [Named][] - [Templated][]
30+
**Display**: [Format][] - [Formatted][] - [Named][] - [Templated][]
3131

3232
**File system**: [Directory][] - [Executable][] - [Exists][] - [Extension][] - [File][] - [Image][] - [Mimetype][] - [Readable][] - [Size][] - [SymbolicLink][] - [Writable][]
3333

@@ -41,7 +41,7 @@ In this page you will find a list of validators by their category.
4141

4242
**Math**: [Factor][] - [Finite][] - [Infinite][] - [Multiple][] - [Negative][] - [Positive][]
4343

44-
**Miscellaneous**: [Blank][] - [Falsy][] - [Masked][] - [Named][] - [Templated][] - [Undef][]
44+
**Miscellaneous**: [Blank][] - [Falsy][] - [Named][] - [Templated][] - [Undef][]
4545

4646
**Nesting**: [After][] - [AllOf][] - [AnyOf][] - [Each][] - [Factory][] - [Key][] - [KeySet][] - [NoneOf][] - [Not][] - [NullOr][] - [OneOf][] - [Property][] - [PropertyOptional][] - [ShortCircuit][] - [UndefOr][] - [When][]
4747

@@ -151,7 +151,6 @@ In this page you will find a list of validators by their category.
151151
- [Lowercase][] - `v::stringType()->lowercase()->assert('xkcd');`
152152
- [Luhn][] - `v::luhn()->assert('2222400041240011');`
153153
- [MacAddress][] - `v::macAddress()->assert('00:11:22:33:44:55');`
154-
- [Masked][] - `v::masked('1-@', v::email())->assert('foo@example.com');`
155154
- [Max][] - `v::max(v::equals(30))->assert([10, 20, 30]);`
156155
- [Mimetype][] - `v::mimetype('image/png')->assert('/path/to/image.png');`
157156
- [Min][] - `v::min(v::equals(10))->assert([10, 20, 30]);`
@@ -309,7 +308,6 @@ In this page you will find a list of validators by their category.
309308
[Lowercase]: validators/Lowercase.md "Validates whether the characters in the input are lowercase."
310309
[Luhn]: validators/Luhn.md "Validate whether a given input is a Luhn number."
311310
[MacAddress]: validators/MacAddress.md "Validates whether the input is a valid MAC address."
312-
[Masked]: validators/Masked.md "Decorates a validator to mask input values in error messages while still validating the original unmasked input."
313311
[Max]: validators/Max.md "Validates the maximum value of the input against a given validator."
314312
[Mimetype]: validators/Mimetype.md "Validates if the input is a file and if its MIME type matches the expected one."
315313
[Min]: validators/Min.md "Validates the minimum value of the input against a given validator."

docs/validators/Format.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ stored data follows a required display format).
6262

6363
## See Also
6464

65-
- [Masked](Masked.md)
6665
- [Templated](Templated.md)
6766

6867
[Respect\StringFormatter]: https://github.com/Respect/StringFormatter

docs/validators/Formatted.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,5 @@ The validator first ensures the input is a valid string using `StringVal`. If th
4747

4848
## See Also
4949

50-
- [Masked](Masked.md)
5150
- [Named](Named.md)
5251
- [Templated](Templated.md)

docs/validators/Masked.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

docs/validators/Named.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,5 @@ This validator does not have any templates, as it will use the template of the g
5353
## See Also
5454

5555
- [Attributes](Attributes.md)
56-
- [Masked](Masked.md)
5756
- [Not](Not.md)
5857
- [Templated](Templated.md)

docs/validators/Templated.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,5 @@ This validator does not have any templates, as you must define the templates you
5454
## See Also
5555

5656
- [Attributes](Attributes.md)
57-
- [Masked](Masked.md)
5857
- [Named](Named.md)
5958
- [Not](Not.md)

src/Mixins/AllBuilder.php

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Mixins/AllChain.php

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Mixins/Builder.php

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)