mirror of
https://github.com/Respect/Validation.git
synced 2026-03-15 06:45:44 +01:00
The documents on translation were updated to feature symfony with an array provider. Duplicated container notes were extracted to a single configuration.md file. An API for accessing the messages, so users don't have to copy and paste them from the source or docs, was provided and TemplateResolver was refactored to use it.
918 B
918 B
Case Insensitive Validation
For most simple cases, you can use v::after wrappers to perform
case normalization before comparison.
For strings:
v::after(strtolower(...), v::contains('cde'))->assert('ABCDEF');
// Validation passes successfully
v::after(strtolower(...), v::contains('xxx'))->assert('ABCDEF');
// → "abcdef" must contain "xxx"
For arrays:
v::after(
static fn ($i) => array_map(strtolower(...), $i),
v::contains('abc')
)->assert(['ABC', 'DEF']);
// Validation passes successfully
v::after(
static fn ($i) => array_map(strtolower(...), $i),
v::contains('xxx')
)->assert(['ABC', 'DEF']);
// → `["abc", "def"]` must contain "xxx"