Skip to content

Commit 492aacb

Browse files
authored
1 parent d7864cb commit 492aacb

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/Runner.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323

2424
class Runner
2525
{
26+
const SUCCESS = 0;
27+
const FAILURE = 1;
28+
const INVALID = 2;
2629

2730
/**
2831
* The config data for the run.
@@ -81,7 +84,7 @@ public function runPHPCS()
8184
$ruleset->explain();
8285
}
8386

84-
return 0;
87+
return self::SUCCESS;
8588
}
8689

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

98-
return 0;
101+
return self::SUCCESS;
99102
}
100103

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

137140
if ($numErrors === 0) {
138141
// No errors found.
139-
return 0;
142+
return self::SUCCESS;
140143
} else if ($this->reporter->totalFixable === 0) {
141144
// Errors found, but none of them can be fixed by PHPCBF.
142-
return 1;
145+
return self::FAILURE;
143146
} else {
144147
// Errors found, and some can be fixed by PHPCBF.
145-
return 2;
148+
return self::INVALID;
146149
}
147150

148151
}//end runPHPCS()
@@ -215,20 +218,20 @@ public function runPHPCBF()
215218
// Nothing was fixed by PHPCBF.
216219
if ($this->reporter->totalFixable === 0) {
217220
// Nothing found that could be fixed.
218-
return 0;
221+
return self::SUCCESS;
219222
} else {
220223
// Something failed to fix.
221-
return 2;
224+
return self::INVALID;
222225
}
223226
}
224227

225228
if ($this->reporter->totalFixable === 0) {
226229
// PHPCBF fixed all fixable errors.
227-
return 1;
230+
return self::FAILURE;
228231
}
229232

230233
// PHPCBF fixed some fixable errors, but others failed to fix.
231-
return 2;
234+
return self::INVALID;
232235

233236
}//end runPHPCBF()
234237

0 commit comments

Comments
 (0)