diff --git a/validator.php b/validator.php index d3896879..24e3f3c9 100644 --- a/validator.php +++ b/validator.php @@ -177,6 +177,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!array_key_exists('time', $branch)) { $messages[$path][] = sprintf('Key "time" is required for branch "%s".', $name); + } elseif (isset($branch['time'])) { + $timestamp = is_int($branch['time']) ? $branch['time'] : strtotime($branch['time']); + + if ($timestamp === false) { + $messages[$path][] = sprintf('"time" is invalid for branch "%s", given "%s".', $name, $branch['time']); + } elseif ($timestamp > time()) { + $messages[$path][] = sprintf('"time" cannot be in the future for branch "%s", given "%s".', $name, $branch['time']); + } } if (!isset($branch['versions'])) {