Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for psalm.dist.xml as well #11031

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading