mirror of
https://github.com/Respect/Validation.git
synced 2026-03-18 08:09:51 +01:00
Improves SPDX header linting to ensure consistent license metadata across the codebase. Key changes: - Enforce deterministic tag ordering (License-Identifier, FileCopyrightText, FileContributor) to ensure consistency, prevent merge conflicts, and simplify code reviews - Add contributor alias mapping to consolidate contributors with multiple emails or name variations (e.g., "nickl-" → "Nick Lombard") - Add --contributions-strategy option with "blame" (current code authors) and "log" (all historical contributors) to support different attribution philosophies - Add optional path argument to lint specific files or directories - Add --fix option to automatically correct header issues Assisted-by: Claude Code (claude-opus-4-5-20251101)
2 KiB
2 KiB
ContainsCount
ContainsCount(mixed $containsValue, int $count)
Validates if the input contains a value a specific number of times.
For strings:
v::containsCount('ipsum', 2)->assert('ipsum lorem ipsum');
// Validation passes successfully
For arrays:
v::containsCount('ipsum', 2)->assert(['ipsum', 'lorem', 'ipsum']);
// Validation passes successfully
Templates
ContainsCount::TEMPLATE_TIMES
| Mode | Template |
|---|---|
default |
{{subject}} must contain {{containsValue}} {{count}} time(s) |
inverted |
{{subject}} must not contain {{containsValue}} {{count}} time(s) |
ContainsCount::TEMPLATE_ONCE
| Mode | Template |
|---|---|
default |
{{subject}} must contain {{containsValue}} only once |
inverted |
{{subject}} must not contain {{containsValue}} only once |
Template placeholders
| Placeholder | Description |
|---|---|
containsValue |
The value to search for in the input. |
subject |
The validated input or the custom validator name (if specified). |
count |
Number of times that the needle might appear in the haystack. |
Categorization
- Arrays
- Strings
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Created |