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:
parent
d53ba0b826
commit
5674193922
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user