Skip to content

Commit

Permalink
Merge pull request #11031 from HypeMC/check-for-psalm.dist.xml-as-well
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Sep 7, 2024
2 parents c2bdb40 + 85e75c4 commit 3c13a5b
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 3c13a5b

Please sign in to comment.