From 45bf0d961c58e56523e6b8462d792cc1ed306593 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sun, 4 Dec 2022 04:34:08 -0400 Subject: [PATCH] Improve source autodiscovery failure message The message we emitted previously did not provide any instructions on how to resolve the issue, leaving users to guess what they need to do. --- src/Psalm/Config/Creator.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Config/Creator.php b/src/Psalm/Config/Creator.php index 7ff92a57ef2..8748ff42ed5 100644 --- a/src/Psalm/Config/Creator.php +++ b/src/Psalm/Config/Creator.php @@ -132,7 +132,7 @@ public static function getLevel(array $issues, int $counted_types): int $issues_at_level[$issue_level][$issue_type] = 0; } - $issues_at_level[$issue_level][$issue_type] += 100/$counted_types; + $issues_at_level[$issue_level][$issue_type] += 100 / $counted_types; } foreach ($issues_at_level as $level => $issues) { @@ -186,7 +186,10 @@ public static function getPaths(string $current_dir, ?string $suggested_dir): ar if (!file_exists($composer_json_location)) { throw new ConfigCreationException( - 'Problem during config autodiscovery - could not find composer.json during initialization.' + 'Problem during source autodiscovery - could not find composer.json during initialization. ' + . 'If your project doesn\'t use Composer autoloader you will need to run ' + . '`psalm --init source_folder`, e.g. `psalm --init library` if your source files ' + . 'reside in `library` folder' ); } try {