Countable

February 3, 2026 · View on GitHub

  • Countable()

Validates if the input is countable, in other words, if you're allowed to use count() function on it.

v::countable()->assert([]);
// Validation passes successfully

v::countable()->assert(new ArrayObject());
// Validation passes successfully

v::countable()->assert('string');
// → "string" must be countable

Templates

Countable::TEMPLATE_STANDARD

ModeTemplate
default{{subject}} must be countable
inverted{{subject}} must not be countable

Template placeholders

PlaceholderDescription
subjectThe validated input or the custom validator name (if specified).

Categorization

  • Types

Changelog

VersionDescription
3.0.0Templates changed
1.0.0Created from ArrayVal

See Also