Skip to content

Add constants for exit return codes#3696

Closed
BafS wants to merge 1 commit into
squizlabs:masterfrom
BafS:patch-1
Closed

Add constants for exit return codes#3696
BafS wants to merge 1 commit into
squizlabs:masterfrom
BafS:patch-1

Conversation

@BafS

@BafS BafS commented Oct 18, 2022

Copy link
Copy Markdown

Inspired by https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/Console/Command/Command.php#L37-L40, to make the code more readable and to avoid miss-using exit codes.

@gsherwood

Copy link
Copy Markdown
Member

This is a good idea in general, but the exit codes don't map like that. PHPCS and PHPCBF use the same exit codes to mean different things, which has resulted in a suggestion like:

if ($this->reporter->totalFixable === 0) {
    // PHPCBF fixed all fixable errors.
    return self::FAILURE;
}

That's obviously not a failed run for PHPCS given it fixed all errors.

So this would need a bit of work before it could be merged. Likely different constants for PHPCS and PHPCBF, with appropriate names and documentation of the constant itself.

Linking the 4.0 issue to change the exit codes as this would be helpful there: #2898

@BafS

BafS commented Oct 27, 2022

Copy link
Copy Markdown
Author

I see that return codes are not consistent, so maybe that could be done for v4 only yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants