From 138c7b801ef97a2110e11a509d1cb39cf5fefd25 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 1 Feb 2024 01:41:24 +0100 Subject: [PATCH] Fix baseline loading for path specified on the command line Fixes vimeo/psalm#10624 --- src/Psalm/Internal/Cli/Psalm.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index dda0e27530b..c354cf21a58 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -1067,7 +1067,8 @@ private static function initBaseline( if ($paths_to_check !== null) { $filtered_issue_baseline = []; foreach ($paths_to_check as $path_to_check) { - $path_to_check = substr($path_to_check, strlen($config->base_dir)); + // +1 to remove the initial slash from $path_to_check + $path_to_check = substr($path_to_check, strlen($config->base_dir) + 1); if (isset($issue_baseline[$path_to_check])) { $filtered_issue_baseline[$path_to_check] = $issue_baseline[$path_to_check]; }