respect-validation/docs/case-sensitiveness.md
Alexandre Gomes Gaigalas 91ceaafd2d Update translation docs
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.
2026-02-06 17:11:34 +00:00

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"