static-php-cli/src/SPC/command/DoctorCommand.php

26 lines
698 B
PHP
Raw Normal View History

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>');
return 1;
}
return 0;
2023-04-22 17:45:43 +08:00
}
}