1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Add a warning when fixing unused code issues without accompanying detection

This commit is contained in:
Brown 2019-04-30 15:06:42 -04:00
parent d53ba0b826
commit 5674193922

View File

@ -325,6 +325,17 @@ if ($config->find_unused_code) {
if ($find_unused_code) {
$project_analyzer->getCodebase()->reportUnusedCode();
} else {
foreach ($keyed_issues as $issue_name => $_) {
if (strpos($issue_name, 'Unused') !== false) {
die(
'Error: Psalm can only fix issue '
. $issue_name
. ' if you enable unused code detection with --find-unused-code'
. PHP_EOL
);
}
}
}
$project_analyzer->alterCodeAfterCompletion(