31
31
use Psalm \Progress \VoidProgress ;
32
32
use Psalm \Report ;
33
33
use Psalm \Report \ReportOptions ;
34
+ use ReflectionClass ;
34
35
use RuntimeException ;
35
36
use Symfony \Component \Filesystem \Path ;
36
37
37
38
use function array_filter ;
38
39
use function array_key_exists ;
40
+ use function array_keys ;
39
41
use function array_map ;
40
42
use function array_merge ;
41
43
use function array_slice ;
67
69
use function preg_replace ;
68
70
use function realpath ;
69
71
use function setlocale ;
72
+ use function sort ;
70
73
use function str_repeat ;
71
74
use function str_replace ;
72
75
use function strlen ;
73
76
use function strpos ;
74
77
use function substr ;
78
+ use function wordwrap ;
75
79
76
80
use const DIRECTORY_SEPARATOR ;
77
81
use const JSON_THROW_ON_ERROR ;
87
91
require_once __DIR__ . '/../Composer.php ' ;
88
92
require_once __DIR__ . '/../IncludeCollector.php ' ;
89
93
require_once __DIR__ . '/../../IssueBuffer.php ' ;
94
+ require_once __DIR__ . '/../../Report.php ' ;
90
95
91
96
/**
92
97
* @internal
@@ -1250,6 +1255,21 @@ private static function generateStubs(
1250
1255
*/
1251
1256
private static function getHelpText (): string
1252
1257
{
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
+
1253
1273
return <<<HELP
1254
1274
Usage:
1255
1275
psalm [options] [file...]
@@ -1333,8 +1353,8 @@ private static function getHelpText(): string
1333
1353
1334
1354
--output-format=console
1335
1355
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
1338
1358
1339
1359
--no-progress
1340
1360
Disable the progress indicator
@@ -1348,8 +1368,7 @@ private static function getHelpText(): string
1348
1368
Reports:
1349
1369
--report=PATH
1350
1370
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)
1353
1372
1354
1373
--report-show-info[=BOOLEAN]
1355
1374
Whether the report should include non-errors in its output (defaults to true)
0 commit comments