respect-validation/docs/rules/NotEmpty.md
Henrique Moody 8e77021ce7
Reformat documentation files
There was some inconsistent Markdown, and some links were out of sync.
2025-12-27 17:03:25 +01:00

1.5 KiB

NotEmpty

  • NotEmpty()

Validates wether the given input is not empty. This function also takes whitespace into account, use noWhitespace() if no spaces or linebreaks and other whitespace anywhere in the input is desired.

v::stringType()->notEmpty()->isValid(''); // false

Null values are empty:

v::notEmpty()->isValid(null); // false

Numbers:

v::intVal()->notEmpty()->isValid(0); // false

Empty arrays:

v::arrayVal()->notEmpty()->isValid([]); // false

Whitespace:

v::stringType()->notEmpty()->isValid('        ');  //false
v::stringType()->notEmpty()->isValid("\t \n \r");  //false

Templates

NotEmpty::TEMPLATE_STANDARD

Mode Template
default {{subject}} must not be empty
inverted {{subject}} must be empty

Template placeholders

Placeholder Description
subject The validated input or the custom validator name (if specified).

Categorization

  • Miscellaneous

Changelog

Version Description
0.3.9 Created

See also: