2023-04-22 17:45:43 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\command;
|
|
|
|
|
|
2023-04-22 21:23:12 +08:00
|
|
|
use SPC\doctor\CheckListHandler;
|
2023-04-22 17:45:43 +08:00
|
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
|
|
|
|
|
|
|
|
#[AsCommand('doctor', 'Diagnose whether the current environment can compile normally')]
|
|
|
|
|
class DoctorCommand extends BaseCommand
|
|
|
|
|
{
|
|
|
|
|
public function handle(): int
|
|
|
|
|
{
|
2023-04-22 21:23:12 +08:00
|
|
|
try {
|
|
|
|
|
$checker = new CheckListHandler($this->input, $this->output);
|
|
|
|
|
$checker->runCheck(FIX_POLICY_PROMPT);
|
|
|
|
|
$this->output->writeln('<info>Doctor check complete !</info>');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
$this->output->writeln('<error>' . $e->getMessage() . '</error>');
|
2023-04-30 12:42:19 +08:00
|
|
|
pcntl_signal(SIGINT, SIG_IGN);
|
2023-04-22 21:23:12 +08:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2023-04-22 17:45:43 +08:00
|
|
|
}
|
|
|
|
|
}
|