0 follower

Final Class Yiisoft\Validator\EmptyCondition\NeverEmpty

InheritanceYiisoft\Validator\EmptyCondition\NeverEmpty

Empty condition is a callable returning true if a value must be considered empty.

With NeverEmpty a value is always considered non-empty. With regard to validation process, a corresponding rule is never skipped if NeverEmpty is set:

  • At a rule level via $skipOnEmpty property, but only for rules implementing {@see \Yiisoft\Validator\Rule\Trait\SkipOnEmptyTrait} / including {@see \Yiisoft\Validator\Rule\Trait\SkipOnEmptyTrait}.
  • At validator level ({@see \Yiisoft\Validator\Validator::$defaultSkipOnEmptyCondition}).

This is a default behavior for all built-in rules.

A shortcut for new NeverEmpty() is false.

Method Details

Hide inherited methods

__invoke() public method

public boolean __invoke ( mixed $value, boolean $isPropertyMissing false )
$value mixed

The validated value.

$isPropertyMissing boolean

A flag defining whether the property is missing (not used / not passed at all).

return boolean

Whether the validated value is considered empty.

                public function __invoke(mixed $value, bool $isPropertyMissing = false): bool
{
    return false;
}