Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constants for exit return codes #3696

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

BafS
Copy link

@BafS BafS commented Oct 18, 2022

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
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
Copy link
Author

BafS commented Oct 27, 2022

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.

2 participants