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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/Runner.php
Expand Up @@ -23,6 +23,9 @@

class Runner
{
const SUCCESS = 0;
const FAILURE = 1;
const INVALID = 2;

/**
* The config data for the run.
Expand Down Expand Up @@ -81,7 +84,7 @@ public function runPHPCS()
$ruleset->explain();
}

return 0;
return self::SUCCESS;
}

// Generate documentation for each of the supplied standards.
Expand All @@ -95,7 +98,7 @@ public function runPHPCS()
$generator->generate();
}

return 0;
return self::SUCCESS;
}

// Other report formats don't really make sense in interactive mode
Expand Down Expand Up @@ -136,13 +139,13 @@ public function runPHPCS()

if ($numErrors === 0) {
// No errors found.
return 0;
return self::SUCCESS;
} else if ($this->reporter->totalFixable === 0) {
// Errors found, but none of them can be fixed by PHPCBF.
return 1;
return self::FAILURE;
} else {
// Errors found, and some can be fixed by PHPCBF.
return 2;
return self::INVALID;
}

}//end runPHPCS()
Expand Down Expand Up @@ -215,20 +218,20 @@ public function runPHPCBF()
// Nothing was fixed by PHPCBF.
if ($this->reporter->totalFixable === 0) {
// Nothing found that could be fixed.
return 0;
return self::SUCCESS;
} else {
// Something failed to fix.
return 2;
return self::INVALID;
}
}

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

// PHPCBF fixed some fixable errors, but others failed to fix.
return 2;
return self::INVALID;

}//end runPHPCBF()

Expand Down