|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Exit codes. |
| 4 | + * |
| 5 | + * Note: The "missing" exit codes 8 and 32 are reserved for future use. |
| 6 | + * |
| 7 | + * --------------------------------------------------------------------------------------------- |
| 8 | + * This class is intended for internal use only and is not part of the public API. |
| 9 | + * This also means that it has no promise of backward compatibility. Use at your own risk. |
| 10 | + * --------------------------------------------------------------------------------------------- |
| 11 | + * |
| 12 | + * @internal |
| 13 | + * |
| 14 | + * @copyright 2025 PHPCSStandards and contributors |
| 15 | + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence |
| 16 | + */ |
| 17 | + |
| 18 | +namespace PHP_CodeSniffer\Util; |
| 19 | + |
| 20 | +final class ExitCode |
| 21 | +{ |
| 22 | + |
| 23 | + /** |
| 24 | + * Exit code to indicate no issues were found in the code under scan; or a non-scan request succeeded. |
| 25 | + * |
| 26 | + * @var int |
| 27 | + */ |
| 28 | + public const OKAY = 0; |
| 29 | + |
| 30 | + /** |
| 31 | + * Exit code to indicate auto-fixable issues were found. |
| 32 | + * |
| 33 | + * @var int |
| 34 | + */ |
| 35 | + public const FIXABLE = 1; |
| 36 | + |
| 37 | + /** |
| 38 | + * Exit code to indicate issues were found, which are not auto-fixable. |
| 39 | + * |
| 40 | + * @var int |
| 41 | + */ |
| 42 | + public const NON_FIXABLE = 2; |
| 43 | + |
| 44 | + /** |
| 45 | + * [CBF only] Exit code to indicate a file failed to fix. |
| 46 | + * |
| 47 | + * Typically, this is caused by a fixer conflict between sniffs. |
| 48 | + * |
| 49 | + * @var int |
| 50 | + */ |
| 51 | + public const FAILED_TO_FIX = 4; |
| 52 | + |
| 53 | + /** |
| 54 | + * Exit code to indicate PHP_CodeSniffer ran into a problem while processing the request. |
| 55 | + * |
| 56 | + * Examples of when this code should be used: |
| 57 | + * - Invalid CLI flag used. |
| 58 | + * - Blocking errors in the ruleset file(s). |
| 59 | + * - A dependency required to generate a report not being available, like git for the gitblame report. |
| 60 | + * |
| 61 | + * @var int |
| 62 | + */ |
| 63 | + public const PROCESS_ERROR = 16; |
| 64 | + |
| 65 | + /** |
| 66 | + * Exit code to indicate the requirements to run PHP_CodeSniffer are not met. |
| 67 | + * |
| 68 | + * This exit code is here purely for documentation purposes. |
| 69 | + * This exit code should only be used in the requirements check (`requirements.php` file), but that |
| 70 | + * file can't use the constant as it would block _this_ file from using modern PHP. |
| 71 | + * |
| 72 | + * {@internal The code in the requirements.php file and below should always stay in sync!} |
| 73 | + * |
| 74 | + * @var int |
| 75 | + */ |
| 76 | + public const REQUIREMENTS_NOT_MET = 64; |
| 77 | + |
| 78 | + |
| 79 | +}//end class |
0 commit comments