respect-validation/docs/rules/NotEmpty.md
Henrique Moody 061a3c9c09
Rename method "validate()" to "isValid()"
The method has been renamed some time ago, but I haven't updated the
documentation to cause less confusion. Now that I want to start updating
the documentation, I switched the default branch on GitHub to the latest
stable version, so I assume there will be less confusion in the
documentation, and I can start updating the docs for the next version.
2024-12-02 22:11:57 +01:00

991 B

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

Categorization

  • Miscellaneous

Changelog

Version Description
0.3.9 Created

See also: