function is_nullable_vec_like_of_strings()

in src/TypeAssert.hack [54:69]


function is_nullable_vec_like_of_strings(
  mixed $value,
  string $field,
): ?vec<string> {
  if ($value === null) {
    return null;
  }

  invariant($value is Traversable<_>, '%s should be an ?vec<string>', $field);
  $out = vec[];
  foreach ($value as $it) {
    invariant($it is string, '%s should be an ?vec<string>', $field);
    $out[] = $it;
  }
  return $out;
}