3131use Psalm \Progress \VoidProgress ;
3232use Psalm \Report ;
3333use Psalm \Report \ReportOptions ;
34+ use ReflectionClass ;
3435use RuntimeException ;
3536use Symfony \Component \Filesystem \Path ;
3637
3738use function array_filter ;
3839use function array_key_exists ;
40+ use function array_keys ;
3941use function array_map ;
4042use function array_merge ;
4143use function array_slice ;
6769use function preg_replace ;
6870use function realpath ;
6971use function setlocale ;
72+ use function sort ;
7073use function str_repeat ;
7174use function str_replace ;
7275use function strlen ;
7376use function strpos ;
7477use function substr ;
78+ use function wordwrap ;
7579
7680use const DIRECTORY_SEPARATOR ;
7781use const JSON_THROW_ON_ERROR ;
8791require_once __DIR__ . '/../Composer.php ' ;
8892require_once __DIR__ . '/../IncludeCollector.php ' ;
8993require_once __DIR__ . '/../../IssueBuffer.php ' ;
94+ require_once __DIR__ . '/../../Report.php ' ;
9095
9196/**
9297 * @internal
@@ -1250,6 +1255,21 @@ private static function generateStubs(
12501255 */
12511256 private static function getHelpText (): string
12521257 {
1258+ $ formats = [];
1259+ /** @var string $value */
1260+ foreach ((new ReflectionClass (Report::class))->getConstants () as $ constant => $ value ) {
1261+ if (strpos ($ constant , 'TYPE_ ' ) === 0 ) {
1262+ $ formats [] = $ value ;
1263+ }
1264+ }
1265+ sort ($ formats );
1266+ $ outputFormats = wordwrap (implode (', ' , $ formats ), 75 , "\n " );
1267+
1268+ /** @psalm-suppress ImpureMethodCall */
1269+ $ reports = array_keys (Report::getMapping ());
1270+ sort ($ reports );
1271+ $ reportFormats = wordwrap ('" ' . implode ('", " ' , $ reports ) . '" ' , 75 , "\n " );
1272+
12531273 return <<<HELP
12541274 Usage:
12551275 psalm [options] [file...]
@@ -1333,8 +1353,8 @@ private static function getHelpText(): string
13331353
13341354 --output-format=console
13351355 Changes the output format.
1336- Available formats: compact, console, text, emacs, json, pylint, xml, checkstyle, junit, sonarqube,
1337- github, phpstorm, codeclimate, by-issue-level
1356+ Available formats:
1357+ $ outputFormats
13381358
13391359 --no-progress
13401360 Disable the progress indicator
@@ -1348,8 +1368,7 @@ private static function getHelpText(): string
13481368 Reports:
13491369 --report=PATH
13501370 The path where to output report file. The output format is based on the file extension.
1351- (Currently supported formats: ".json", ".xml", ".txt", ".emacs", ".pylint", ".console",
1352- ".sarif", "checkstyle.xml", "sonarqube.json", "codeclimate.json", "summary.json", "junit.xml")
1371+ (Currently supported formats: $ reportFormats)
13531372
13541373 --report-show-info[=BOOLEAN]
13551374 Whether the report should include non-errors in its output (defaults to true)
0 commit comments