1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Properly warn when a short option is invalid. (#2280)

Previously, Psalm would not warn or exit - it would skip over the arg and
continue with analysis.
This commit is contained in:
Tyson Andre 2019-10-29 04:55:34 -04:00 committed by Matthew Brown
parent 0ac5c32f2f
commit f40fe86321

View File

@ -110,7 +110,7 @@ array_map(
);
exit(1);
}
} elseif (substr($arg, 0, 2) === '-' && $arg !== '-' && $arg !== '--') {
} elseif (substr($arg, 0, 1) === '-' && $arg !== '-' && $arg !== '--') {
$arg_name = preg_replace('/=.*$/', '', substr($arg, 1));
if (!in_array($arg_name, $valid_short_options) && !in_array($arg_name . ':', $valid_short_options)) {