mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
parent
559b3d3471
commit
8404fa0750
@ -324,6 +324,9 @@ Issue baselines:
|
||||
|
||||
Add --include-php-versions to also include a list of PHP extension versions
|
||||
|
||||
--use-baseline=PATH
|
||||
Allows you to use a baseline other than the default baseline provided in your config
|
||||
|
||||
--ignore-baseline
|
||||
Ignore the error baseline
|
||||
|
||||
|
@ -56,6 +56,7 @@ $valid_long_options = [
|
||||
'stats',
|
||||
'threads:',
|
||||
'update-baseline',
|
||||
'use-baseline:',
|
||||
'use-ini-defaults',
|
||||
'version',
|
||||
'php-version:',
|
||||
@ -672,11 +673,22 @@ if (isset($options['update-baseline'])) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty(Config::getInstance()->error_baseline) && !isset($options['ignore-baseline'])) {
|
||||
if (isset($options['use-baseline'])) {
|
||||
if (!is_string($options['use-baseline'])) {
|
||||
fwrite(STDERR, '--use-baseline must be a string' . PHP_EOL);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$baseline_file_path = $options['use-baseline'];
|
||||
} else {
|
||||
$baseline_file_path = Config::getInstance()->error_baseline;
|
||||
}
|
||||
|
||||
if ($baseline_file_path && !isset($options['ignore-baseline'])) {
|
||||
try {
|
||||
$issue_baseline = ErrorBaseline::read(
|
||||
new \Psalm\Internal\Provider\FileProvider,
|
||||
(string)Config::getInstance()->error_baseline
|
||||
$baseline_file_path
|
||||
);
|
||||
} catch (\Psalm\Exception\ConfigException $exception) {
|
||||
fwrite(STDERR, 'Error while reading baseline: ' . $exception->getMessage() . PHP_EOL);
|
||||
|
Loading…
Reference in New Issue
Block a user