mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #2644 - improve type inference of autoloaded constants
This commit is contained in:
parent
24e1d5446c
commit
471d7610f0
@ -101,6 +101,24 @@ class ConstFetchAnalyzer
|
||||
return Type::getResource();
|
||||
}
|
||||
|
||||
if ($fq_const_name) {
|
||||
$stubbed_const_type = $codebase->getStubbedConstantType(
|
||||
$fq_const_name
|
||||
);
|
||||
|
||||
if ($stubbed_const_type) {
|
||||
return $stubbed_const_type;
|
||||
}
|
||||
}
|
||||
|
||||
$stubbed_const_type = $codebase->getStubbedConstantType(
|
||||
$const_name
|
||||
);
|
||||
|
||||
if ($stubbed_const_type) {
|
||||
return $stubbed_const_type;
|
||||
}
|
||||
|
||||
$predefined_constants = $codebase->config->getPredefinedConstants();
|
||||
|
||||
if (($fq_const_name && array_key_exists($fq_const_name, $predefined_constants))
|
||||
@ -156,14 +174,6 @@ class ConstFetchAnalyzer
|
||||
return ClassLikeAnalyzer::getTypeFromValue($predefined_constants[$const_name]);
|
||||
}
|
||||
|
||||
$stubbed_const_type = $codebase->getStubbedConstantType(
|
||||
$fq_const_name ?: $const_name
|
||||
);
|
||||
|
||||
if ($stubbed_const_type) {
|
||||
return $stubbed_const_type;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user