Assert\Assertion::notEmpty PHP Метод

notEmpty() публичный статический Метод

Assert that value is not empty
public static notEmpty ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean
    public static function notEmpty($value, $message = null, $propertyPath = null)
    {
        if (empty($value)) {
            $message = sprintf($message ?: 'Value "%s" is empty, but non empty value was expected.', static::stringify($value));
            throw static::createException($value, $message, static::VALUE_EMPTY, $propertyPath);
        }
        return true;
    }

Usage Example

Пример #1
0
 /**
  * @param SnapshotStore $snapshotStore
  * @param AggregateRepository[] $aggregateRepositories
  */
 public function __construct(SnapshotStore $snapshotStore, array $aggregateRepositories)
 {
     Assertion::notEmpty($aggregateRepositories);
     Assertion::allIsInstanceOf($aggregateRepositories, AggregateRepository::class);
     $this->snapshotStore = $snapshotStore;
     $this->aggregateRepositories = $aggregateRepositories;
 }
All Usage Examples Of Assert\Assertion::notEmpty