Skip to content

Commit

Permalink
PHPCBF now has command line args to change its behaviour
Browse files Browse the repository at this point in the history
--suffix=[suffix] will output a fixed version of each file with a filename suffix. Leaving this empty will overrite the file.

--no-patch will replace files with PHP instead of the patch command. This is useful if you are on a platform that doesn't support diff and patch.
  • Loading branch information
gsherwood committed Aug 19, 2013
1 parent 5863774 commit 53358a1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions scripts/phpcbf
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,22 @@ if (is_file(dirname(__FILE__).'/../CodeSniffer/CLI.php') === true) {

$phpcs = new PHP_CodeSniffer_CLI();
$phpcs->checkRequirements();
$cliValues = $phpcs->getCommandLineValues();

$phpcs->dieOnUnknownArg = false;

// Override some of the command line settings that might break the fixes.
$cliValues = $phpcs->getCommandLineValues();
$cliValues['generator'] = '';
$cliValues['explain'] = false;

$suffix = '';
$suffix = '';
if (isset($cliValues['suffix']) === true) {
$suffix = $cliValues['suffix'];
}

$allowPatch = true;
if (isset($cliValues['no-patch']) === true) {
$allowPatch = false;
}

if ($suffix === '' && $allowPatch === true) {
// Using the diff/patch tools.
Expand Down

0 comments on commit 53358a1

Please sign in to comment.