2026-02-15 21:58:42 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/** @noinspection PhpMissingClassConstantTypeInspection */
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace StaticPHP\Command;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return codes for command execution.
|
|
|
|
|
*
|
|
|
|
|
* This enum defines standard return codes that can be used by commands to indicate
|
|
|
|
|
* the result of their execution. It includes codes for success, various types of errors,
|
|
|
|
|
* and an interrupt signal.
|
|
|
|
|
*/
|
|
|
|
|
trait ReturnCode
|
|
|
|
|
{
|
|
|
|
|
public const int OK = 0;
|
|
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
public const SUCCESS = 0; // alias
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
public const FAILURE = 1; // generic failure
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
// 64-69: reserved for standard errors
|
|
|
|
|
public const int USER_ERROR = 64; // wrong usage, bad arguments
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
public const int VALIDATION_ERROR = 65; // invalid input or config values
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
public const int ENVIRONMENT_ERROR = 69; // required tools/env not available
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
// 70+: application-specific errors
|
|
|
|
|
public const int INTERNAL_ERROR = 70; // internal logic error or unexpected state
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
public const int BUILD_ERROR = 72; // build / compile process failed
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
public const int PATCH_ERROR = 73; // patching or modifying files failed
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
public const int FILE_SYSTEM_ERROR = 74; // filesystem / IO error
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
public const int DOWNLOAD_ERROR = 75; // network / remote resource error
|
2026-02-15 21:58:42 +08:00
|
|
|
|
2026-02-28 15:36:04 +08:00
|
|
|
// 128+: reserved for standard signals and interrupts
|
|
|
|
|
public const int INTERRUPT_SIGNAL = 130; // SIGINT (Ctrl+C)
|
2026-02-15 21:58:42 +08:00
|
|
|
}
|