Skip to content

Commit 181bef2

Browse files
Show help for --manifest, --sbom, and --composer-lock when the PHAR is used
1 parent 8871541 commit 181bef2

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/TextUI/Help.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use const PHP_EOL;
1313
use function count;
14+
use function defined;
1415
use function explode;
1516
use function max;
1617
use function preg_replace_callback;
@@ -149,7 +150,7 @@ static function ($matches)
149150
*/
150151
private function elements(): array
151152
{
152-
return [
153+
$elements = [
153154
'Usage' => [
154155
['text' => 'phpunit [options] UnitTest [UnitTest.php]'],
155156
['text' => 'phpunit [options] <directory>'],
@@ -250,13 +251,23 @@ private function elements(): array
250251
['arg' => '--generate-configuration', 'desc' => 'Generate configuration file with suggested settings'],
251252
['arg' => '--cache-result-file=<file>', 'desc' => 'Specify result cache path and filename'],
252253
],
254+
];
253255

254-
'Miscellaneous Options' => [
255-
['arg' => '-h|--help', 'desc' => 'Prints this usage information'],
256-
['arg' => '--version', 'desc' => 'Prints the version and exits'],
257-
['arg' => '--atleast-version <min>', 'desc' => 'Checks that version is greater than min and exits'],
258-
['arg' => '--check-version', 'desc' => 'Check whether PHPUnit is the latest version'],
259-
],
256+
if (defined('__PHPUNIT_PHAR__')) {
257+
$elements['PHAR Options'] = [
258+
['arg' => '--manifest', 'desc' => 'Print Software Bill of Materials (SBOM) in plain-text format'],
259+
['arg' => '--sbom', 'desc' => 'Print Software Bill of Materials (SBOM) in CycloneDX XML format'],
260+
['arg' => '--composer-lock', 'desc' => 'Print composer.lock file used to build the PHAR'],
261+
];
262+
}
263+
264+
$elements['Miscellaneous Options'] = [
265+
['arg' => '-h|--help', 'desc' => 'Prints this usage information'],
266+
['arg' => '--version', 'desc' => 'Prints the version and exits'],
267+
['arg' => '--atleast-version <min>', 'desc' => 'Checks that version is greater than min and exits'],
268+
['arg' => '--check-version', 'desc' => 'Check whether PHPUnit is the latest version'],
260269
];
270+
271+
return $elements;
261272
}
262273
}

0 commit comments

Comments
 (0)