Skip to content

Commit

Permalink
Optimize time zone question (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records authored Jul 23, 2021
1 parent 2880c7a commit a52c6a7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion installer/OptionalPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,18 @@ public function installHyperfScript()
$ask[] = "\n <question>What time zone do you want to setup ?</question>\n";
$ask[] = " [<comment>n</comment>] Default time zone for php.ini\n";
$ask[] = "Make your selection or type a time zone name, like Asia/Shanghai (n):\n";
$answer = $this->io->ask(implode('', $ask), 'n');
$answer = $this->io->askAndValidate(
implode('', $ask),
function ($value) {
if ($value === 'y' || $value === 'yes') {
throw new \InvalidArgumentException("You should type a time zone name, like Asia/Shanghai. Or type n to skip.");
}

return $value;
},
null,
'n'
);

$content = file_get_contents($this->installerSource . '/resources/bin/hyperf.stub');
if ($answer != 'n') {
Expand Down

0 comments on commit a52c6a7

Please sign in to comment.