Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Fix Constraints docs #10

Merged
merged 2 commits into from Apr 18, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/src/constraints.md
Expand Up @@ -5,7 +5,7 @@ assigned.

While Formidable ships with a small set of constraints, these are primarily consumed by the `FieldMappingFactory`, so
generally you will want to write your own constraints. To do so, create a new class which implements the
`ConstaintInterface`. That class will have a single method `__invoke($value)`, which must return a `ValidationResult`.
`ConstraintInterface`. That class will have a single method `__invoke($value)`, which must return a `ValidationResult`.
In case an empty validation result is returned, it is considered successful.

A constraint always gets the converted value passed. So in case of a field mapping, you'll get a scalar PHP value. In
Expand Down Expand Up @@ -47,7 +47,7 @@ $mapping = FieldMappingFactory::text()->verifying(new PatternConstraint());
as you assign the constraint to the correct mapping , but since we do not have generics yet, you should actually
assert the input type which you receive.

See [Assert package on Github](https://github.com/beberlei/assert)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you take this part out of the note?

See [Assert package on Github](https://github.com/beberlei/assert)

# Context validation

Expand Down Expand Up @@ -95,7 +95,7 @@ custom `PasswordConfirmationConstraint` class:
new ValidationError('error.password-mismatch', [], 'passwordConfirm')
```

The 'passwordConfirm' argument matches the key of one of the child mappings. This specifies which child mapping the
The `passwordConfirm` argument matches the key of one of the child mappings. This specifies which child mapping the
validation error should be attached to. If we omit that parameter, the error defaults to the parent object mapping. In
case of a root mapping, this would have resulted in a global context for any password contstraint validation error. In
some cases you might want to keep the global error context, but for cases where it is desirable to associate a
Expand Down