Skip to content

Commit

Permalink
Check for psalm.dist.xml as well
Browse files Browse the repository at this point in the history
  • Loading branch information
HypeMC committed Jun 28, 2024
1 parent 01a8eb0 commit 85e75c4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 85e75c4

Please sign in to comment.