mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-10 10:25:36 +08:00
Refactor exception handler to v3, use standard shell exitcode
This commit is contained in:
@@ -29,7 +29,7 @@ class EnvCommand extends BaseCommand
|
||||
$env = $this->getArgument('env');
|
||||
if (($val = getenv($env)) === false) {
|
||||
$this->output->writeln("<error>Environment variable '{$env}' is not set.</error>");
|
||||
return static::FAILURE;
|
||||
return static::USER_ERROR;
|
||||
}
|
||||
if (is_array($val)) {
|
||||
foreach ($val as $k => $v) {
|
||||
|
||||
@@ -29,6 +29,6 @@ class IsInstalledCommand extends BaseCommand
|
||||
return static::SUCCESS;
|
||||
}
|
||||
$this->output->writeln("<error>Package [{$package}] is not installed.</error>");
|
||||
return static::FAILURE;
|
||||
return static::USER_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class LintConfigCommand extends BaseCommand
|
||||
|
||||
if ($checkOnly && $hasChanges) {
|
||||
$this->output->writeln('<error>Some config files need sorting. Run "bin/spc dev:lint-config" to fix them.</error>');
|
||||
return static::FAILURE;
|
||||
return static::VALIDATION_ERROR;
|
||||
}
|
||||
|
||||
return static::SUCCESS;
|
||||
@@ -125,7 +125,7 @@ class LintConfigCommand extends BaseCommand
|
||||
return false;
|
||||
}
|
||||
ksort($data);
|
||||
foreach ($data as $artifact_name => &$config) {
|
||||
foreach ($data as &$config) {
|
||||
uksort($config, $config_type === 'artifact' ? [$this, 'artifactSortKey'] : [$this, 'packageSortKey']);
|
||||
}
|
||||
unset($config);
|
||||
|
||||
@@ -28,6 +28,6 @@ class ShellCommand extends BaseCommand
|
||||
return $code;
|
||||
}
|
||||
$this->output->writeln('<error>Unsupported OS for shell command.</error>');
|
||||
return static::FAILURE;
|
||||
return static::ENVIRONMENT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user