From 85e75c4d93c9ce5be562d17764787fc9dfd4d8e5 Mon Sep 17 00:00:00 2001 From: HypeMC Date: Fri, 28 Jun 2024 08:05:25 +0200 Subject: [PATCH] Check for `psalm.dist.xml` as well --- src/Psalm/Config.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 069fd2c7a1f..93fecd99d7d 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -129,7 +129,11 @@ */ class Config { - private const DEFAULT_FILE_NAME = 'psalm.xml'; + private const DEFAULT_FILE_NAMES = [ + 'psalm.xml', + 'psalm.xml.dist', + 'psalm.dist.xml', + ]; public const CONFIG_NAMESPACE = 'https://getpsalm.org/schema/config'; public const REPORT_INFO = 'info'; public const REPORT_ERROR = 'error'; @@ -773,10 +777,10 @@ public static function locateConfigFile(string $path): ?string } do { - $maybe_path = $dir_path . DIRECTORY_SEPARATOR . self::DEFAULT_FILE_NAME; - - if (file_exists($maybe_path) || file_exists($maybe_path .= '.dist')) { - return $maybe_path; + foreach (self::DEFAULT_FILE_NAMES as $defaultFileName) { + if (file_exists($maybe_path = $dir_path . DIRECTORY_SEPARATOR . $defaultFileName)) { + return $maybe_path; + } } $dir_path = dirname($dir_path);