diff --git a/fix.php b/fix.php index 1ca6543..a18463c 100644 --- a/fix.php +++ b/fix.php @@ -28,6 +28,8 @@ // parse arguments $paths = []; +$finderFormat = 'txt'; +$snifferFormat = 'source'; $preset = null; $dry = true; @@ -39,7 +41,11 @@ $dry = false; } elseif ($arg === 'check') { // ignore - } else { + } elseif ($arg === '--finder-output-format') { + $finderFormat = $argv[++$i]; + } elseif ($arg === '--sniffer-output-format') { + $snifferFormat = $argv[++$i]; + }else { $paths[] = $arg; } } @@ -85,7 +91,7 @@ || version_compare(PHP_VERSION, $m[1], '>='); }) ->in($paths); - + $fileList = __DIR__ . '/filelist.tmp'; file_put_contents($fileList, implode("\n", iterator_to_array($finder))); @@ -95,6 +101,7 @@ PHP_BINARY . ' ' . escapeshellarg($vendorDir . '/friendsofphp/php-cs-fixer/php-cs-fixer') . ' fix -v' . ($dry ? ' --dry-run' : '') + . ' --format ' . $finderFormat . ' --config ' . escapeshellarg(__DIR__ . "/preset-fixer/$preset.php"), $code ); @@ -119,6 +126,7 @@ . ' --extensions=php,phpt' . ' --runtime-set ignore_warnings_on_exit true' . ' --no-cache' + . ' --report=' . $snifferFormat . ' --standard=' . escapeshellarg($presetFile) . ' --file-list=' . escapeshellarg($fileList), $code