
| Current Path : /var/www/html/rocksensor3/vendor/chi-teck/drupal-code-generator/src/Validator/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor3/vendor/chi-teck/drupal-code-generator/src/Validator/Required.php |
<?php
declare(strict_types=1);
namespace DrupalCodeGenerator\Validator;
/**
* Validates that the value is not empty.
*/
final class Required {
/**
* @throws \UnexpectedValueException
*/
public function __invoke(mixed $value): mixed {
// FALSE is not considered as empty value because question helper uses
// it as negative answer on confirmation questions.
if ($value === NULL || $value === '' || $value === []) {
throw new \UnexpectedValueException('The value is required.');
}
return $value;
}
}