mirror of
https://github.com/Respect/Validation.git
synced 2024-06-08 00:32:16 +02:00
Make clear that "Alnum" rule accepts whitespaces
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
parent
8fc2484428
commit
e70c201691
|
@ -7,12 +7,15 @@ Validates alphanumeric characters from a-Z and 0-9.
|
|||
|
||||
```php
|
||||
v::alnum()->validate('foo 123'); // true
|
||||
v::alnum()->validate('number 100%'); // false
|
||||
v::alnum('%')->validate('number 100%'); // true
|
||||
```
|
||||
|
||||
A parameter for extra characters can be used:
|
||||
Because this rule allows whitespaces by default, you can separate additional
|
||||
characters with a whitespace:
|
||||
|
||||
```php
|
||||
v::alnum('-')->validate('foo - 123'); // true
|
||||
v::alnum('- ! :')->validate('foo :- 123 !'); // true
|
||||
```
|
||||
|
||||
This validator allows whitespace, if you want to
|
||||
|
|
|
@ -77,7 +77,8 @@ class AlnumTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
return [
|
||||
['alganet', ''],
|
||||
['alganet', 'alganet'],
|
||||
['foo :- 123 !', '- ! :'],
|
||||
['number 100%', '%'],
|
||||
['0alg-anet0', '0-9'],
|
||||
['1', ''],
|
||||
["\t", ''],
|
||||
|
@ -98,6 +99,7 @@ class AlnumTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
return [
|
||||
['', ''],
|
||||
['number 100%', ''],
|
||||
['@#$', ''],
|
||||
['_', ''],
|
||||
['dgç', ''],
|
||||
|
|
Loading…
Reference in a new issue