Skip to content

Commit

Permalink
Merge pull request #290 from gsteel/v3/remove-lt-gt-between
Browse files Browse the repository at this point in the history
Remove the deprecated validators `LessThan`, `GreaterThan` and `Between`
  • Loading branch information
gsteel authored Jun 25, 2024
2 parents e1a0edd + 3c640d4 commit ee26b8b
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 1,549 deletions.
16 changes: 8 additions & 8 deletions docs/book/v3/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ validator could return to something different.

Validation messages are defined as constant/template pairs, with the constant
representing a translation key. Such constants are defined per-class. Let's
look into `Laminas\Validator\GreaterThan` for a descriptive example:
look into `Laminas\Validator\Digits` for a descriptive example:

```php
protected $messageTemplates = [
self::NOT_GREATER => "'%value%' is not greater than '%min%'",
protected array $messageTemplates = [
self::NOT_DIGITS => 'The input must contain only digits',
];
```

The constant `self::NOT_GREATER` refers to the failure and is used as the
The constant `self::NOT_DIGITS` refers to the failure and is used as the
message key, and the message template itself is used as the value within the
message array.

Expand All @@ -24,18 +24,18 @@ You can retrieve all message templates from a validator by using the
messages a validator could return in the case of a failed validation.

```php
$validator = new Laminas\Validator\GreaterThan();
$validator = new Laminas\Validator\Digits();
$messages = $validator->getMessageTemplates();
```

Using the `setMessage()` method you can set another message to be returned in
case of the specified failure.

```php
use Laminas\Validator\GreaterThan;
use Laminas\Validator\Digits;

$validator = new GreaterThan();
$validator->setMessage('Please enter a lower value', GreaterThan::NOT_GREATER);
$validator = new Digits();
$validator->setMessage('Please enter some numbers', Digits::NOT_DIGITS);
```

The second parameter defines the failure which will be overridden. When you omit
Expand Down
3 changes: 0 additions & 3 deletions docs/book/v3/set.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
The following validators come with the laminas-validator distribution.

- [Barcode](validators/barcode.md)
- [Between](validators/between.md)
- [Callback](validators/callback.md)
- [CreditCard](validators/credit-card.md)
- [Date](validators/date.md)
- [Digits](validators/digits.md)
- [EmailAddress](validators/email-address.md)
- [Explode](validators/explode.md)
- [File Validation Classes](validators/file/intro.md)
- [GreaterThan](validators/greater-than.md)
- [Hex](validators/hex.md)
- [Hostname](validators/hostname.md)
- [HostWithPublicIPv4Address](validators/host-with-public-ipv4-address.md)
Expand All @@ -23,7 +21,6 @@ The following validators come with the laminas-validator distribution.
- [Isbn](validators/isbn.md)
- [IsCountable](validators/is-countable.md)
- [IsInstanceOf](validators/isinstanceof.md)
- [LessThan](validators/less-than.md)
- [NotEmpty](validators/not-empty.md)
- [Regex](validators/regex.md)
- [Sitemap](validators/sitemap.md)
Expand Down
55 changes: 0 additions & 55 deletions docs/book/v3/validators/between.md

This file was deleted.

49 changes: 0 additions & 49 deletions docs/book/v3/validators/greater-than.md

This file was deleted.

48 changes: 0 additions & 48 deletions docs/book/v3/validators/less-than.md

This file was deleted.

9 changes: 3 additions & 6 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ nav:
- "Standard Validation Classes": v3/set.md
- Validators:
- Barcode: v3/validators/barcode.md
- Between: v3/validators/between.md
- BIC: v3/validators/bic.md
- Callback: v3/validators/callback.md
- CreditCard: v3/validators/credit-card.md
- Date: v3/validators/date.md
- Digits: v3/validators/digits.md
- EmailAddress: v3/validators/email-address.md
- Explode: v3/validators/explode.md
- GreaterThan: v3/validators/greater-than.md
- Hex: v3/validators/hex.md
- Hostname: v3/validators/hostname.md
- HostWithPublicIPv4Address: v3/validators/host-with-public-ipv4-address.md
Expand All @@ -32,7 +30,6 @@ nav:
- IsCountable: v3/validators/is-countable.md
- IsInstanceOf: v3/validators/isinstanceof.md
- IsJsonString: v3/validators/is-json-string.md
- LessThan: v3/validators/less-than.md
- NotEmpty: v3/validators/not-empty.md
- Regex: v3/validators/regex.md
- Sitemap: v3/validators/sitemap.md
Expand Down Expand Up @@ -149,7 +146,7 @@ plugins:
messages.md: v3/messages.md
set.md: v3/set.md
validators/barcode.md: v3/validators/barcode.md
validators/between.md: v3/validators/between.md
validators/between.md: v2/validators/between.md
validators/bic.md: v3/validators/bic.md
validators/callback.md: v3/validators/callback.md
validators/credit-card.md: v3/validators/credit-card.md
Expand All @@ -159,7 +156,7 @@ plugins:
validators/digits.md: v3/validators/digits.md
validators/email-address.md: v3/validators/email-address.md
validators/explode.md: v3/validators/explode.md
validators/greater-than.md: v3/validators/greater-than.md
validators/greater-than.md: v2/validators/greater-than.md
validators/hex.md: v3/validators/hex.md
validators/hostname.md: v3/validators/hostname.md
validators/iban.md: v3/validators/iban.md
Expand All @@ -171,7 +168,7 @@ plugins:
validators/is-countable.md: v3/validators/is-countable.md
validators/isinstanceof.md: v3/validators/isinstanceof.md
validators/is-json-string.md: v3/validators/is-json-string.md
validators/less-than.md: v3/validators/less-than.md
validators/less-than.md: v2/validators/less-than.md
validators/not-empty.md: v3/validators/not-empty.md
validators/regex.md: v3/validators/regex.md
validators/sitemap.md: v3/validators/sitemap.md
Expand Down
Loading

0 comments on commit ee26b8b

Please sign in to comment.