1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +01:00

relative path as absolute paths autoloader legacy issue

This commit is contained in:
kkmuffme 2023-01-03 15:35:57 +01:00
parent 76f90e62f2
commit 1a0c0fe5c5

View File

@ -1062,14 +1062,17 @@ class Config
}
if (isset($config_xml['autoloader'])) {
if ($config_xml['autoloader']->__toString()[0] === '/') {
$autoloader_path = $config_xml['autoloader']->__toString();
} else {
$autoloader_path = $config->base_dir . DIRECTORY_SEPARATOR . $config_xml['autoloader'];
}
$autoloader_path = $config->base_dir . DIRECTORY_SEPARATOR . $config_xml['autoloader'];
if (!file_exists($autoloader_path)) {
throw new ConfigException('Cannot locate autoloader');
// in here for legacy reasons where people put absolute paths but psalm resolved it relative
if ($config_xml['autoloader']->__toString()[0] === '/') {
$autoloader_path = $config_xml['autoloader']->__toString();
}
if (!file_exists($autoloader_path)) {
throw new ConfigException('Cannot locate autoloader');
}
}
$config->autoloader = realpath($autoloader_path);