Skip to content

Commit

Permalink
Fix grammar error in the "AllOf" rule
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquemoody committed Dec 20, 2024
1 parent 0c07060 commit 873be39
Show file tree
Hide file tree
Showing 30 changed files with 76 additions and 76 deletions.
4 changes: 2 additions & 2 deletions docs/03-handling-exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ try {
The code above generates the following output:

```no-highlight
- All of the required rules must pass for "The Respect Panda"
- All the required rules must pass for "The Respect Panda"
- "The Respect Panda" must contain only letters (a-z) and digits (0-9)
- "The Respect Panda" must contain only lowercase letters
```
Expand All @@ -44,7 +44,7 @@ The code above generates the following output:
```no-highlight
Array
(
[__root__] => All of the required rules must pass for "The Respect Panda"
[__root__] => All the required rules must pass for "The Respect Panda"
[alnum] => "The Respect Panda" must contain only letters (a-z) and digits (0-9)
[lowercase] => "The Respect Panda" must contain only lowercase letters
)
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/AllOf.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ v::allOf(v::intVal(), v::positive())->isValid(15); // true

### `AllOf::TEMPLATE_NONE`

| Mode | Template |
|------------|--------------------------------------------------|
| `default` | All of the required rules must pass for {{name}} |
| `inverted` | None of these rules must pass for {{name}} |
| Mode | Template |
|------------|-----------------------------------------------|
| `default` | All the required rules must pass for {{name}} |
| `inverted` | None of these rules must pass for {{name}} |

## Template placeholders

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/Attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ v::attributes()->assert(new Person('John Doe', '[email protected]', '2020-06-23

v::attributes()->assert(new Person('', 'not an email', 'not a date', 'not a phone number'));
// Full message:
// - All of the required rules must pass for `Person { +$name="" +$email="not an email" +$birthdate="not a date" +$phone="not a phone number" }`
// - All the required rules must pass for `Person { +$name="" +$email="not an email" +$birthdate="not a date" +$phone="not a phone number" }`
// - name must not be empty
// - email must be a valid email address
// - All of the required rules must pass for birthdate
// - All the required rules must pass for birthdate
// - birthdate must be a valid date in the format "2005-12-30"
// - For comparison with now, birthdate must be a valid datetime
// - phone must be a valid telephone number or must be null
Expand Down
2 changes: 1 addition & 1 deletion library/Rules/AllOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
self::TEMPLATE_SOME,
)]
#[Template(
'All of the required rules must pass for {{name}}',
'All the required rules must pass for {{name}}',
'None of these rules must pass for {{name}}',
self::TEMPLATE_NONE,
)]
Expand Down
6 changes: 3 additions & 3 deletions tests/feature/AssertWithKeysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
],
]),
<<<'FULL_MESSAGE'
- All of the required rules must pass for the given data
- All of the required rules must pass for mysql
- All the required rules must pass for the given data
- All the required rules must pass for mysql
- host must be a string
- user must be present
- password must be present
- schema must be a string
- All of the required rules must pass for postgresql
- All the required rules must pass for postgresql
- host must be present
- user must be a string
- password must be a string
Expand Down
2 changes: 1 addition & 1 deletion tests/feature/AssertWithPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function (): void {
->assert($object);
},
<<<'FULL_MESSAGE'
- All of the required rules must pass for the given data
- All the required rules must pass for the given data
- These rules must pass for mysql
- host must be a string
- These rules must pass for postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
test('Scenario #1', expectFullMessage(
fn() => Validator::stringType()->lengthBetween(2, 15)->assert(0),
<<<'FULL_MESSAGE'
- All of the required rules must pass for 0
- All the required rules must pass for 0
- 0 must be a string
- 0 must be a countable value or a string
FULL_MESSAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function (): void {
->assert(['username' => 'u', 'birthdate' => 'Not a date', 'password' => '']);
},
[
'__root__' => 'All of the required rules must pass for `["username": "u", "birthdate": "Not a date", "password": ""]`',
'__root__' => 'All the required rules must pass for `["username": "u", "birthdate": "Not a date", "password": ""]`',
'username' => 'The length of username must be between 2 and 32',
'birthdate' => 'birthdate must be a valid date/time',
'password' => 'password must not be empty',
Expand Down
6 changes: 3 additions & 3 deletions tests/feature/GetMessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
->key('schema', v::stringType()))
->assert(['mysql' => ['host' => 42, 'schema' => 42], 'postgresql' => ['user' => 42, 'password' => 42]]),
[
'__root__' => 'All of the required rules must pass for `["mysql": ["host": 42, "schema": 42], "postgresql": ["user": 42, "password": 42]]`',
'__root__' => 'All the required rules must pass for `["mysql": ["host": 42, "schema": 42], "postgresql": ["user": 42, "password": 42]]`',
'mysql' => [
'__root__' => 'All of the required rules must pass for mysql',
'__root__' => 'All the required rules must pass for mysql',
'host' => 'host must be a string',
'user' => 'user must be present',
'password' => 'password must be present',
'schema' => 'schema must be a string',
],
'postgresql' => [
'__root__' => 'All of the required rules must pass for postgresql',
'__root__' => 'All the required rules must pass for postgresql',
'host' => 'host must be present',
'user' => 'user must be a string',
'password' => 'password must be a string',
Expand Down
6 changes: 3 additions & 3 deletions tests/feature/GetMessagesWithReplacementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ function (): void {
);
},
[
'__root__' => 'All of the required rules must pass for `["mysql": ["host": 42, "schema": 42], "postgresql": ["user": 42, "password": 42]]`',
'__root__' => 'All the required rules must pass for `["mysql": ["host": 42, "schema": 42], "postgresql": ["user": 42, "password": 42]]`',
'mysql' => [
'__root__' => 'All of the required rules must pass for mysql',
'__root__' => 'All the required rules must pass for mysql',
'host' => '`host` should be a MySQL host',
'user' => 'Value should be a MySQL username',
'password' => 'password must be present',
'schema' => 'schema must be a string',
],
'postgresql' => [
'__root__' => 'All of the required rules must pass for postgresql',
'__root__' => 'All the required rules must pass for postgresql',
'host' => 'host must be present',
'user' => 'user must be a string',
'password' => 'password must be a string',
Expand Down
4 changes: 2 additions & 2 deletions tests/feature/Issues/Issue1333Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
fn() => v::noWhitespace()->email()->setName('User Email')->assert('not email'),
'User Email must not contain whitespaces',
<<<'FULL_MESSAGE'
- All of the required rules must pass for User Email
- All the required rules must pass for User Email
- User Email must not contain whitespaces
- User Email must be a valid email address
FULL_MESSAGE,
[
'__root__' => 'All of the required rules must pass for User Email',
'__root__' => 'All the required rules must pass for User Email',
'noWhitespace' => 'User Email must not contain whitespaces',
'email' => 'User Email must be a valid email address',
]
Expand Down
16 changes: 8 additions & 8 deletions tests/feature/Issues/Issue1348Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
<<<'FULL_MESSAGE'
- Each item in `[["manufacturer": "Honda", "model": "Accord"], ["manufacturer": "Toyota", "model": "Rav4"], ["manufacturer": "Fo ... ]` must be valid
- Only one of these rules must pass for `["manufacturer": "Ford", "model": "not real"]`
- All of the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`
- All the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`
- manufacturer must be equal to "Honda"
- model must be in `["Accord", "Fit"]`
- All of the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`
- All the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`
- manufacturer must be equal to "Toyota"
- model must be in `["Rav4", "Camry"]`
- These rules must pass for `["manufacturer": "Ford", "model": "not real"]`
- model must be in `["F150", "Bronco"]`
- Only one of these rules must pass for `["manufacturer": "Honda", "model": "not valid"]`
- These rules must pass for `["manufacturer": "Honda", "model": "not valid"]`
- model must be in `["Accord", "Fit"]`
- All of the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`
- All the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`
- manufacturer must be equal to "Toyota"
- model must be in `["Rav4", "Camry"]`
- All of the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`
- All the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`
- manufacturer must be equal to "Ford"
- model must be in `["F150", "Bronco"]`
FULL_MESSAGE,
Expand All @@ -52,12 +52,12 @@
'oneOf.3' => [
'__root__' => 'Only one of these rules must pass for `["manufacturer": "Ford", "model": "not real"]`',
'allOf.1' => [
'__root__' => 'All of the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`',
'__root__' => 'All the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`',
'manufacturer' => 'manufacturer must be equal to "Honda"',
'model' => 'model must be in `["Accord", "Fit"]`',
],
'allOf.2' => [
'__root__' => 'All of the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`',
'__root__' => 'All the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`',
'manufacturer' => 'manufacturer must be equal to "Toyota"',
'model' => 'model must be in `["Rav4", "Camry"]`',
],
Expand All @@ -67,12 +67,12 @@
'__root__' => 'Only one of these rules must pass for `["manufacturer": "Honda", "model": "not valid"]`',
'allOf.1' => 'model must be in `["Accord", "Fit"]`',
'allOf.2' => [
'__root__' => 'All of the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`',
'__root__' => 'All the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`',
'manufacturer' => 'manufacturer must be equal to "Toyota"',
'model' => 'model must be in `["Rav4", "Camry"]`',
],
'allOf.3' => [
'__root__' => 'All of the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`',
'__root__' => 'All the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`',
'manufacturer' => 'manufacturer must be equal to "Ford"',
'model' => 'model must be in `["F150", "Bronco"]`',
],
Expand Down
8 changes: 4 additions & 4 deletions tests/feature/Issues/Issue1376Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
->assert((object) ['author' => 'foo']),
'title must be present',
<<<'FULL_MESSAGE'
- All of the required rules must pass for `stdClass { +$author="foo" }`
- All the required rules must pass for `stdClass { +$author="foo" }`
- title must be present
- description must be present
- All of the required rules must pass for author
- All the required rules must pass for author
- author must be an integer
- The length of author must be between 1 and 2
- user must be present
FULL_MESSAGE,
[
'__root__' => 'All of the required rules must pass for `stdClass { +$author="foo" }`',
'__root__' => 'All the required rules must pass for `stdClass { +$author="foo" }`',
'title' => 'title must be present',
'description' => 'description must be present',
'author' => [
'__root__' => 'All of the required rules must pass for author',
'__root__' => 'All the required rules must pass for author',
'intType' => 'author must be an integer',
'lengthBetween' => 'The length of author must be between 1 and 2',
],
Expand Down
4 changes: 2 additions & 2 deletions tests/feature/Issues/Issue796Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
]),
'host must be a string',
<<<'FULL_MESSAGE'
- All of the required rules must pass for the given data
- All the required rules must pass for the given data
- These rules must pass for mysql
- host must be a string
- These rules must pass for postgresql
- user must be a string
FULL_MESSAGE,
[
'__root__' => 'All of the required rules must pass for the given data',
'__root__' => 'All the required rules must pass for the given data',
'mysql' => 'host must be a string',
'postgresql' => 'user must be a string',
]
Expand Down
4 changes: 2 additions & 2 deletions tests/feature/Issues/Issue799Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
->assert($input),
'1 must be an array value',
<<<'FULL_MESSAGE'
- All of the required rules must pass for 1
- All the required rules must pass for 1
- 1 must be an array value
- scheme must be present
FULL_MESSAGE,
[
'__root__' => 'All of the required rules must pass for 1',
'__root__' => 'All the required rules must pass for 1',
'arrayVal' => '1 must be an array value',
'scheme' => 'scheme must be present',
]
Expand Down
2 changes: 1 addition & 1 deletion tests/feature/KeysAsValidatorNamesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function (): void {
->assert(['username' => '0', 'birthdate' => 'Whatever']);
},
<<<'FULL_MESSAGE'
- All of the required rules must pass for User Subscription Form
- All the required rules must pass for User Subscription Form
- The length of username must be between 2 and 32
- birthdate must be a valid date/time
FULL_MESSAGE,
Expand Down
2 changes: 1 addition & 1 deletion tests/feature/Readme/CustomMessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'length' => '{{name}} must not have more than 15 chars',
]),
[
'__root__' => 'All of the required rules must pass for "really messed up screen#name"',
'__root__' => 'All the required rules must pass for "really messed up screen#name"',
'alnum' => '"really messed up screen#name" must contain only letters and digits',
'noWhitespace' => '"really messed up screen#name" cannot contain spaces',
'lengthBetween' => 'The length of "really messed up screen#name" must be between 1 and 15',
Expand Down
2 changes: 1 addition & 1 deletion tests/feature/Readme/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
test('Scenario #1', expectFullMessage(
fn() => v::alnum()->noWhitespace()->lengthBetween(1, 15)->assert('really messed up screen#name'),
<<<'FULL_MESSAGE'
- All of the required rules must pass for "really messed up screen#name"
- All the required rules must pass for "really messed up screen#name"
- "really messed up screen#name" must contain only letters (a-z) and digits (0-9)
- "really messed up screen#name" must not contain whitespaces
- The length of "really messed up screen#name" must be between 1 and 15
Expand Down
2 changes: 1 addition & 1 deletion tests/feature/Readme/GettingMessagesAsAnArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
test('Scenario #1', expectMessages(
fn() => v::alnum()->noWhitespace()->lengthBetween(1, 15)->assert('really messed up screen#name'),
[
'__root__' => 'All of the required rules must pass for "really messed up screen#name"',
'__root__' => 'All the required rules must pass for "really messed up screen#name"',
'alnum' => '"really messed up screen#name" must contain only letters (a-z) and digits (0-9)',
'noWhitespace' => '"really messed up screen#name" must not contain whitespaces',
'lengthBetween' => 'The length of "really messed up screen#name" must be between 1 and 15',
Expand Down
4 changes: 2 additions & 2 deletions tests/feature/Rules/AllOfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
fn() => v::allOf(v::intType(), v::negative())->assert('2'),
'"2" must be an integer',
<<<'FULL_MESSAGE'
- All of the required rules must pass for "2"
- All the required rules must pass for "2"
- "2" must be an integer
- "2" must be a negative number
FULL_MESSAGE,
[
'__root__' => 'All of the required rules must pass for "2"',
'__root__' => 'All the required rules must pass for "2"',
'intType' => '"2" must be an integer',
'negative' => '"2" must be a negative number',
]
Expand Down
8 changes: 4 additions & 4 deletions tests/feature/Rules/AttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@
fn() => v::attributes()->assert(new WithAttributes('', 'not an email', 'not a date', 'not a phone number')),
'name must not be empty',
<<<'FULL_MESSAGE'
- All of the required rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="" +$email="not an email" +$birthdate="not a date" +$phone ... }`
- All the required rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="" +$email="not an email" +$birthdate="not a date" +$phone ... }`
- name must not be empty
- email must be a valid email address
- All of the required rules must pass for birthdate
- All the required rules must pass for birthdate
- birthdate must be a valid date in the format "2005-12-30"
- For comparison with now, birthdate must be a valid datetime
- phone must be a valid telephone number or must be null
FULL_MESSAGE,
[
'__root__' => 'All of the required rules must pass for `Respect\\Validation\\Test\\Stubs\\WithAttributes { +$name="" +$email="not an email" +$birthdate="not a date" +$phone ... }`',
'__root__' => 'All the required rules must pass for `Respect\\Validation\\Test\\Stubs\\WithAttributes { +$name="" +$email="not an email" +$birthdate="not a date" +$phone ... }`',
'name' => 'name must not be empty',
'email' => 'email must be a valid email address',
'birthdate' => [
'__root__' => 'All of the required rules must pass for birthdate',
'__root__' => 'All the required rules must pass for birthdate',
'date' => 'birthdate must be a valid date in the format "2005-12-30"',
'dateTimeDiffLessThanOrEqual' => 'For comparison with now, birthdate must be a valid datetime',
],
Expand Down
8 changes: 4 additions & 4 deletions tests/feature/Rules/DateTimeDiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@
fn() => v::dateTimeDiff('years', v::primeNumber()->between(2, 5))->assert('1 year ago'),
'The number of years between now and 1 year ago must be a prime number',
<<<'FULL_MESSAGE'
- All of the required rules must pass for 1 year ago
- All the required rules must pass for 1 year ago
- The number of years between now and 1 year ago must be a prime number
- The number of years between now and 1 year ago must be between 2 and 5
FULL_MESSAGE,
[
'__root__' => 'All of the required rules must pass for 1 year ago',
'__root__' => 'All the required rules must pass for 1 year ago',
'dateTimeDiffPrimeNumber' => 'The number of years between now and 1 year ago must be a prime number',
'dateTimeDiffBetween' => 'The number of years between now and 1 year ago must be between 2 and 5',
]
Expand All @@ -136,12 +136,12 @@
])->assert('1 year ago'),
'The number of years between now and 1 year ago must be a prime number',
<<<'FULL_MESSAGE'
- All of the required rules must pass for 1 year ago
- All the required rules must pass for 1 year ago
- The number of years between now and 1 year ago must be a prime number
- The number of years between now and 1 year ago must be between 2 and 5
FULL_MESSAGE,
[
'__root__' => 'All of the required rules must pass for 1 year ago',
'__root__' => 'All the required rules must pass for 1 year ago',
'dateTimeDiffPrimeNumber' => 'The number of years between now and 1 year ago must be a prime number',
'dateTimeDiffBetween' => 'The number of years between now and 1 year ago must be between 2 and 5',
]
Expand Down
Loading

0 comments on commit 873be39

Please sign in to comment.