Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 990e81e

Browse files
committed
docs: improved examples
1 parent a6a2e47 commit 990e81e

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ Simple usage looks like:
3939
use ProgrammatorDev\Validator\Rule;
4040
use ProgrammatorDev\Validator\Validator;
4141

42-
// do this...
43-
$validator = Validator::notBlank()->greaterThanOrEqual(18);
42+
// do this:
43+
$validator = Validator::type('int')->greaterThanOrEqual(18);
4444

45-
// ...and validate with these:
45+
// and validate with these:
4646
$validator->validate(16); // returns bool: false
4747
$validator->assert(16, 'age'); // throws exception: The age value should be greater than or equal to 18, 16 given.
4848
```

docs/01-get-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ Simple usage looks like:
3030
use ProgrammatorDev\Validator\Rule;
3131
use ProgrammatorDev\Validator\Validator;
3232

33-
// do this...
34-
$validator = Validator::notBlank()->greaterThanOrEqual(18);
33+
// do this:
34+
$validator = Validator::type('int')->greaterThanOrEqual(18);
3535

36-
// ...and validate with these:
36+
// and validate with these:
3737
$validator->validate(16); // returns bool: false
3838
$validator->assert(16, 'age'); // throws exception: The age value should be greater than or equal to 18, 16 given.
3939
```

docs/02-usage.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function getWeather(float $latitude, float $longitude, string $unitSystem
2222
{
2323
Validator::range(-90, 90)->assert($latitude, 'latitude');
2424
Validator::range(-180, 180)->assert($longitude, 'longitude');
25-
Validator::notBlank()->choice(['metric', 'imperial'])->assert($unitSystem, 'unit system');
25+
Validator::choice(['metric', 'imperial'])->assert($unitSystem, 'unit system');
2626

2727
// ...
2828
}
@@ -51,7 +51,7 @@ function getWeather(float $latitude, float $longitude, string $unitSystem): floa
5151
{
5252
Validator::range(-90, 90)->assert($latitude, 'latitude');
5353
Validator::range(-180, 180)->assert($longitude, 'longitude');
54-
Validator::notBlank()->choice(['metric', 'imperial'])->assert($unitSystem, 'unit system');
54+
Validator::choice(['metric', 'imperial'])->assert($unitSystem, 'unit system');
5555

5656
// ...
5757
}
@@ -98,7 +98,7 @@ use ProgrammatorDev\Validator\Validator;
9898
try {
9999
Validator::range(-90, 90)->assert($latitude, 'latitude');
100100
Validator::range(-180, 180)->assert($longitude, 'longitude');
101-
Validator::notBlank()->choice(['metric', 'imperial'])->assert($unitSystem, 'unit system');
101+
Validator::choice(['metric', 'imperial'])->assert($unitSystem, 'unit system');
102102
}
103103
catch (Exception\RangeException $exception) {
104104
// do something when Range fails
@@ -120,7 +120,7 @@ use ProgrammatorDev\Validator\Validator;
120120
try {
121121
Validator::range(-90, 90)->assert($latitude, 'latitude');
122122
Validator::range(-180, 180)->assert($longitude, 'longitude');
123-
Validator::notBlank()->choice(['metric', 'imperial'])->assert($unitSystem, 'unit system');
123+
Validator::choice(['metric', 'imperial'])->assert($unitSystem, 'unit system');
124124
}
125125
catch (ValidationException $exception) {
126126
// do something when a rule fails

0 commit comments

Comments
 (0)